зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642949 - Replace uses of RemoveElementAt by RemoveLastElement/PopLastElement where possible. r=necko-reviewers,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78027
This commit is contained in:
Родитель
e8caef7a14
Коммит
82dc9b2271
|
@ -241,19 +241,23 @@ class MOZ_RAII AutoConstructionStackEntry final {
|
||||||
: mStack(aStack) {
|
: mStack(aStack) {
|
||||||
MOZ_ASSERT(aElement->IsHTMLElement() || aElement->IsXULElement());
|
MOZ_ASSERT(aElement->IsHTMLElement() || aElement->IsXULElement());
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
mIndex = mStack.Length();
|
mIndex = mStack.Length();
|
||||||
|
#endif
|
||||||
mStack.AppendElement(aElement);
|
mStack.AppendElement(aElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
~AutoConstructionStackEntry() {
|
~AutoConstructionStackEntry() {
|
||||||
MOZ_ASSERT(mIndex == mStack.Length() - 1,
|
MOZ_ASSERT(mIndex == mStack.Length() - 1,
|
||||||
"Removed element should be the last element");
|
"Removed element should be the last element");
|
||||||
mStack.RemoveElementAt(mIndex);
|
mStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsTArray<RefPtr<Element>>& mStack;
|
nsTArray<RefPtr<Element>>& mStack;
|
||||||
|
#ifdef DEBUG
|
||||||
uint32_t mIndex;
|
uint32_t mIndex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -1295,7 +1299,7 @@ void CustomElementReactionsStack::PopAndInvokeElementQueue() {
|
||||||
lastIndex == mReactionsStack.Length() - 1,
|
lastIndex == mReactionsStack.Length() - 1,
|
||||||
"reactions created by InvokeReactions() should be consumed and removed");
|
"reactions created by InvokeReactions() should be consumed and removed");
|
||||||
|
|
||||||
mReactionsStack.RemoveElementAt(lastIndex);
|
mReactionsStack.RemoveLastElement();
|
||||||
mIsElementQueuePushedForCurrentRecursionDepth = false;
|
mIsElementQueuePushedForCurrentRecursionDepth = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ void ResponsiveImageSelector::SetDefaultSource(const nsAString& aURLString,
|
||||||
int32_t candidates = mCandidates.Length();
|
int32_t candidates = mCandidates.Length();
|
||||||
if (candidates && (mCandidates[candidates - 1].Type() ==
|
if (candidates && (mCandidates[candidates - 1].Type() ==
|
||||||
ResponsiveImageCandidate::eCandidateType_Default)) {
|
ResponsiveImageCandidate::eCandidateType_Default)) {
|
||||||
mCandidates.RemoveElementAt(candidates - 1);
|
mCandidates.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
mDefaultSourceURL = aURLString;
|
mDefaultSourceURL = aURLString;
|
||||||
|
|
|
@ -911,16 +911,15 @@ void nsDOMMutationObserver::EnterMutationHandling() { ++sMutationLevel; }
|
||||||
void nsDOMMutationObserver::LeaveMutationHandling() {
|
void nsDOMMutationObserver::LeaveMutationHandling() {
|
||||||
if (sCurrentlyHandlingObservers &&
|
if (sCurrentlyHandlingObservers &&
|
||||||
sCurrentlyHandlingObservers->Length() == sMutationLevel) {
|
sCurrentlyHandlingObservers->Length() == sMutationLevel) {
|
||||||
nsTArray<RefPtr<nsDOMMutationObserver>>& obs =
|
nsTArray<RefPtr<nsDOMMutationObserver>> obs =
|
||||||
sCurrentlyHandlingObservers->ElementAt(sMutationLevel - 1);
|
sCurrentlyHandlingObservers->PopLastElement();
|
||||||
for (uint32_t i = 0; i < obs.Length(); ++i) {
|
for (uint32_t i = 0; i < obs.Length(); ++i) {
|
||||||
nsDOMMutationObserver* o = static_cast<nsDOMMutationObserver*>(obs[i]);
|
nsDOMMutationObserver* o = static_cast<nsDOMMutationObserver*>(obs[i]);
|
||||||
if (o->mCurrentMutations.Length() == sMutationLevel) {
|
if (o->mCurrentMutations.Length() == sMutationLevel) {
|
||||||
// It is already in pending mutations.
|
// It is already in pending mutations.
|
||||||
o->mCurrentMutations.RemoveElementAt(sMutationLevel - 1);
|
o->mCurrentMutations.RemoveLastElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sCurrentlyHandlingObservers->RemoveElementAt(sMutationLevel - 1);
|
|
||||||
}
|
}
|
||||||
--sMutationLevel;
|
--sMutationLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,13 +383,7 @@ void nsPlainTextSerializer::PushBool(nsTArray<bool>& aStack, bool aValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsPlainTextSerializer::PopBool(nsTArray<bool>& aStack) {
|
bool nsPlainTextSerializer::PopBool(nsTArray<bool>& aStack) {
|
||||||
bool returnValue = false;
|
return aStack.Length() ? aStack.PopLastElement() : false;
|
||||||
uint32_t size = aStack.Length();
|
|
||||||
if (size > 0) {
|
|
||||||
returnValue = aStack.ElementAt(size - 1);
|
|
||||||
aStack.RemoveElementAt(size - 1);
|
|
||||||
}
|
|
||||||
return returnValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsPlainTextSerializer::IsIgnorableRubyAnnotation(
|
bool nsPlainTextSerializer::IsIgnorableRubyAnnotation(
|
||||||
|
|
|
@ -432,7 +432,7 @@ void nsXMLContentSerializer::PopNameSpaceDeclsFor(nsIContent* aOwner) {
|
||||||
if (mNameSpaceStack[index].mOwner != aOwner) {
|
if (mNameSpaceStack[index].mOwner != aOwner) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mNameSpaceStack.RemoveElementAt(index);
|
mNameSpaceStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,8 +306,7 @@ void AutoChildOpArgs::Add(JSContext* aCx, const InternalRequest& aRequest,
|
||||||
|
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
CleanupChild(pair.request().body(), Delete);
|
CleanupChild(pair.request().body(), Delete);
|
||||||
args.requestResponseList().RemoveElementAt(
|
args.requestResponseList().RemoveLastElement();
|
||||||
args.requestResponseList().Length() - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1935,7 +1935,7 @@ static bool ProcessArguments(JSContext* aCx, const Sequence<JS::Value>& aData,
|
||||||
// If there isn't any output but there's already a style, then
|
// If there isn't any output but there's already a style, then
|
||||||
// discard the previous style and use the next one instead.
|
// discard the previous style and use the next one instead.
|
||||||
if (output.IsEmpty() && !aStyles.IsEmpty()) {
|
if (output.IsEmpty() && !aStyles.IsEmpty()) {
|
||||||
aStyles.TruncateLength(aStyles.Length() - 1);
|
aStyles.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_WARN_IF(!FlushOutput(aCx, aSequence, output))) {
|
if (NS_WARN_IF(!FlushOutput(aCx, aSequence, output))) {
|
||||||
|
@ -2084,9 +2084,7 @@ static bool UnstoreGroupName(nsAString& aName,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t pos = aGroupStack->Length() - 1;
|
aName = aGroupStack->PopLastElement();
|
||||||
aName = (*aGroupStack)[pos];
|
|
||||||
aGroupStack->RemoveElementAt(pos);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,9 +149,8 @@ class EventTargetChainItem {
|
||||||
|
|
||||||
static void DestroyLast(nsTArray<EventTargetChainItem>& aChain,
|
static void DestroyLast(nsTArray<EventTargetChainItem>& aChain,
|
||||||
EventTargetChainItem* aItem) {
|
EventTargetChainItem* aItem) {
|
||||||
uint32_t lastIndex = aChain.Length() - 1;
|
MOZ_ASSERT(&aChain.LastElement() == aItem);
|
||||||
MOZ_ASSERT(&aChain[lastIndex] == aItem);
|
aChain.RemoveLastElement();
|
||||||
aChain.RemoveElementAt(lastIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EventTargetChainItem* GetFirstCanHandleEventTarget(
|
static EventTargetChainItem* GetFirstCanHandleEventTarget(
|
||||||
|
|
|
@ -1389,8 +1389,7 @@ TextControlState::TextControlState(TextControlElement* aOwningElement)
|
||||||
TextControlState* TextControlState::Construct(
|
TextControlState* TextControlState::Construct(
|
||||||
TextControlElement* aOwningElement) {
|
TextControlElement* aOwningElement) {
|
||||||
if (sReleasedInstances && !sReleasedInstances->IsEmpty()) {
|
if (sReleasedInstances && !sReleasedInstances->IsEmpty()) {
|
||||||
TextControlState* state = sReleasedInstances->LastElement();
|
TextControlState* state = sReleasedInstances->PopLastElement();
|
||||||
sReleasedInstances->RemoveLastElement();
|
|
||||||
state->mTextCtrlElement = aOwningElement;
|
state->mTextCtrlElement = aOwningElement;
|
||||||
state->mBoundFrame = nullptr;
|
state->mBoundFrame = nullptr;
|
||||||
state->mSelectionProperties = SelectionProperties();
|
state->mSelectionProperties = SelectionProperties();
|
||||||
|
|
|
@ -551,15 +551,13 @@ HTMLContentSink::~HTMLContentSink() {
|
||||||
mNotificationTimer->Cancel();
|
mNotificationTimer->Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t numContexts = mContextStack.Length();
|
if (mCurrentContext == mHeadContext && !mContextStack.IsEmpty()) {
|
||||||
|
|
||||||
if (mCurrentContext == mHeadContext && numContexts > 0) {
|
|
||||||
// Pop off the second html context if it's not done earlier
|
// Pop off the second html context if it's not done earlier
|
||||||
mContextStack.RemoveElementAt(--numContexts);
|
mContextStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t i;
|
for (int32_t i = 0, numContexts = mContextStack.Length(); i < numContexts;
|
||||||
for (i = 0; i < numContexts; i++) {
|
i++) {
|
||||||
SinkContext* sc = mContextStack.ElementAt(i);
|
SinkContext* sc = mContextStack.ElementAt(i);
|
||||||
if (sc) {
|
if (sc) {
|
||||||
sc->End();
|
sc->End();
|
||||||
|
@ -716,11 +714,8 @@ HTMLContentSink::SetParser(nsParserBase* aParser) {
|
||||||
nsresult HTMLContentSink::CloseHTML() {
|
nsresult HTMLContentSink::CloseHTML() {
|
||||||
if (mHeadContext) {
|
if (mHeadContext) {
|
||||||
if (mCurrentContext == mHeadContext) {
|
if (mCurrentContext == mHeadContext) {
|
||||||
uint32_t numContexts = mContextStack.Length();
|
|
||||||
|
|
||||||
// Pop off the second html context if it's not done earlier
|
// Pop off the second html context if it's not done earlier
|
||||||
mCurrentContext = mContextStack.ElementAt(--numContexts);
|
mCurrentContext = mContextStack.PopLastElement();
|
||||||
mContextStack.RemoveElementAt(numContexts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mHeadContext->End();
|
mHeadContext->End();
|
||||||
|
@ -842,9 +837,7 @@ void HTMLContentSink::CloseHeadContext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mContextStack.IsEmpty()) {
|
if (!mContextStack.IsEmpty()) {
|
||||||
uint32_t n = mContextStack.Length() - 1;
|
mCurrentContext = mContextStack.PopLastElement();
|
||||||
mCurrentContext = mContextStack.ElementAt(n);
|
|
||||||
mContextStack.RemoveElementAt(n);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12496,11 +12496,8 @@ bool ConnectionPool::ScheduleTransaction(TransactionInfo* aTransactionInfo,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const uint32_t lastIndex = mIdleThreads.Length() - 1;
|
dbInfo->mThreadInfo =
|
||||||
|
std::move(mIdleThreads.PopLastElement().mThreadInfo);
|
||||||
dbInfo->mThreadInfo = std::move(mIdleThreads[lastIndex].mThreadInfo);
|
|
||||||
|
|
||||||
mIdleThreads.RemoveElementAt(lastIndex);
|
|
||||||
|
|
||||||
AdjustIdleTimer();
|
AdjustIdleTimer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,16 +161,12 @@ void AudioNode::DisconnectFromGraph() {
|
||||||
|
|
||||||
// Disconnect inputs. We don't need them anymore.
|
// Disconnect inputs. We don't need them anymore.
|
||||||
while (!mInputNodes.IsEmpty()) {
|
while (!mInputNodes.IsEmpty()) {
|
||||||
size_t i = mInputNodes.Length() - 1;
|
InputNode inputNode = mInputNodes.PopLastElement();
|
||||||
RefPtr<AudioNode> input = mInputNodes[i].mInputNode;
|
inputNode.mInputNode->mOutputNodes.RemoveElement(this);
|
||||||
mInputNodes.RemoveElementAt(i);
|
|
||||||
input->mOutputNodes.RemoveElement(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!mOutputNodes.IsEmpty()) {
|
while (!mOutputNodes.IsEmpty()) {
|
||||||
size_t i = mOutputNodes.Length() - 1;
|
RefPtr<AudioNode> output = mOutputNodes.PopLastElement();
|
||||||
RefPtr<AudioNode> output = std::move(mOutputNodes[i]);
|
|
||||||
mOutputNodes.RemoveElementAt(i);
|
|
||||||
size_t inputIndex = FindIndexOfNode(output->mInputNodes, this);
|
size_t inputIndex = FindIndexOfNode(output->mInputNodes, this);
|
||||||
// It doesn't matter which one we remove, since we're going to remove all
|
// It doesn't matter which one we remove, since we're going to remove all
|
||||||
// entries for this node anyway.
|
// entries for this node anyway.
|
||||||
|
@ -180,9 +176,7 @@ void AudioNode::DisconnectFromGraph() {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!mOutputParams.IsEmpty()) {
|
while (!mOutputParams.IsEmpty()) {
|
||||||
size_t i = mOutputParams.Length() - 1;
|
RefPtr<AudioParam> output = mOutputParams.PopLastElement();
|
||||||
RefPtr<AudioParam> output = std::move(mOutputParams[i]);
|
|
||||||
mOutputParams.RemoveElementAt(i);
|
|
||||||
size_t inputIndex = FindIndexOfNode(output->InputNodes(), this);
|
size_t inputIndex = FindIndexOfNode(output->InputNodes(), this);
|
||||||
// It doesn't matter which one we remove, since we're going to remove all
|
// It doesn't matter which one we remove, since we're going to remove all
|
||||||
// entries for this node anyway.
|
// entries for this node anyway.
|
||||||
|
|
|
@ -143,6 +143,10 @@ class AudioNode : public DOMEventTargetHelper, public nsSupportsWeakReference {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InputNode final {
|
struct InputNode final {
|
||||||
|
InputNode() = default;
|
||||||
|
InputNode(const InputNode&) = delete;
|
||||||
|
InputNode(InputNode&&) = default;
|
||||||
|
|
||||||
~InputNode() {
|
~InputNode() {
|
||||||
if (mTrackPort) {
|
if (mTrackPort) {
|
||||||
mTrackPort->Destroy();
|
mTrackPort->Destroy();
|
||||||
|
|
|
@ -55,9 +55,7 @@ void AudioParam::DisconnectFromGraphAndDestroyTrack() {
|
||||||
"mRefCnt.stabilizeForDeletion()");
|
"mRefCnt.stabilizeForDeletion()");
|
||||||
|
|
||||||
while (!mInputNodes.IsEmpty()) {
|
while (!mInputNodes.IsEmpty()) {
|
||||||
uint32_t i = mInputNodes.Length() - 1;
|
RefPtr<AudioNode> input = mInputNodes.PopLastElement().mInputNode;
|
||||||
RefPtr<AudioNode> input = mInputNodes[i].mInputNode;
|
|
||||||
mInputNodes.RemoveElementAt(i);
|
|
||||||
input->RemoveOutputParam(this);
|
input->RemoveOutputParam(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -781,9 +781,7 @@ nsresult nsNPAPIPluginInstance::PushPopupsEnabledState(bool aEnabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsNPAPIPluginInstance::PopPopupsEnabledState() {
|
nsresult nsNPAPIPluginInstance::PopPopupsEnabledState() {
|
||||||
int32_t last = mPopupStates.Length() - 1;
|
if (mPopupStates.IsEmpty()) {
|
||||||
|
|
||||||
if (last < 0) {
|
|
||||||
// Nothing to pop.
|
// Nothing to pop.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -791,11 +789,7 @@ nsresult nsNPAPIPluginInstance::PopPopupsEnabledState() {
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> window = GetDOMWindow();
|
nsCOMPtr<nsPIDOMWindowOuter> window = GetDOMWindow();
|
||||||
if (!window) return NS_ERROR_FAILURE;
|
if (!window) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
PopupBlocker::PopupControlState& oldState = mPopupStates[last];
|
PopupBlocker::PopPopupControlState(mPopupStates.PopLastElement());
|
||||||
|
|
||||||
PopupBlocker::PopPopupControlState(oldState);
|
|
||||||
|
|
||||||
mPopupStates.RemoveElementAt(last);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1818,13 +1818,14 @@ void PluginModuleChild::EnteredCall() { mIncallPumpingStack.AppendElement(); }
|
||||||
|
|
||||||
void PluginModuleChild::ExitedCall() {
|
void PluginModuleChild::ExitedCall() {
|
||||||
NS_ASSERTION(mIncallPumpingStack.Length(), "mismatched entered/exited");
|
NS_ASSERTION(mIncallPumpingStack.Length(), "mismatched entered/exited");
|
||||||
uint32_t len = mIncallPumpingStack.Length();
|
const IncallFrame& f = mIncallPumpingStack.LastElement();
|
||||||
const IncallFrame& f = mIncallPumpingStack[len - 1];
|
|
||||||
if (f._spinning)
|
if (f._spinning)
|
||||||
MessageLoop::current()->SetNestableTasksAllowed(
|
MessageLoop::current()->SetNestableTasksAllowed(
|
||||||
f._savedNestableTasksAllowed);
|
f._savedNestableTasksAllowed);
|
||||||
|
|
||||||
mIncallPumpingStack.TruncateLength(len - 1);
|
// XXX Is RemoveLastElement intentionally called only after calling
|
||||||
|
// SetNestableTasksAllowed? Otherwise, PopLastElement could be used above.
|
||||||
|
mIncallPumpingStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam,
|
LRESULT CALLBACK PluginModuleChild::CallWindowProcHook(int nCode, WPARAM wParam,
|
||||||
|
|
|
@ -1696,9 +1696,7 @@ void nsWebBrowserPersist::FinishSaveDocumentInternal(nsIURI* aFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWalkStack.Length() > 0) {
|
if (mWalkStack.Length() > 0) {
|
||||||
mozilla::UniquePtr<WalkData> toWalk;
|
mozilla::UniquePtr<WalkData> toWalk = mWalkStack.PopLastElement();
|
||||||
mWalkStack.LastElement().swap(toWalk);
|
|
||||||
mWalkStack.TruncateLength(mWalkStack.Length() - 1);
|
|
||||||
// Bounce this off the event loop to avoid stack overflow.
|
// Bounce this off the event loop to avoid stack overflow.
|
||||||
typedef StoreCopyPassByRRef<decltype(toWalk)> WalkStorage;
|
typedef StoreCopyPassByRRef<decltype(toWalk)> WalkStorage;
|
||||||
auto saveMethod = &nsWebBrowserPersist::SaveDocumentDeferred;
|
auto saveMethod = &nsWebBrowserPersist::SaveDocumentDeferred;
|
||||||
|
|
|
@ -49,9 +49,7 @@ struct StorageWithTArray {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t index = aStorage.Length() - 1;
|
aEntry = aStorage.PopLastElement();
|
||||||
aEntry = aStorage.ElementAt(index);
|
|
||||||
aStorage.RemoveElementAt(index);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1358,7 +1358,7 @@ bool RuntimeService::ScheduleWorker(WorkerPrivate& aWorkerPrivate) {
|
||||||
{
|
{
|
||||||
MutexAutoLock lock(mMutex);
|
MutexAutoLock lock(mMutex);
|
||||||
if (!mIdleThreadArray.IsEmpty()) {
|
if (!mIdleThreadArray.IsEmpty()) {
|
||||||
thread = mIdleThreadArray.PopLastElement().mThread;
|
thread = std::move(mIdleThreadArray.PopLastElement().mThread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -798,14 +798,12 @@ nsresult nsXMLContentSink::PushContent(nsIContent* aContent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsXMLContentSink::PopContent() {
|
void nsXMLContentSink::PopContent() {
|
||||||
int32_t count = mContentStack.Length();
|
if (mContentStack.IsEmpty()) {
|
||||||
|
|
||||||
if (count == 0) {
|
|
||||||
NS_WARNING("Popping empty stack");
|
NS_WARNING("Popping empty stack");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mContentStack.RemoveElementAt(count - 1);
|
mContentStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsXMLContentSink::HaveNotifiedForCurrentContent() const {
|
bool nsXMLContentSink::HaveNotifiedForCurrentContent() const {
|
||||||
|
|
|
@ -44,9 +44,7 @@ class txStack : private nsTArray<void*> {
|
||||||
void* object = nullptr;
|
void* object = nullptr;
|
||||||
NS_ASSERTION(!isEmpty(), "popping from empty stack");
|
NS_ASSERTION(!isEmpty(), "popping from empty stack");
|
||||||
if (!isEmpty()) {
|
if (!isEmpty()) {
|
||||||
const uint32_t count = Length() - 1;
|
object = PopLastElement();
|
||||||
object = ElementAt(count);
|
|
||||||
RemoveElementAt(count);
|
|
||||||
}
|
}
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,13 +331,8 @@ nsresult txExecutionState::pushBool(bool aBool) {
|
||||||
|
|
||||||
bool txExecutionState::popBool() {
|
bool txExecutionState::popBool() {
|
||||||
NS_ASSERTION(mBoolStack.Length(), "popping from empty stack");
|
NS_ASSERTION(mBoolStack.Length(), "popping from empty stack");
|
||||||
uint32_t last = mBoolStack.Length() - 1;
|
|
||||||
NS_ENSURE_TRUE(last != (uint32_t)-1, false);
|
|
||||||
|
|
||||||
bool res = mBoolStack.ElementAt(last);
|
return mBoolStack.IsEmpty() ? false : mBoolStack.PopLastElement();
|
||||||
mBoolStack.RemoveElementAt(last);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult txExecutionState::pushResultHandler(txAXMLEventHandler* aHandler) {
|
nsresult txExecutionState::pushResultHandler(txAXMLEventHandler* aHandler) {
|
||||||
|
|
|
@ -589,13 +589,11 @@ nsresult txStylesheetCompilerState::pushPtr(void* aPtr, enumStackType aType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* txStylesheetCompilerState::popPtr(enumStackType aType) {
|
void* txStylesheetCompilerState::popPtr(enumStackType aType) {
|
||||||
uint32_t stacklen = mTypeStack.Length();
|
if (mTypeStack.IsEmpty()) {
|
||||||
if (stacklen == 0) {
|
|
||||||
MOZ_CRASH("Attempt to pop when type stack is empty");
|
MOZ_CRASH("Attempt to pop when type stack is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
enumStackType type = mTypeStack.ElementAt(stacklen - 1);
|
enumStackType type = mTypeStack.PopLastElement();
|
||||||
mTypeStack.RemoveElementAt(stacklen - 1);
|
|
||||||
void* value = mOtherStack.pop();
|
void* value = mOtherStack.pop();
|
||||||
|
|
||||||
#ifdef TX_DEBUG_STACK
|
#ifdef TX_DEBUG_STACK
|
||||||
|
|
|
@ -207,15 +207,9 @@ void TypeInState::ClearProp(nsAtom* aProp, nsAtom* aAttr) {
|
||||||
* Caller assumes ownership of PropItem and must delete it.
|
* Caller assumes ownership of PropItem and must delete it.
|
||||||
*/
|
*/
|
||||||
UniquePtr<PropItem> TypeInState::TakeClearProperty() {
|
UniquePtr<PropItem> TypeInState::TakeClearProperty() {
|
||||||
size_t count = mClearedArray.Length();
|
return mClearedArray.Length()
|
||||||
if (!count) {
|
? UniquePtr<PropItem>{mClearedArray.PopLastElement()}
|
||||||
return nullptr;
|
: nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
--count; // indices are zero based
|
|
||||||
PropItem* propItem = mClearedArray[count];
|
|
||||||
mClearedArray.RemoveElementAt(count);
|
|
||||||
return UniquePtr<PropItem>(propItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,14 +217,8 @@ UniquePtr<PropItem> TypeInState::TakeClearProperty() {
|
||||||
* Caller assumes ownership of PropItem and must delete it.
|
* Caller assumes ownership of PropItem and must delete it.
|
||||||
*/
|
*/
|
||||||
UniquePtr<PropItem> TypeInState::TakeSetProperty() {
|
UniquePtr<PropItem> TypeInState::TakeSetProperty() {
|
||||||
size_t count = mSetArray.Length();
|
return mSetArray.Length() ? UniquePtr<PropItem>{mSetArray.PopLastElement()}
|
||||||
if (!count) {
|
: nullptr;
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
count--; // indices are zero based
|
|
||||||
PropItem* propItem = mSetArray[count];
|
|
||||||
mSetArray.RemoveElementAt(count);
|
|
||||||
return UniquePtr<PropItem>(propItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -84,10 +84,7 @@ UniquePtr<uint8_t[]> BufferRecycleBin::GetBuffer(uint32_t aSize) {
|
||||||
return UniquePtr<uint8_t[]>(new (fallible) uint8_t[aSize]);
|
return UniquePtr<uint8_t[]>(new (fallible) uint8_t[aSize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t last = mRecycledBuffers.Length() - 1;
|
return mRecycledBuffers.PopLastElement();
|
||||||
UniquePtr<uint8_t[]> result = std::move(mRecycledBuffers[last]);
|
|
||||||
mRecycledBuffers.RemoveElementAt(last);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferRecycleBin::ClearRecycledBuffers() {
|
void BufferRecycleBin::ClearRecycledBuffers() {
|
||||||
|
|
|
@ -301,12 +301,9 @@ void SortLayersBy3DZOrder(nsTArray<Layer*>& aLayers) {
|
||||||
// and remove edges from it.
|
// and remove edges from it.
|
||||||
do {
|
do {
|
||||||
if (!noIncoming.IsEmpty()) {
|
if (!noIncoming.IsEmpty()) {
|
||||||
uint32_t last = noIncoming.Length() - 1;
|
Layer* layer = noIncoming.PopLastElement();
|
||||||
|
|
||||||
Layer* layer = noIncoming.ElementAt(last);
|
|
||||||
MOZ_ASSERT(layer); // don't let null layer pointers sneak into sortedList
|
MOZ_ASSERT(layer); // don't let null layer pointers sneak into sortedList
|
||||||
|
|
||||||
noIncoming.RemoveElementAt(last);
|
|
||||||
sortedList.AppendElement(layer);
|
sortedList.AppendElement(layer);
|
||||||
|
|
||||||
nsTArray<DirectedGraph<Layer*>::Edge> outgoing;
|
nsTArray<DirectedGraph<Layer*>::Edge> outgoing;
|
||||||
|
|
|
@ -72,11 +72,9 @@ layers::OffsetRange ShmSegmentsWriter::Write(Range<uint8_t> aBytes) {
|
||||||
if (!AllocChunk()) {
|
if (!AllocChunk()) {
|
||||||
// Allocation failed, so roll back to the state at the start of this
|
// Allocation failed, so roll back to the state at the start of this
|
||||||
// Write() call and abort.
|
// Write() call and abort.
|
||||||
for (size_t i = mSmallAllocs.Length(); currAllocLen < i; i--) {
|
while (mSmallAllocs.Length() > currAllocLen) {
|
||||||
MOZ_ASSERT(i > 0);
|
RefCountedShmem shm = mSmallAllocs.PopLastElement();
|
||||||
RefCountedShmem& shm = mSmallAllocs.ElementAt(i - 1);
|
|
||||||
RefCountedShm::Dealloc(mShmAllocator, shm);
|
RefCountedShm::Dealloc(mShmAllocator, shm);
|
||||||
mSmallAllocs.RemoveElementAt(i - 1);
|
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(mSmallAllocs.Length() == currAllocLen);
|
MOZ_ASSERT(mSmallAllocs.Length() == currAllocLen);
|
||||||
return layers::OffsetRange(0, start, 0);
|
return layers::OffsetRange(0, start, 0);
|
||||||
|
|
|
@ -607,11 +607,10 @@ void PresShell::DirtyRootsList::Remove(nsIFrame* aFrame) {
|
||||||
nsIFrame* PresShell::DirtyRootsList::PopShallowestRoot() {
|
nsIFrame* PresShell::DirtyRootsList::PopShallowestRoot() {
|
||||||
// List is sorted in order of decreasing depth, so there are no deeper
|
// List is sorted in order of decreasing depth, so there are no deeper
|
||||||
// frames than the last one.
|
// frames than the last one.
|
||||||
const FrameAndDepth& lastFAD = mList.LastElement();
|
const FrameAndDepth& lastFAD = mList.PopLastElement();
|
||||||
nsIFrame* frame = lastFAD.mFrame;
|
nsIFrame* frame = lastFAD.mFrame;
|
||||||
// We don't expect frame to change depths.
|
// We don't expect frame to change depths.
|
||||||
MOZ_ASSERT(frame->GetDepthInFrameTree() == lastFAD.mDepth);
|
MOZ_ASSERT(frame->GetDepthInFrameTree() == lastFAD.mDepth);
|
||||||
mList.RemoveLastElement();
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,7 @@ struct MOZ_STACK_CLASS BidiParagraphData {
|
||||||
MOZ_ASSERT(mEmbeddingStack.Length(), "embedding/override underflow");
|
MOZ_ASSERT(mEmbeddingStack.Length(), "embedding/override underflow");
|
||||||
MOZ_ASSERT(aCh == mEmbeddingStack.LastElement());
|
MOZ_ASSERT(aCh == mEmbeddingStack.LastElement());
|
||||||
AppendPopChar(aCh);
|
AppendPopChar(aCh);
|
||||||
mEmbeddingStack.TruncateLength(mEmbeddingStack.Length() - 1);
|
mEmbeddingStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearBidiControls() {
|
void ClearBidiControls() {
|
||||||
|
|
|
@ -27,12 +27,10 @@ template <size_t ArenaSize, typename ObjectId, size_t ObjectIdCount>
|
||||||
nsPresArena<ArenaSize, ObjectId, ObjectIdCount>::~nsPresArena() {
|
nsPresArena<ArenaSize, ObjectId, ObjectIdCount>::~nsPresArena() {
|
||||||
#if defined(MOZ_HAVE_MEM_CHECKS)
|
#if defined(MOZ_HAVE_MEM_CHECKS)
|
||||||
for (FreeList* entry = mFreeLists; entry != ArrayEnd(mFreeLists); ++entry) {
|
for (FreeList* entry = mFreeLists; entry != ArrayEnd(mFreeLists); ++entry) {
|
||||||
nsTArray<void*>::index_type len;
|
for (void* result : entry->mEntries) {
|
||||||
while ((len = entry->mEntries.Length())) {
|
|
||||||
void* result = entry->mEntries.ElementAt(len - 1);
|
|
||||||
entry->mEntries.RemoveElementAt(len - 1);
|
|
||||||
MOZ_MAKE_MEM_UNDEFINED(result, entry->mEntrySize);
|
MOZ_MAKE_MEM_UNDEFINED(result, entry->mEntrySize);
|
||||||
}
|
}
|
||||||
|
entry->mEntries.Clear();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -981,10 +981,7 @@ bool ServoStyleSet::EnsureUniqueInnerOnCSSSheets() {
|
||||||
});
|
});
|
||||||
|
|
||||||
while (!queue.IsEmpty()) {
|
while (!queue.IsEmpty()) {
|
||||||
uint32_t idx = queue.Length() - 1;
|
auto [sheet, owner] = queue.PopLastElement();
|
||||||
auto* sheet = queue[idx].first;
|
|
||||||
SheetOwner owner = queue[idx].second;
|
|
||||||
queue.RemoveElementAt(idx);
|
|
||||||
|
|
||||||
// Only call EnsureUniqueInner for complete sheets. If we do call it on
|
// Only call EnsureUniqueInner for complete sheets. If we do call it on
|
||||||
// incomplete sheets, we'll cause problems when the sheet is actually
|
// incomplete sheets, we'll cause problems when the sheet is actually
|
||||||
|
|
|
@ -1627,7 +1627,7 @@ nsTextFrame* TextFrameIterator::Next() {
|
||||||
mCurrentPosition -= mCurrentFrame->GetPosition();
|
mCurrentPosition -= mCurrentFrame->GetPosition();
|
||||||
if (mCurrentFrame->GetContent()->IsSVGElement(nsGkAtoms::textPath)) {
|
if (mCurrentFrame->GetContent()->IsSVGElement(nsGkAtoms::textPath)) {
|
||||||
// Pop off the <textPath> frame if this is a <textPath>.
|
// Pop off the <textPath> frame if this is a <textPath>.
|
||||||
mTextPathFrames.TruncateLength(mTextPathFrames.Length() - 1);
|
mTextPathFrames.RemoveLastElement();
|
||||||
}
|
}
|
||||||
// Pop off the current baseline.
|
// Pop off the current baseline.
|
||||||
PopBaseline();
|
PopBaseline();
|
||||||
|
@ -1674,7 +1674,7 @@ void TextFrameIterator::PushBaseline(nsIFrame* aNextFrame) {
|
||||||
|
|
||||||
void TextFrameIterator::PopBaseline() {
|
void TextFrameIterator::PopBaseline() {
|
||||||
NS_ASSERTION(!mBaselines.IsEmpty(), "popped too many baselines");
|
NS_ASSERTION(!mBaselines.IsEmpty(), "popped too many baselines");
|
||||||
mBaselines.TruncateLength(mBaselines.Length() - 1);
|
mBaselines.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
|
@ -570,7 +570,7 @@ void nsTableFrame::InsertCol(nsTableColFrame& aColFrame, int32_t aColIndex) {
|
||||||
nsTableColType lastColType = lastCol->GetColType();
|
nsTableColType lastColType = lastCol->GetColType();
|
||||||
if (eColAnonymousCell == lastColType) {
|
if (eColAnonymousCell == lastColType) {
|
||||||
// remove the col from the cache
|
// remove the col from the cache
|
||||||
mColFrames.RemoveElementAt(numCacheCols - 1);
|
mColFrames.RemoveLastElement();
|
||||||
// remove the col from the synthetic col group
|
// remove the col from the synthetic col group
|
||||||
nsTableColGroupFrame* lastColGroup =
|
nsTableColGroupFrame* lastColGroup =
|
||||||
(nsTableColGroupFrame*)mColGroups.LastChild();
|
(nsTableColGroupFrame*)mColGroups.LastChild();
|
||||||
|
|
|
@ -36,8 +36,7 @@ nsresult CacheIndexIterator::GetNextHash(SHA1Sum::Hash* aHash) {
|
||||||
return mStatus;
|
return mStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(aHash, mRecords[mRecords.Length() - 1]->mHash, sizeof(SHA1Sum::Hash));
|
memcpy(aHash, mRecords.PopLastElement()->mHash, sizeof(SHA1Sum::Hash));
|
||||||
mRecords.RemoveLastElement();
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9035,10 +9035,10 @@ void nsHttpChannel::PushRedirectAsyncFunc(nsContinueRedirectionFunc func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsHttpChannel::PopRedirectAsyncFunc(nsContinueRedirectionFunc func) {
|
void nsHttpChannel::PopRedirectAsyncFunc(nsContinueRedirectionFunc func) {
|
||||||
MOZ_ASSERT(func == mRedirectFuncStack[mRedirectFuncStack.Length() - 1],
|
MOZ_ASSERT(func == mRedirectFuncStack.LastElement(),
|
||||||
"Trying to pop wrong method from redirect async stack!");
|
"Trying to pop wrong method from redirect async stack!");
|
||||||
|
|
||||||
mRedirectFuncStack.TruncateLength(mRedirectFuncStack.Length() - 1);
|
mRedirectFuncStack.RemoveLastElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -728,7 +728,7 @@ HttpConnectionBase* nsHttpConnectionMgr::FindCoalescableConnectionByHashKey(
|
||||||
listOfWeakConns->Elements()[j] =
|
listOfWeakConns->Elements()[j] =
|
||||||
listOfWeakConns->Elements()[listLen - 1];
|
listOfWeakConns->Elements()[listLen - 1];
|
||||||
}
|
}
|
||||||
listOfWeakConns->RemoveElementAt(listLen - 1);
|
listOfWeakConns->RemoveLastElement();
|
||||||
MOZ_ASSERT(listOfWeakConns->Length() == listLen - 1);
|
MOZ_ASSERT(listOfWeakConns->Length() == listLen - 1);
|
||||||
listLen--;
|
listLen--;
|
||||||
continue; // without adjusting iterator
|
continue; // without adjusting iterator
|
||||||
|
|
|
@ -96,9 +96,7 @@ nsCommandLine::RemoveArguments(int32_t aStart, int32_t aEnd) {
|
||||||
NS_ENSURE_ARG_MIN(aStart, 0);
|
NS_ENSURE_ARG_MIN(aStart, 0);
|
||||||
NS_ENSURE_ARG_MAX(uint32_t(aEnd) + 1, mArgs.Length());
|
NS_ENSURE_ARG_MAX(uint32_t(aEnd) + 1, mArgs.Length());
|
||||||
|
|
||||||
for (int32_t i = aEnd; i >= aStart; --i) {
|
mArgs.RemoveElementsAt(mArgs.begin() + aStart, mArgs.begin() + aEnd + 1);
|
||||||
mArgs.RemoveElementAt(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -990,12 +990,10 @@ nsresult PendingLookup::LookupNext() {
|
||||||
// If a url is in blocklist we should call PendingLookup::OnComplete directly.
|
// If a url is in blocklist we should call PendingLookup::OnComplete directly.
|
||||||
MOZ_ASSERT(mBlocklistCount == 0);
|
MOZ_ASSERT(mBlocklistCount == 0);
|
||||||
|
|
||||||
int index = mAnylistSpecs.Length() - 1;
|
|
||||||
nsCString spec;
|
nsCString spec;
|
||||||
if (index >= 0) {
|
if (!mAnylistSpecs.IsEmpty()) {
|
||||||
// Check the source URI only.
|
// Check the source URI only.
|
||||||
spec = mAnylistSpecs[index];
|
spec = mAnylistSpecs.PopLastElement();
|
||||||
mAnylistSpecs.RemoveElementAt(index);
|
|
||||||
RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));
|
RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));
|
||||||
|
|
||||||
// We don't need to check whitelist if the file is not a binary file.
|
// We don't need to check whitelist if the file is not a binary file.
|
||||||
|
@ -1004,11 +1002,9 @@ nsresult PendingLookup::LookupNext() {
|
||||||
return lookup->LookupSpec(spec, type);
|
return lookup->LookupSpec(spec, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
index = mBlocklistSpecs.Length() - 1;
|
if (!mBlocklistSpecs.IsEmpty()) {
|
||||||
if (index >= 0) {
|
|
||||||
// Check the referrer and redirect chain.
|
// Check the referrer and redirect chain.
|
||||||
spec = mBlocklistSpecs[index];
|
spec = mBlocklistSpecs.PopLastElement();
|
||||||
mBlocklistSpecs.RemoveElementAt(index);
|
|
||||||
RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));
|
RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));
|
||||||
return lookup->LookupSpec(spec, LookupType::BlocklistOnly);
|
return lookup->LookupSpec(spec, LookupType::BlocklistOnly);
|
||||||
}
|
}
|
||||||
|
@ -1024,11 +1020,9 @@ nsresult PendingLookup::LookupNext() {
|
||||||
MOZ_ASSERT_IF(!mIsBinaryFile, mAllowlistSpecs.Length() == 0);
|
MOZ_ASSERT_IF(!mIsBinaryFile, mAllowlistSpecs.Length() == 0);
|
||||||
|
|
||||||
// Only binary signatures remain.
|
// Only binary signatures remain.
|
||||||
index = mAllowlistSpecs.Length() - 1;
|
if (!mAllowlistSpecs.IsEmpty()) {
|
||||||
if (index >= 0) {
|
spec = mAllowlistSpecs.PopLastElement();
|
||||||
spec = mAllowlistSpecs[index];
|
|
||||||
LOG(("PendingLookup::LookupNext: checking %s on allowlist", spec.get()));
|
LOG(("PendingLookup::LookupNext: checking %s on allowlist", spec.get()));
|
||||||
mAllowlistSpecs.RemoveElementAt(index);
|
|
||||||
RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));
|
RefPtr<PendingDBLookup> lookup(new PendingDBLookup(this));
|
||||||
return lookup->LookupSpec(spec, LookupType::AllowlistOnly);
|
return lookup->LookupSpec(spec, LookupType::AllowlistOnly);
|
||||||
}
|
}
|
||||||
|
|
|
@ -540,7 +540,7 @@ nsresult nsUrlClassifierPrefixSet::WritePrefixes(
|
||||||
totalDeltas += deltaLength;
|
totalDeltas += deltaLength;
|
||||||
indexStarts.AppendElement(totalDeltas);
|
indexStarts.AppendElement(totalDeltas);
|
||||||
}
|
}
|
||||||
indexStarts.RemoveElementAt(indexSize); // we don't use the last element
|
indexStarts.RemoveLastElement(); // we don't use the last element
|
||||||
MOZ_ASSERT(indexStarts.Length() == indexSize);
|
MOZ_ASSERT(indexStarts.Length() == indexSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1421,8 +1421,7 @@ void nsCocoaUtils::ResolveMediaCapturePromises(bool aGranted, PromiseArray& aPro
|
||||||
|
|
||||||
// Remove each promise from the list and resolve it.
|
// Remove each promise from the list and resolve it.
|
||||||
while (aPromiseList->Length() > 0) {
|
while (aPromiseList->Length() > 0) {
|
||||||
RefPtr<Promise> promise = aPromiseList->LastElement();
|
RefPtr<Promise> promise = aPromiseList->PopLastElement();
|
||||||
aPromiseList->RemoveLastElement();
|
|
||||||
|
|
||||||
// Resolve on main thread
|
// Resolve on main thread
|
||||||
nsCOMPtr<nsIRunnable> runnable(NS_NewRunnableFunction(
|
nsCOMPtr<nsIRunnable> runnable(NS_NewRunnableFunction(
|
||||||
|
|
|
@ -969,19 +969,16 @@ void WindowSurfaceWayland::CacheImageSurface(
|
||||||
WindowImageSurface surf = WindowImageSurface(mImageSurface, aRegion);
|
WindowImageSurface surf = WindowImageSurface(mImageSurface, aRegion);
|
||||||
|
|
||||||
if (mDelayedImageCommits.Length()) {
|
if (mDelayedImageCommits.Length()) {
|
||||||
int lastSurf = mDelayedImageCommits.Length() - 1;
|
auto lastSurf = mDelayedImageCommits.PopLastElement();
|
||||||
if (surf.OverlapsSurface(mDelayedImageCommits[lastSurf])) {
|
if (surf.OverlapsSurface(lastSurf)) {
|
||||||
#ifdef MOZ_LOGGING
|
#ifdef MOZ_LOGGING
|
||||||
{
|
{
|
||||||
gfx::IntRect size = mDelayedImageCommits[lastSurf]
|
gfx::IntRect size =
|
||||||
.GetUpdateRegion()
|
lastSurf.GetUpdateRegion()->GetBounds().ToUnknownRect();
|
||||||
->GetBounds()
|
|
||||||
.ToUnknownRect();
|
|
||||||
LOGWAYLAND((" removing [ %d, %d] -> [%d x %d]\n", size.x, size.y,
|
LOGWAYLAND((" removing [ %d, %d] -> [%d x %d]\n", size.x, size.y,
|
||||||
size.width, size.height));
|
size.width, size.height));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mDelayedImageCommits.RemoveElementAt(lastSurf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2046,9 +2046,8 @@ void nsMemoryReporterManager::EndProcessReport(uint32_t aGeneration,
|
||||||
while (s->mNumProcessesRunning < s->mConcurrencyLimit &&
|
while (s->mNumProcessesRunning < s->mConcurrencyLimit &&
|
||||||
!s->mChildrenPending.IsEmpty()) {
|
!s->mChildrenPending.IsEmpty()) {
|
||||||
// Pop last element from s->mChildrenPending
|
// Pop last element from s->mChildrenPending
|
||||||
RefPtr<MemoryReportingProcess> nextChild;
|
const RefPtr<MemoryReportingProcess> nextChild =
|
||||||
nextChild.swap(s->mChildrenPending.LastElement());
|
s->mChildrenPending.PopLastElement();
|
||||||
s->mChildrenPending.TruncateLength(s->mChildrenPending.Length() - 1);
|
|
||||||
// Start report (if the child is still alive).
|
// Start report (if the child is still alive).
|
||||||
if (StartChildReport(nextChild, s)) {
|
if (StartChildReport(nextChild, s)) {
|
||||||
++s->mNumProcessesRunning;
|
++s->mNumProcessesRunning;
|
||||||
|
|
|
@ -189,12 +189,13 @@ class ExpirationTrackerImpl {
|
||||||
MOZ_ASSERT(generation.Length() > index && generation[index] == aObj,
|
MOZ_ASSERT(generation.Length() > index && generation[index] == aObj,
|
||||||
"Object is lying about its index");
|
"Object is lying about its index");
|
||||||
// Move the last object to fill the hole created by removing aObj
|
// Move the last object to fill the hole created by removing aObj
|
||||||
uint32_t last = generation.Length() - 1;
|
T* lastObj = generation.PopLastElement();
|
||||||
T* lastObj = generation[last];
|
// XXX It looks weird that index might point to the element that was just
|
||||||
generation[index] = lastObj;
|
// removed. Is that really correct?
|
||||||
|
if (index < generation.Length()) {
|
||||||
|
generation[index] = lastObj;
|
||||||
|
}
|
||||||
lastObj->GetExpirationState()->mIndexInGeneration = index;
|
lastObj->GetExpirationState()->mIndexInGeneration = index;
|
||||||
generation.RemoveElementAt(last);
|
|
||||||
MOZ_ASSERT(generation.Length() == last);
|
|
||||||
state->mGeneration = nsExpirationState::NOT_TRACKED;
|
state->mGeneration = nsExpirationState::NOT_TRACKED;
|
||||||
// We do not check whether we need to stop the timer here. The timer
|
// We do not check whether we need to stop the timer here. The timer
|
||||||
// will check that itself next time it fires. Checking here would not
|
// will check that itself next time it fires. Checking here would not
|
||||||
|
|
|
@ -93,11 +93,15 @@ class nsTPriorityQueue {
|
||||||
*/
|
*/
|
||||||
T Pop() {
|
T Pop() {
|
||||||
MOZ_ASSERT(!mElements.IsEmpty(), "Empty queue");
|
MOZ_ASSERT(!mElements.IsEmpty(), "Empty queue");
|
||||||
T pop = mElements[0];
|
T pop = std::move(mElements[0]);
|
||||||
|
|
||||||
|
if (mElements.Length() == 1) {
|
||||||
|
mElements.Clear();
|
||||||
|
return pop;
|
||||||
|
}
|
||||||
|
|
||||||
// Move last to front
|
// Move last to front
|
||||||
mElements[0] = mElements[mElements.Length() - 1];
|
mElements[0] = mElements.PopLastElement();
|
||||||
mElements.TruncateLength(mElements.Length() - 1);
|
|
||||||
|
|
||||||
// Sift down
|
// Sift down
|
||||||
size_type i = 0;
|
size_type i = 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче