|
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/. */ |
|
4 |
|
5 #ifndef nsHtml5OwningUTF16Buffer_h |
|
6 #define nsHtml5OwningUTF16Buffer_h |
|
7 |
|
8 #include "nsHtml5UTF16Buffer.h" |
|
9 |
|
10 class nsHtml5OwningUTF16Buffer : public nsHtml5UTF16Buffer |
|
11 { |
|
12 private: |
|
13 |
|
14 /** |
|
15 * Passes a buffer and its length to the superclass constructor. |
|
16 */ |
|
17 nsHtml5OwningUTF16Buffer(char16_t* aBuffer); |
|
18 |
|
19 public: |
|
20 |
|
21 /** |
|
22 * Constructor for a parser key placeholder. (No actual buffer.) |
|
23 * @param aKey a parser key |
|
24 */ |
|
25 nsHtml5OwningUTF16Buffer(void* aKey); |
|
26 |
|
27 /** |
|
28 * Takes care of releasing the owned buffer. |
|
29 */ |
|
30 ~nsHtml5OwningUTF16Buffer(); |
|
31 |
|
32 /** |
|
33 * The next buffer in a queue. |
|
34 */ |
|
35 nsRefPtr<nsHtml5OwningUTF16Buffer> next; |
|
36 |
|
37 /** |
|
38 * A parser key. |
|
39 */ |
|
40 void* key; |
|
41 |
|
42 static already_AddRefed<nsHtml5OwningUTF16Buffer> |
|
43 FalliblyCreate(int32_t aLength); |
|
44 |
|
45 /** |
|
46 * Swap start, end and buffer fields with another object. |
|
47 */ |
|
48 void Swap(nsHtml5OwningUTF16Buffer* aOther); |
|
49 |
|
50 nsrefcnt AddRef(); |
|
51 nsrefcnt Release(); |
|
52 private: |
|
53 nsAutoRefCnt mRefCnt; |
|
54 }; |
|
55 |
|
56 #endif // nsHtml5OwningUTF16Buffer_h |