Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsHtml5OwningUTF16Buffer_h
6 #define nsHtml5OwningUTF16Buffer_h
8 #include "nsHtml5UTF16Buffer.h"
10 class nsHtml5OwningUTF16Buffer : public nsHtml5UTF16Buffer
11 {
12 private:
14 /**
15 * Passes a buffer and its length to the superclass constructor.
16 */
17 nsHtml5OwningUTF16Buffer(char16_t* aBuffer);
19 public:
21 /**
22 * Constructor for a parser key placeholder. (No actual buffer.)
23 * @param aKey a parser key
24 */
25 nsHtml5OwningUTF16Buffer(void* aKey);
27 /**
28 * Takes care of releasing the owned buffer.
29 */
30 ~nsHtml5OwningUTF16Buffer();
32 /**
33 * The next buffer in a queue.
34 */
35 nsRefPtr<nsHtml5OwningUTF16Buffer> next;
37 /**
38 * A parser key.
39 */
40 void* key;
42 static already_AddRefed<nsHtml5OwningUTF16Buffer>
43 FalliblyCreate(int32_t aLength);
45 /**
46 * Swap start, end and buffer fields with another object.
47 */
48 void Swap(nsHtml5OwningUTF16Buffer* aOther);
50 nsrefcnt AddRef();
51 nsrefcnt Release();
52 private:
53 nsAutoRefCnt mRefCnt;
54 };
56 #endif // nsHtml5OwningUTF16Buffer_h