diff --git a/accessible/windows/msaa/MsaaIdGenerator.cpp b/accessible/windows/msaa/MsaaIdGenerator.cpp index f69a43381c13..108c3ba74076 100644 --- a/accessible/windows/msaa/MsaaIdGenerator.cpp +++ b/accessible/windows/msaa/MsaaIdGenerator.cpp @@ -208,8 +208,7 @@ void MsaaIdGenerator::ReleaseContentProcessIDFor( return; } - Maybe mapping = - sContentParentIdMap->GetAndRemove(aIPCContentProcessID); + Maybe mapping = sContentParentIdMap->Extract(aIPCContentProcessID); if (!mapping) { // Since Content IDs are generated lazily, ContentParent might attempt // to release an ID that was never allocated to begin with. diff --git a/docshell/base/ChildProcessChannelListener.cpp b/docshell/base/ChildProcessChannelListener.cpp index 949d18aa1685..e34b9c5cf6f9 100644 --- a/docshell/base/ChildProcessChannelListener.cpp +++ b/docshell/base/ChildProcessChannelListener.cpp @@ -16,7 +16,7 @@ static StaticRefPtr sCPCLSingleton; void ChildProcessChannelListener::RegisterCallback(uint64_t aIdentifier, Callback&& aCallback) { - if (auto args = mChannelArgs.GetAndRemove(aIdentifier)) { + if (auto args = mChannelArgs.Extract(aIdentifier)) { nsresult rv = aCallback(args->mLoadState, std::move(args->mStreamFilterEndpoints), args->mTiming); @@ -30,7 +30,7 @@ void ChildProcessChannelListener::OnChannelReady( nsDocShellLoadState* aLoadState, uint64_t aIdentifier, nsTArray&& aStreamFilterEndpoints, nsDOMNavigationTiming* aTiming, Resolver&& aResolver) { - if (auto callback = mCallbacks.GetAndRemove(aIdentifier)) { + if (auto callback = mCallbacks.Extract(aIdentifier)) { nsresult rv = (*callback)(aLoadState, std::move(aStreamFilterEndpoints), aTiming); aResolver(rv); diff --git a/dom/ipc/ContentProcessManager.cpp b/dom/ipc/ContentProcessManager.cpp index f5297dbb2cfb..7b3fa3e65987 100644 --- a/dom/ipc/ContentProcessManager.cpp +++ b/dom/ipc/ContentProcessManager.cpp @@ -82,7 +82,7 @@ bool ContentProcessManager::RegisterRemoteFrame(BrowserParent* aChildBp) { void ContentProcessManager::UnregisterRemoteFrame(const TabId& aChildTabId) { MOZ_ASSERT(NS_IsMainThread()); - auto childBp = mBrowserParentMap.GetAndRemove(aChildTabId); + auto childBp = mBrowserParentMap.Extract(aChildTabId); MOZ_DIAGNOSTIC_ASSERT(childBp); // Clear the corresponding keepalive which was added in `RegisterRemoteFrame`. diff --git a/dom/ipc/jsactor/JSActor.cpp b/dom/ipc/jsactor/JSActor.cpp index 6af20323c382..4efbc46b42db 100644 --- a/dom/ipc/jsactor/JSActor.cpp +++ b/dom/ipc/jsactor/JSActor.cpp @@ -324,7 +324,7 @@ void JSActor::ReceiveQueryReply(JSContext* aCx, return; } - Maybe query = mPendingQueries.GetAndRemove(aMetadata.queryId()); + Maybe query = mPendingQueries.Extract(aMetadata.queryId()); if (NS_WARN_IF(!query)) { aRv.ThrowUnknownError("Received reply for non-pending query"); return; diff --git a/dom/media/gmp/ChromiumCDMParent.cpp b/dom/media/gmp/ChromiumCDMParent.cpp index 28e3a96578f3..82e89cbe3932 100644 --- a/dom/media/gmp/ChromiumCDMParent.cpp +++ b/dom/media/gmp/ChromiumCDMParent.cpp @@ -395,7 +395,7 @@ ipc::IPCResult ChromiumCDMParent::RecvOnResolveNewSessionPromise( return IPC_OK(); } - Maybe token = mPromiseToCreateSessionToken.GetAndRemove(aPromiseId); + Maybe token = mPromiseToCreateSessionToken.Extract(aPromiseId); if (token.isNothing()) { RejectPromiseWithStateError(aPromiseId, "Lost session token for new session."_ns); diff --git a/gfx/ipc/CrossProcessPaint.cpp b/gfx/ipc/CrossProcessPaint.cpp index 0ba57c1b4b0c..61ca7873d0be 100644 --- a/gfx/ipc/CrossProcessPaint.cpp +++ b/gfx/ipc/CrossProcessPaint.cpp @@ -439,7 +439,7 @@ nsresult CrossProcessPaint::ResolveInternal(dom::TabId aTabId, CPP_LOG("Resolving fragment %" PRIu64 ".\n", (uint64_t)aTabId); - Maybe fragment = mReceivedFragments.GetAndRemove(aTabId); + Maybe fragment = mReceivedFragments.Extract(aTabId); if (!fragment) { return NS_ERROR_LOSS_OF_SIGNIFICANT_DATA; } diff --git a/layout/base/nsGenConList.cpp b/layout/base/nsGenConList.cpp index a9d5d99426e7..dbd39772f65d 100644 --- a/layout/base/nsGenConList.cpp +++ b/layout/base/nsGenConList.cpp @@ -26,7 +26,7 @@ bool nsGenConList::DestroyNodesFor(nsIFrame* aFrame) { // each frame is mapped to only one (nsIContent, pseudoType) pair, // and the nodes in the linked list are put in the tree order based // on that pair and offset inside frame. - nsGenConNode* node = mNodes.GetAndRemove(aFrame).valueOr(nullptr); + nsGenConNode* node = mNodes.Extract(aFrame).valueOr(nullptr); if (!node) { return false; } diff --git a/layout/style/SharedStyleSheetCache.cpp b/layout/style/SharedStyleSheetCache.cpp index 2da7b42e62c1..bdbfd4771b4f 100644 --- a/layout/style/SharedStyleSheetCache.cpp +++ b/layout/style/SharedStyleSheetCache.cpp @@ -313,7 +313,7 @@ void SharedStyleSheetCache::LoadCompletedInternal( if (aData.mIsLoading) { MOZ_ASSERT(aCache); SheetLoadDataHashKey key(aData); - Maybe loadingData = aCache->mLoadingDatas.GetAndRemove(key); + Maybe loadingData = aCache->mLoadingDatas.Extract(key); MOZ_DIAGNOSTIC_ASSERT(loadingData); MOZ_DIAGNOSTIC_ASSERT(loadingData.value() == &aData); Unused << loadingData; diff --git a/netwerk/dns/GetAddrInfo.cpp b/netwerk/dns/GetAddrInfo.cpp index 75f0aaf5c561..59e78d443234 100644 --- a/netwerk/dns/GetAddrInfo.cpp +++ b/netwerk/dns/GetAddrInfo.cpp @@ -446,7 +446,7 @@ NS_IMETHODIMP NativeDNSResolverOverride::ClearHostOverride( const nsACString& aHost) { AutoWriteLock lock(mLock); mCnames.Remove(aHost); - auto overrides = mOverrides.GetAndRemove(aHost); + auto overrides = mOverrides.Extract(aHost); if (!overrides) { return NS_OK; } diff --git a/netwerk/ipc/SocketProcessChild.cpp b/netwerk/ipc/SocketProcessChild.cpp index f977618c88f9..9aa515694bdd 100644 --- a/netwerk/ipc/SocketProcessChild.cpp +++ b/netwerk/ipc/SocketProcessChild.cpp @@ -441,7 +441,7 @@ void SocketProcessChild::RemoveDataBridgeFromMap(uint64_t aChannelId) { Maybe> SocketProcessChild::GetAndRemoveDataBridge(uint64_t aChannelId) { MutexAutoLock lock(mMutex); - return mBackgroundDataBridgeMap.GetAndRemove(aChannelId); + return mBackgroundDataBridgeMap.Extract(aChannelId); } mozilla::ipc::IPCResult SocketProcessChild::RecvClearSessionCache() { diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index a111ac67a31c..7fb074a91c97 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -560,7 +560,7 @@ inline nsScriptObjectTracer* JSHolderMap::Get(void* aHolder) const { return entry->mTracer; } -inline nsScriptObjectTracer* JSHolderMap::GetAndRemove(void* aHolder) { +inline nsScriptObjectTracer* JSHolderMap::Extract(void* aHolder) { MOZ_ASSERT(aHolder); auto ptr = mJSHolderMap.lookup(aHolder); @@ -1431,7 +1431,7 @@ struct ClearJSHolder : public TraceCallbacks { }; void CycleCollectedJSRuntime::RemoveJSHolder(void* aHolder) { - nsScriptObjectTracer* tracer = mJSHolders.GetAndRemove(aHolder); + nsScriptObjectTracer* tracer = mJSHolders.Extract(aHolder); if (tracer) { // Bug 1531951: The analysis can't see through the virtual call but we know // that the ClearJSHolder tracer will never GC. diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index acfb43eaef7e..14da0a0b41a7 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -98,7 +98,7 @@ class JSHolderMap { bool Has(void* aHolder) const; nsScriptObjectTracer* Get(void* aHolder) const; - nsScriptObjectTracer* GetAndRemove(void* aHolder); + nsScriptObjectTracer* Extract(void* aHolder); void Put(void* aHolder, nsScriptObjectTracer* aTracer, JS::Zone* aZone); size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const; diff --git a/xpcom/ds/nsBaseHashtable.h b/xpcom/ds/nsBaseHashtable.h index 7e0b1e861e5a..2fde710c4066 100644 --- a/xpcom/ds/nsBaseHashtable.h +++ b/xpcom/ds/nsBaseHashtable.h @@ -247,7 +247,7 @@ class nsBaseHashtable * into *aData. Return true if found. * * This overload can only be used if DataType is default-constructible. Use - * the single-argument Remove or GetAndRemove with non-default-constructible + * the single-argument Remove or Extract with non-default-constructible * DataType. * * @param aKey the key to remove from the hashtable @@ -293,7 +293,7 @@ class nsBaseHashtable * @return the found value, or Nothing if no entry was found with the * given key. */ - [[nodiscard]] mozilla::Maybe GetAndRemove(KeyType aKey) { + [[nodiscard]] mozilla::Maybe Extract(KeyType aKey) { mozilla::Maybe value; if (EntryType* ent = this->GetEntry(aKey)) { value.emplace(std::move(ent->mData)); diff --git a/xpcom/tests/gtest/TestHashtables.cpp b/xpcom/tests/gtest/TestHashtables.cpp index 858302ebece4..33776f4c99c7 100644 --- a/xpcom/tests/gtest/TestHashtables.cpp +++ b/xpcom/tests/gtest/TestHashtables.cpp @@ -380,7 +380,7 @@ struct DefaultConstructible_DefaultConstructible { static constexpr uint32_t kExpectedAddRefCnt_Put_Rvalue_Fallible = 1; static constexpr uint32_t kExpectedAddRefCnt_Remove_OutputParam = 1; static constexpr uint32_t kExpectedAddRefCnt_Remove = 1; - static constexpr uint32_t kExpectedAddRefCnt_GetAndRemove = 1; + static constexpr uint32_t kExpectedAddRefCnt_Extract = 1; static constexpr uint32_t kExpectedAddRefCnt_RemoveIf = 1; static constexpr uint32_t kExpectedAddRefCnt_Lookup = 1; static constexpr uint32_t kExpectedAddRefCnt_Lookup_Remove = 1; @@ -415,7 +415,7 @@ struct NonDefaultConstructible_NonDefaultConstructible { static constexpr uint32_t kExpectedAddRefCnt_Put_Rvalue = 2; static constexpr uint32_t kExpectedAddRefCnt_Put_Rvalue_Fallible = 2; static constexpr uint32_t kExpectedAddRefCnt_Remove = 2; - static constexpr uint32_t kExpectedAddRefCnt_GetAndRemove = 3; + static constexpr uint32_t kExpectedAddRefCnt_Extract = 3; static constexpr uint32_t kExpectedAddRefCnt_RemoveIf = 2; static constexpr uint32_t kExpectedAddRefCnt_Lookup = 2; static constexpr uint32_t kExpectedAddRefCnt_Lookup_Remove = 2; @@ -447,7 +447,7 @@ struct NonDefaultConstructible_MovingNonDefaultConstructible { static constexpr uint32_t kExpectedAddRefCnt_Put_Rvalue = 1; static constexpr uint32_t kExpectedAddRefCnt_Put_Rvalue_Fallible = 1; static constexpr uint32_t kExpectedAddRefCnt_Remove = 1; - static constexpr uint32_t kExpectedAddRefCnt_GetAndRemove = 2; + static constexpr uint32_t kExpectedAddRefCnt_Extract = 2; static constexpr uint32_t kExpectedAddRefCnt_RemoveIf = 1; static constexpr uint32_t kExpectedAddRefCnt_Lookup = 1; static constexpr uint32_t kExpectedAddRefCnt_Lookup_Remove = 1; @@ -800,11 +800,11 @@ TYPED_TEST_P(BaseHashtableTest, Remove) { EXPECT_TRUE(res); } -TYPED_TEST_P(BaseHashtableTest, GetAndRemove) { +TYPED_TEST_P(BaseHashtableTest, Extract) { auto table = - MakeBaseHashtable(TypeParam::kExpectedAddRefCnt_GetAndRemove); + MakeBaseHashtable(TypeParam::kExpectedAddRefCnt_Extract); - auto maybeData = table.GetAndRemove(1); + auto maybeData = table.Extract(1); EXPECT_TRUE(maybeData); EXPECT_EQ(maybeData->CharRef()->GetChar(), 42u); } @@ -995,9 +995,9 @@ REGISTER_TYPED_TEST_CASE_P( GetOrInsert_Default, GetOrInsert_NonDefault, GetOrInsert_NonDefault_AlreadyPresent, GetOrInsertWith, GetOrInsertWith_AlreadyPresent, Put, Put_Fallible, Put_Rvalue, - Put_Rvalue_Fallible, Remove_OutputParam, Remove, GetAndRemove, RemoveIf, - Lookup, Lookup_Remove, WithEntryHandle_NoOp, - WithEntryHandle_NotFound_OrInsert, WithEntryHandle_NotFound_OrInsertFrom, + Put_Rvalue_Fallible, Remove_OutputParam, Remove, Extract, RemoveIf, Lookup, + Lookup_Remove, WithEntryHandle_NoOp, WithEntryHandle_NotFound_OrInsert, + WithEntryHandle_NotFound_OrInsertFrom, WithEntryHandle_NotFound_OrInsertFrom_Exists, WithEntryHandle_NotFound_OrRemove, WithEntryHandle_NotFound_OrRemove_Exists, Iter, ConstIter, begin_end, cbegin_cend, Clear, ShallowSizeOfExcludingThis,