Bug 1833854 - Part 7: Add the FOR_EACH_GC_TUNABLE macro to describe tunable GC parame...
[gecko.git] / parser / html / nsHtml5OwningUTF16Buffer.h
blob7cfdf74b9b2e63fadb887d73cf5c2896087b90ee
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 private:
13 /**
14 * Passes a buffer and its length to the superclass constructor.
16 explicit nsHtml5OwningUTF16Buffer(char16_t* aBuffer);
18 public:
19 /**
20 * Constructor for a parser key placeholder. (No actual buffer.)
21 * @param aKey a parser key
23 explicit nsHtml5OwningUTF16Buffer(void* aKey);
25 protected:
26 /**
27 * Takes care of releasing the owned buffer.
29 ~nsHtml5OwningUTF16Buffer();
31 public:
32 /**
33 * The next buffer in a queue.
35 RefPtr<nsHtml5OwningUTF16Buffer> next;
37 /**
38 * A parser key.
40 void* key;
42 static already_AddRefed<nsHtml5OwningUTF16Buffer> FalliblyCreate(
43 int32_t aLength);
45 /**
46 * Swap start, end and buffer fields with another object.
48 void Swap(nsHtml5OwningUTF16Buffer* aOther);
50 /**
51 * Return a span from `end` to `aBufferSize`.
53 mozilla::Span<char16_t> TailAsSpan(int32_t aBufferSize);
55 /**
56 * Add the argument to `end`.
58 void AdvanceEnd(int32_t aNumberOfCodeUnits);
60 nsrefcnt AddRef();
61 nsrefcnt Release();
63 private:
64 mozilla::ThreadSafeAutoRefCnt mRefCnt;
67 #endif // nsHtml5OwningUTF16Buffer_h