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/. */
4 
5 #include "nsHtml5Speculation.h"
6 
7 using namespace mozilla;
8 
nsHtml5Speculation(nsHtml5OwningUTF16Buffer * aBuffer,int32_t aStart,int32_t aStartLineNumber,nsAHtml5TreeBuilderState * aSnapshot)9 nsHtml5Speculation::nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer,
10                                        int32_t aStart, int32_t aStartLineNumber,
11                                        nsAHtml5TreeBuilderState* aSnapshot)
12     : mBuffer(aBuffer),
13       mStart(aStart),
14       mStartLineNumber(aStartLineNumber),
15       mSnapshot(aSnapshot) {
16   MOZ_COUNT_CTOR(nsHtml5Speculation);
17 }
18 
~nsHtml5Speculation()19 nsHtml5Speculation::~nsHtml5Speculation() {
20   MOZ_COUNT_DTOR(nsHtml5Speculation);
21 }
22 
MoveOpsFrom(nsTArray<nsHtml5TreeOperation> & aOpQueue)23 void nsHtml5Speculation::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue) {
24   mOpQueue.AppendElements(std::move(aOpQueue));
25 }
26 
FlushToSink(nsAHtml5TreeOpSink * aSink)27 void nsHtml5Speculation::FlushToSink(nsAHtml5TreeOpSink* aSink) {
28   aSink->MoveOpsFrom(mOpQueue);
29 }
30