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
{
13 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHtml5OwningUTF16Buffer
)
17 * Passes a buffer and its length to the superclass constructor.
19 explicit nsHtml5OwningUTF16Buffer(char16_t
* aBuffer
);
23 * Constructor for a parser key placeholder. (No actual buffer.)
24 * @param aKey a parser key
26 explicit nsHtml5OwningUTF16Buffer(void* aKey
);
30 * Takes care of releasing the owned buffer.
32 ~nsHtml5OwningUTF16Buffer();
36 * The next buffer in a queue.
38 RefPtr
<nsHtml5OwningUTF16Buffer
> next
;
45 static already_AddRefed
<nsHtml5OwningUTF16Buffer
> FalliblyCreate(
49 * Swap start, end and buffer fields with another object.
51 void Swap(nsHtml5OwningUTF16Buffer
* aOther
);
54 * Return a span from `end` to `aBufferSize`.
56 mozilla::Span
<char16_t
> TailAsSpan(int32_t aBufferSize
);
59 * Add the argument to `end`.
61 void AdvanceEnd(int32_t aNumberOfCodeUnits
);
64 #endif // nsHtml5OwningUTF16Buffer_h