Files
palemoon27/editor/txmgr/nsTransactionList.cpp
roytam1 9af8eeaf15 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1125514 - Use jemalloc's metadata statistics to compute bookkeeping. r=glandium (541dbcfc6f)
- Bug 1201462 - Don't count arena allocated metadata once per bin. r=glandium (57e7c31081)
- back some warnings (377df69d65)
- Bug 1219501. In imagelib, initialize the number of cores to at least 1 in case of error. r=seth (3d7d1635f0)
- Bug 1219501. Limit total number of image decoding threads to 32 regardless of number asked for. r=seth (829a7a623d)
- Bug 1213744 (Part 1) - Support zero-size frame rects and detecting the end of the frame in Downscaler. r=tn (05e29075cc)
- Bug 1213744 (Part 2) - Clamp the GIF frame rect to the visible rect for DDD and don't decode outside it. r=tn (8a25e10a3e)
- Bug 1194837. Don't use the inverse orientation matrix when computing the image space invalidate rect. r=seth (cb5e4c2643)
- Bug 1214054 - Don't fire DECODE_COMPLETE in VectorImage::OnSVGDocumetError(). r=dholbert (bb7c34e46f)
- Bug 1195878 - If we detect animation during a full decode, drop the results of the full decode on the floor. r=tn (a765af2b68)
- Bug 1210553 - Remove the alternate flags arguments from SurfaceCache's Lookup functions. r=dholbert (15c6124f98)
- Bug 1217320 - Remove more XPIDL signature comments in .cpp files. r=froydnj (411ac93047)
- Bug 1186796 - Replace nsBaseHashtable::EnumerateRead() calls in image/ with iterators r=njn (665773ae6d)
- Bug 1186792 - Replace nsBaseHashtable::EnumerateRead() calls in hal/ with iterators. r=dhylands. (d57c6b11da)
- Bug 1187142 - Replace nsBaseHashtable::Enumerate() calls in hal/ with iterators. r=dhylands. (ec05c5b125)
- Bug 1186793 - Replace nsBaseHashtable::EnumerateRead() calls in gfx/ with iterators r=njn (9b3cdd92ce)
- Bug 1215900 - Fix clang's -Wimplicit-fallthrough warnings in gfx/ipc/ GfxMessageUtils.h. r=mstange (f55605f1fe)
- Bug 618898 - Part 1: Add WGL_NV_DX_interop. r=jgilbert (73390398ed)
- Bug 618898 - Add D3D11SharedSurfaceInterop. r=jgilbert (3dde956b85)
- Bug 1208513 - Resurrect SharedSurface_GLTexture for use on iOS r=jgilbert (b0fdc90414)
- Bug 1150760 - Don't call workaround unless necessary. - r=kamidphish (9bdd135931)
- Bug 1151106 - let debugger stop on each iteration of a "for(;;)" loop; r=jimb (b1b921c3a7)
- Bug 1223652 - Remove redundant else block after return statement in CGBlockScopeList::findEnclosingScope. r=arai (f1368bfc73)
- Bug 1219515 - IonMonkey: Fix ThrowIfNotConstructing was not declared. r=evilpie (1d6cedad10)
- Bug 1224044 - Use stable hashing in SavedFramePtrHasher r=terrence (4389cf1b70)
- Bug 1206596: Change js::SavedStacks to use mozilla::FastBernoulliTrial. r=fitzgen (1c4a8d1929)
- Bug 1206357: Add mfbt/FastBernoulliTrial.h, implementing efficient random sampling. r=waldo (7143e53dba)
- No bug: Fix comment in mfbt/FastBernoulliTrial.h. DONTBUILD r=me (e3343f8d9d)
- Bug 1217919 - Separate dynamic module scopes from those of function calls r=shu (521f6826e5)
- Bug 1202568 - Cherry-pick warning fixes from upstream double-conversion. r=Ms2ger (ef738f753b)
- add back some disabled android stuff (0351b0c518)
- Bug 1135261 - return new window from window.open in desktop runtime; r=marco,smaug,junior,wesj (fa4d8f2468)
- Bug 898075 - Remove the mozbrowserasyncscroll event from Gecko. r=botond,kanru,sicking (b1fdcb7630)
- namespace (91374d2db8)
2022-12-30 09:29:16 +08:00

206 lines
4.8 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 "mozilla/mozalloc.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsID.h"
#include "nsISupportsUtils.h"
#include "nsITransactionManager.h"
#include "nsTransactionItem.h"
#include "nsTransactionList.h"
#include "nsTransactionStack.h"
#include "nscore.h"
NS_IMPL_ISUPPORTS(nsTransactionList, nsITransactionList)
nsTransactionList::nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionStack *aTxnStack)
: mTxnStack(aTxnStack)
, mTxnItem(0)
{
if (aTxnMgr)
mTxnMgr = do_GetWeakReference(aTxnMgr);
}
nsTransactionList::nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionItem *aTxnItem)
: mTxnStack(0)
, mTxnItem(aTxnItem)
{
if (aTxnMgr)
mTxnMgr = do_GetWeakReference(aTxnMgr);
}
nsTransactionList::~nsTransactionList()
{
mTxnStack = 0;
mTxnItem = 0;
}
NS_IMETHODIMP nsTransactionList::GetNumItems(int32_t *aNumItems)
{
NS_ENSURE_TRUE(aNumItems, NS_ERROR_NULL_POINTER);
*aNumItems = 0;
nsCOMPtr<nsITransactionManager> txMgr = do_QueryReferent(mTxnMgr);
NS_ENSURE_TRUE(txMgr, NS_ERROR_FAILURE);
nsresult result = NS_OK;
if (mTxnStack)
*aNumItems = mTxnStack->GetSize();
else if (mTxnItem)
result = mTxnItem->GetNumberOfChildren(aNumItems);
return result;
}
NS_IMETHODIMP nsTransactionList::ItemIsBatch(int32_t aIndex, bool *aIsBatch)
{
NS_ENSURE_TRUE(aIsBatch, NS_ERROR_NULL_POINTER);
*aIsBatch = false;
nsCOMPtr<nsITransactionManager> txMgr = do_QueryReferent(mTxnMgr);
NS_ENSURE_TRUE(txMgr, NS_ERROR_FAILURE);
RefPtr<nsTransactionItem> item;
nsresult result = NS_OK;
if (mTxnStack)
item = mTxnStack->GetItem(aIndex);
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
return item->GetIsBatch(aIsBatch);
}
NS_IMETHODIMP nsTransactionList::GetData(int32_t aIndex,
uint32_t *aLength,
nsISupports ***aData)
{
nsCOMPtr<nsITransactionManager> txMgr = do_QueryReferent(mTxnMgr);
NS_ENSURE_TRUE(txMgr, NS_ERROR_FAILURE);
RefPtr<nsTransactionItem> item;
if (mTxnStack) {
item = mTxnStack->GetItem(aIndex);
} else if (mTxnItem) {
nsresult result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
NS_ENSURE_SUCCESS(result, result);
}
nsCOMArray<nsISupports>& data = item->GetData();
nsISupports** ret = static_cast<nsISupports**>(NS_Alloc(data.Count() *
sizeof(nsISupports*)));
for (int32_t i = 0; i < data.Count(); i++) {
NS_ADDREF(ret[i] = data[i]);
}
*aLength = data.Count();
*aData = ret;
return NS_OK;
}
NS_IMETHODIMP nsTransactionList::GetItem(int32_t aIndex, nsITransaction **aItem)
{
NS_ENSURE_TRUE(aItem, NS_ERROR_NULL_POINTER);
*aItem = 0;
nsCOMPtr<nsITransactionManager> txMgr = do_QueryReferent(mTxnMgr);
NS_ENSURE_TRUE(txMgr, NS_ERROR_FAILURE);
RefPtr<nsTransactionItem> item;
nsresult result = NS_OK;
if (mTxnStack)
item = mTxnStack->GetItem(aIndex);
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
*aItem = item->GetTransaction().take();
return NS_OK;
}
NS_IMETHODIMP nsTransactionList::GetNumChildrenForItem(int32_t aIndex, int32_t *aNumChildren)
{
NS_ENSURE_TRUE(aNumChildren, NS_ERROR_NULL_POINTER);
*aNumChildren = 0;
nsCOMPtr<nsITransactionManager> txMgr = do_QueryReferent(mTxnMgr);
NS_ENSURE_TRUE(txMgr, NS_ERROR_FAILURE);
RefPtr<nsTransactionItem> item;
nsresult result = NS_OK;
if (mTxnStack)
item = mTxnStack->GetItem(aIndex);
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
return item->GetNumberOfChildren(aNumChildren);
}
NS_IMETHODIMP nsTransactionList::GetChildListForItem(int32_t aIndex, nsITransactionList **aTxnList)
{
NS_ENSURE_TRUE(aTxnList, NS_ERROR_NULL_POINTER);
*aTxnList = 0;
nsCOMPtr<nsITransactionManager> txMgr = do_QueryReferent(mTxnMgr);
NS_ENSURE_TRUE(txMgr, NS_ERROR_FAILURE);
RefPtr<nsTransactionItem> item;
nsresult result = NS_OK;
if (mTxnStack)
item = mTxnStack->GetItem(aIndex);
else if (mTxnItem)
result = mTxnItem->GetChild(aIndex, getter_AddRefs(item));
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
*aTxnList = (nsITransactionList *)new nsTransactionList(txMgr, item);
NS_ENSURE_TRUE(*aTxnList, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(*aTxnList);
return NS_OK;
}