Files
palemoon27/editor/txmgr/nsTransactionStack.cpp
T
roytam1 fc9fb8b315 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1240411: P6. Clean up OMX headers. r=ayang (114a1df4be)
- Bug 1230385, part 1 - Use MOZ_CRASH in ContentChild::AllocP*() methods. r=billm (6f8016bb29)
- Bug 1230385, part 2 - Use NS_WARNING in unimplemented TabChild methods. r=billm (28a7165773)
- Bug 1234026 - Pass a --display option to gtk_init in content processes. r=karlt (8e3e17858e)
- Bug 1218816 - Remove useless semicolons. Found by coccinelle. r=Ehsan (e029c51e58)
- Bug 1240796 - Implement Uint32x4 <==> Float32x4 conversions. r=sunfish (5a42f571ea)
- Bug 1240796 - Implement unsigned SIMD compares. r=sunfish (93d4979730)
- Bug 1240796 - Implement Uint32x4 extractLane in Ion. r=nbp (b5b7c782b6)
- Bug 1240796 - Add Uint32x4 support to jit-test/lib/simd.js. r=bbouvier (187cbbb1d0)
- Bug 1245547 - Implement RSimdBox for Uint32x4. r=nbp (0186f0355f)
- Bug 1244254 - Move SimdTypeToMIRType into the header. r=nbp (5b15375c4e)
- Bug 1217236 - Block trackers loaded by Flash movies. r=gcp (a1318a33da)
- Bug 1237402 - Allow certain plugins to be loaded in parent process (r=jimm) (e951737778)
- Bug 1172304 - Fix to handle short read in Plugin code. r=johns (625dadd61b)
- Bug 377630 - Preventing filename disclosure, by putting downloaded files in a private directory. r=bz (5aca752a5c)
- Bug 579517 follow-up: Remove NSPR types that crept in (c7cb9ffc11)
- Bug 1245724 - Make plugin network requests bypass service worker interception. r=ehsan (a0b7fab3ee)
- Please enter the commit message for your chang Bug 1244254 - Pass a SimdType to inlineSimd(). r=nbp (6fcacd3c5d)
- Bug 1244254 - Add IonBuilder::unboxSimd(). r=nbp (d5f0922fd9)
- Bug 1244254 - Check SIMD arguments in IonBuilder. r=nbp (832d38940f)
- Bug 1244254 - Replace MaybeSimdUnbox with assertions. r=nbp (9c2ad4a8c5)
- Bug 1244254 - Add SimdType to MSimdBox and MSimdUnbox. r=nbp (74412371f5)
- Bug 1238003 - Part 1: Add BooleanPolicy. r=jandem (79c1716cac)
- Bug 1238003 - Part 2: Use Policy in RegExpMatcher and RegExpTester. r=jandem (a2ef8feec4)
- Bug 1238003 - Part 3: Add test for Policy in RegExpMatcher and RegExpTester. r=jandem (1653bec783)
- Bug 1244254 - Simplify MSimd* constructors. r=nbp (0ab2efcb4c)
- Bug 1244889 - Remove trivial SIMD NewAsmJS factories. r=bbouvier (2f9c41713c)
- Bug 1244828 - Ensure enough ballast space in CallPolicy::adjustInputs. r=bbouvier (d84dae2175)
- Bug 1244828 - Ensure enough ballast space in AllDoublePolicy::adjustInputs. r=bbouvier (361092db86)
- Bug 1245421: Remove dead function CoercesToDouble; r=h4writer (502b9efcee)
2023-09-11 09:34:11 +08:00

97 lines
2.2 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsUtils.h"
#include "nsTransactionItem.h"
#include "nsTransactionStack.h"
#include "nscore.h"
nsTransactionStack::nsTransactionStack(nsTransactionStack::Type aType)
: mType(aType)
{
}
nsTransactionStack::~nsTransactionStack()
{
Clear();
}
void
nsTransactionStack::Push(nsTransactionItem *aTransaction)
{
if (!aTransaction) {
return;
}
// The stack's bottom is the front of the deque, and the top is the back.
mDeque.push_back(aTransaction);
}
already_AddRefed<nsTransactionItem>
nsTransactionStack::Pop()
{
if (mDeque.empty()) {
return nullptr;
}
RefPtr<nsTransactionItem> ret = mDeque.back().forget();
mDeque.pop_back();
return ret.forget();
}
already_AddRefed<nsTransactionItem>
nsTransactionStack::PopBottom()
{
if (mDeque.empty()) {
return nullptr;
}
RefPtr<nsTransactionItem> ret = mDeque.front().forget();
mDeque.pop_front();
return ret.forget();
}
already_AddRefed<nsTransactionItem>
nsTransactionStack::Peek()
{
if (mDeque.empty()) {
return nullptr;
}
RefPtr<nsTransactionItem> ret = mDeque.back();
return ret.forget();
}
already_AddRefed<nsTransactionItem>
nsTransactionStack::GetItem(int32_t aIndex)
{
if (aIndex < 0 || aIndex >= static_cast<int32_t>(mDeque.size())) {
return nullptr;
}
RefPtr<nsTransactionItem> ret = mDeque[aIndex];
return ret.forget();
}
void
nsTransactionStack::Clear()
{
while (!mDeque.empty()) {
RefPtr<nsTransactionItem> tx = mType == FOR_UNDO ? Pop() : PopBottom();
}
}
void
nsTransactionStack::DoTraverse(nsCycleCollectionTraversalCallback &cb)
{
int32_t size = mDeque.size();
for (int32_t i = 0; i < size; ++i) {
nsTransactionItem* item = mDeque[i];
if (item) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "transaction stack mDeque[i]");
cb.NoteNativeChild(item, NS_CYCLE_COLLECTION_PARTICIPANT(nsTransactionItem));
}
}
}