Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
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 #include "nsHtml5Speculation.h"
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 }
19 nsHtml5Speculation::~nsHtml5Speculation()
20 {
21 MOZ_COUNT_DTOR(nsHtml5Speculation);
22 }
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 }
34 void
35 nsHtml5Speculation::FlushToSink(nsAHtml5TreeOpSink* aSink)
36 {
37 aSink->MoveOpsFrom(mOpQueue);
38 }