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"
9 #include "mozilla/Span.h"
11 class nsHtml5OwningUTF16Buffer
: public nsHtml5UTF16Buffer
{
14 * Passes a buffer and its length to the superclass constructor.
16 explicit nsHtml5OwningUTF16Buffer(char16_t
* aBuffer
);
20 * Constructor for a parser key placeholder. (No actual buffer.)
21 * @param aKey a parser key
23 explicit nsHtml5OwningUTF16Buffer(void* aKey
);
27 * Takes care of releasing the owned buffer.
29 ~nsHtml5OwningUTF16Buffer();
33 * The next buffer in a queue.
35 RefPtr
<nsHtml5OwningUTF16Buffer
> next
;
42 static already_AddRefed
<nsHtml5OwningUTF16Buffer
> FalliblyCreate(
46 * Swap start, end and buffer fields with another object.
48 void Swap(nsHtml5OwningUTF16Buffer
* aOther
);
51 * Return a span from `end` to `aBufferSize`.
53 mozilla::Span
<char16_t
> TailAsSpan(int32_t aBufferSize
);
56 * Add the argument to `end`.
58 void AdvanceEnd(int32_t aNumberOfCodeUnits
);
64 mozilla::ThreadSafeAutoRefCnt mRefCnt
;
67 #endif // nsHtml5OwningUTF16Buffer_h