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