parser/html/nsHtml5Speculation.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/html/nsHtml5Speculation.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsHtml5Speculation.h"
     1.9 +
    1.10 +nsHtml5Speculation::nsHtml5Speculation(nsHtml5OwningUTF16Buffer* aBuffer,
    1.11 +                                       int32_t aStart, 
    1.12 +                                       int32_t aStartLineNumber, 
    1.13 +                                       nsAHtml5TreeBuilderState* aSnapshot)
    1.14 +  : mBuffer(aBuffer)
    1.15 +  , mStart(aStart)
    1.16 +  , mStartLineNumber(aStartLineNumber)
    1.17 +  , mSnapshot(aSnapshot)
    1.18 +{
    1.19 +  MOZ_COUNT_CTOR(nsHtml5Speculation);
    1.20 +}
    1.21 +
    1.22 +nsHtml5Speculation::~nsHtml5Speculation()
    1.23 +{
    1.24 +  MOZ_COUNT_DTOR(nsHtml5Speculation);
    1.25 +}
    1.26 +
    1.27 +void
    1.28 +nsHtml5Speculation::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
    1.29 +{
    1.30 +  if (mOpQueue.IsEmpty()) {
    1.31 +    mOpQueue.SwapElements(aOpQueue);
    1.32 +    return;
    1.33 +  }
    1.34 +  mOpQueue.MoveElementsFrom(aOpQueue);
    1.35 +}
    1.36 +
    1.37 +void
    1.38 +nsHtml5Speculation::FlushToSink(nsAHtml5TreeOpSink* aSink)
    1.39 +{
    1.40 +  aSink->MoveOpsFrom(mOpQueue);
    1.41 +}

mercurial