Backed out changeset f319d88c8aad (bug 1867739) for causing failures on browser_pdfjs...
[gecko.git] / parser / html / nsHtml5OwningUTF16Buffer.h
blob2cc94583e7ca7675033137c11bbdb10fc86dadf7
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 {
12 public:
13 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsHtml5OwningUTF16Buffer)
15 private:
16 /**
17 * Passes a buffer and its length to the superclass constructor.
19 explicit nsHtml5OwningUTF16Buffer(char16_t* aBuffer);
21 public:
22 /**
23 * Constructor for a parser key placeholder. (No actual buffer.)
24 * @param aKey a parser key
26 explicit nsHtml5OwningUTF16Buffer(void* aKey);
28 protected:
29 /**
30 * Takes care of releasing the owned buffer.
32 ~nsHtml5OwningUTF16Buffer();
34 public:
35 /**
36 * The next buffer in a queue.
38 RefPtr<nsHtml5OwningUTF16Buffer> next;
40 /**
41 * A parser key.
43 void* key;
45 static already_AddRefed<nsHtml5OwningUTF16Buffer> FalliblyCreate(
46 int32_t aLength);
48 /**
49 * Swap start, end and buffer fields with another object.
51 void Swap(nsHtml5OwningUTF16Buffer* aOther);
53 /**
54 * Return a span from `end` to `aBufferSize`.
56 mozilla::Span<char16_t> TailAsSpan(int32_t aBufferSize);
58 /**
59 * Add the argument to `end`.
61 void AdvanceEnd(int32_t aNumberOfCodeUnits);
64 #endif // nsHtml5OwningUTF16Buffer_h