michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHtml5OwningUTF16Buffer_h michael@0: #define nsHtml5OwningUTF16Buffer_h michael@0: michael@0: #include "nsHtml5UTF16Buffer.h" michael@0: michael@0: class nsHtml5OwningUTF16Buffer : public nsHtml5UTF16Buffer michael@0: { michael@0: private: michael@0: michael@0: /** michael@0: * Passes a buffer and its length to the superclass constructor. michael@0: */ michael@0: nsHtml5OwningUTF16Buffer(char16_t* aBuffer); michael@0: michael@0: public: michael@0: michael@0: /** michael@0: * Constructor for a parser key placeholder. (No actual buffer.) michael@0: * @param aKey a parser key michael@0: */ michael@0: nsHtml5OwningUTF16Buffer(void* aKey); michael@0: michael@0: /** michael@0: * Takes care of releasing the owned buffer. michael@0: */ michael@0: ~nsHtml5OwningUTF16Buffer(); michael@0: michael@0: /** michael@0: * The next buffer in a queue. michael@0: */ michael@0: nsRefPtr next; michael@0: michael@0: /** michael@0: * A parser key. michael@0: */ michael@0: void* key; michael@0: michael@0: static already_AddRefed michael@0: FalliblyCreate(int32_t aLength); michael@0: michael@0: /** michael@0: * Swap start, end and buffer fields with another object. michael@0: */ michael@0: void Swap(nsHtml5OwningUTF16Buffer* aOther); michael@0: michael@0: nsrefcnt AddRef(); michael@0: nsrefcnt Release(); michael@0: private: michael@0: nsAutoRefCnt mRefCnt; michael@0: }; michael@0: michael@0: #endif // nsHtml5OwningUTF16Buffer_h