Line data Source 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/. */
4 :
5 : #include "nsHtml5TreeOpStage.h"
6 :
7 : using namespace mozilla;
8 :
9 2 : nsHtml5TreeOpStage::nsHtml5TreeOpStage()
10 2 : : mMutex("nsHtml5TreeOpStage mutex")
11 : {
12 2 : }
13 :
14 0 : nsHtml5TreeOpStage::~nsHtml5TreeOpStage()
15 : {
16 0 : }
17 :
18 : void
19 3 : nsHtml5TreeOpStage::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
20 : {
21 6 : mozilla::MutexAutoLock autoLock(mMutex);
22 3 : mOpQueue.AppendElements(Move(aOpQueue));
23 3 : }
24 :
25 : void
26 2 : nsHtml5TreeOpStage::MoveOpsAndSpeculativeLoadsTo(nsTArray<nsHtml5TreeOperation>& aOpQueue,
27 : nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
28 : {
29 4 : mozilla::MutexAutoLock autoLock(mMutex);
30 2 : aOpQueue.AppendElements(Move(mOpQueue));
31 2 : aSpeculativeLoadQueue.AppendElements(Move(mSpeculativeLoadQueue));
32 2 : }
33 :
34 : void
35 5 : nsHtml5TreeOpStage::MoveSpeculativeLoadsFrom(nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
36 : {
37 10 : mozilla::MutexAutoLock autoLock(mMutex);
38 5 : mSpeculativeLoadQueue.AppendElements(Move(aSpeculativeLoadQueue));
39 5 : }
40 :
41 : void
42 7 : nsHtml5TreeOpStage::MoveSpeculativeLoadsTo(nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
43 : {
44 14 : mozilla::MutexAutoLock autoLock(mMutex);
45 7 : aSpeculativeLoadQueue.AppendElements(Move(mSpeculativeLoadQueue));
46 7 : }
47 :
48 : #ifdef DEBUG
49 : void
50 5 : nsHtml5TreeOpStage::AssertEmpty()
51 : {
52 10 : mozilla::MutexAutoLock autoLock(mMutex);
53 : // This shouldn't really need the mutex
54 5 : NS_ASSERTION(mOpQueue.IsEmpty(), "The stage was supposed to be empty.");
55 5 : }
56 : #endif
|