|
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 nsHtml5Speculation::nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer, |
|
8 int32_t aStart, |
|
9 int32_t aStartLineNumber, |
|
10 nsAHtml5TreeBuilderState* aSnapshot) |
|
11 : mBuffer(aBuffer) |
|
12 , mStart(aStart) |
|
13 , mStartLineNumber(aStartLineNumber) |
|
14 , mSnapshot(aSnapshot) |
|
15 { |
|
16 MOZ_COUNT_CTOR(nsHtml5Speculation); |
|
17 } |
|
18 |
|
19 nsHtml5Speculation::~nsHtml5Speculation() |
|
20 { |
|
21 MOZ_COUNT_DTOR(nsHtml5Speculation); |
|
22 } |
|
23 |
|
24 void |
|
25 nsHtml5Speculation::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue) |
|
26 { |
|
27 if (mOpQueue.IsEmpty()) { |
|
28 mOpQueue.SwapElements(aOpQueue); |
|
29 return; |
|
30 } |
|
31 mOpQueue.MoveElementsFrom(aOpQueue); |
|
32 } |
|
33 |
|
34 void |
|
35 nsHtml5Speculation::FlushToSink(nsAHtml5TreeOpSink* aSink) |
|
36 { |
|
37 aSink->MoveOpsFrom(mOpQueue); |
|
38 } |