Bug 788829 - Call SetSizeConstraints even if a popup is not open. r=enndeakin
[gecko.git] / parser / html / nsHtml5TreeOpStage.cpp
blob97e51e9297e13ddc5b2bbadbba09689b895f5ca8
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 "nsHtml5TreeOpStage.h"
7 nsHtml5TreeOpStage::nsHtml5TreeOpStage()
8 : mMutex("nsHtml5TreeOpStage mutex")
12 nsHtml5TreeOpStage::~nsHtml5TreeOpStage()
16 void
17 nsHtml5TreeOpStage::MoveOpsFrom(nsTArray<nsHtml5TreeOperation>& aOpQueue)
19 mozilla::MutexAutoLock autoLock(mMutex);
20 if (mOpQueue.IsEmpty()) {
21 mOpQueue.SwapElements(aOpQueue);
22 } else {
23 mOpQueue.MoveElementsFrom(aOpQueue);
27 void
28 nsHtml5TreeOpStage::MoveOpsAndSpeculativeLoadsTo(nsTArray<nsHtml5TreeOperation>& aOpQueue,
29 nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
31 mozilla::MutexAutoLock autoLock(mMutex);
32 if (aOpQueue.IsEmpty()) {
33 mOpQueue.SwapElements(aOpQueue);
34 } else {
35 aOpQueue.MoveElementsFrom(mOpQueue);
37 if (aSpeculativeLoadQueue.IsEmpty()) {
38 mSpeculativeLoadQueue.SwapElements(aSpeculativeLoadQueue);
39 } else {
40 aSpeculativeLoadQueue.MoveElementsFrom(mSpeculativeLoadQueue);
44 void
45 nsHtml5TreeOpStage::MoveSpeculativeLoadsFrom(nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
47 mozilla::MutexAutoLock autoLock(mMutex);
48 if (mSpeculativeLoadQueue.IsEmpty()) {
49 mSpeculativeLoadQueue.SwapElements(aSpeculativeLoadQueue);
50 } else {
51 mSpeculativeLoadQueue.MoveElementsFrom(aSpeculativeLoadQueue);
55 void
56 nsHtml5TreeOpStage::MoveSpeculativeLoadsTo(nsTArray<nsHtml5SpeculativeLoad>& aSpeculativeLoadQueue)
58 mozilla::MutexAutoLock autoLock(mMutex);
59 if (aSpeculativeLoadQueue.IsEmpty()) {
60 mSpeculativeLoadQueue.SwapElements(aSpeculativeLoadQueue);
61 } else {
62 aSpeculativeLoadQueue.MoveElementsFrom(mSpeculativeLoadQueue);
66 #ifdef DEBUG
67 void
68 nsHtml5TreeOpStage::AssertEmpty()
70 mozilla::MutexAutoLock autoLock(mMutex);
71 // This shouldn't really need the mutex
72 NS_ASSERTION(mOpQueue.IsEmpty(), "The stage was supposed to be empty.");
74 #endif