mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 708901 - Migrate to nsTHashSet in dom/ipc. r=nika
Depends on D108597 Differential Revision: https://phabricator.services.mozilla.com/D108598
This commit is contained in:
parent
af20b2ddf6
commit
45420d4e39
@ -2696,7 +2696,7 @@ void ContentChild::AddIdleObserver(nsIObserver* aObserver,
|
||||
// Make sure aObserver isn't released while we wait for the parent
|
||||
aObserver->AddRef();
|
||||
SendAddIdleObserver(reinterpret_cast<uint64_t>(aObserver), aIdleTimeInS);
|
||||
mIdleObservers.PutEntry(aObserver);
|
||||
mIdleObservers.Insert(aObserver);
|
||||
}
|
||||
|
||||
void ContentChild::RemoveIdleObserver(nsIObserver* aObserver,
|
||||
@ -2704,7 +2704,7 @@ void ContentChild::RemoveIdleObserver(nsIObserver* aObserver,
|
||||
MOZ_ASSERT(aObserver, "null idle observer");
|
||||
SendRemoveIdleObserver(reinterpret_cast<uint64_t>(aObserver), aIdleTimeInS);
|
||||
aObserver->Release();
|
||||
mIdleObservers.RemoveEntry(aObserver);
|
||||
mIdleObservers.Remove(aObserver);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvNotifyIdleObserver(
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
# include "nsIFile.h"
|
||||
@ -845,7 +845,7 @@ class ContentChild final : public PContentChild,
|
||||
nsTArray<mozilla::UniquePtr<AlertObserver>> mAlertObservers;
|
||||
RefPtr<ConsoleListener> mConsoleListener;
|
||||
|
||||
nsTHashtable<nsPtrHashKey<nsIObserver>> mIdleObservers;
|
||||
nsTHashSet<nsIObserver*> mIdleObservers;
|
||||
|
||||
nsTArray<nsCString> mAvailableDictionaries;
|
||||
|
||||
|
@ -1819,10 +1819,9 @@ void ContentParent::ShutDownProcess(ShutDownMethod aMethod) {
|
||||
|
||||
const ManagedContainer<POfflineCacheUpdateParent>& ocuParents =
|
||||
ManagedPOfflineCacheUpdateParent();
|
||||
for (auto iter = ocuParents.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
for (auto* key : ocuParents.Keys()) {
|
||||
RefPtr<mozilla::docshell::OfflineCacheUpdateParent> ocuParent =
|
||||
static_cast<mozilla::docshell::OfflineCacheUpdateParent*>(
|
||||
iter.Get()->GetKey());
|
||||
static_cast<mozilla::docshell::OfflineCacheUpdateParent*>(key);
|
||||
ocuParent->StopSendingMessagesToChild();
|
||||
}
|
||||
|
||||
@ -1885,8 +1884,8 @@ void ContentParent::AssertNotInPool() {
|
||||
!sBrowserContentParents->Get(mRemoteType)->Contains(this) ||
|
||||
!sCanLaunchSubprocesses); // aka in shutdown - avoid timing issues
|
||||
|
||||
for (auto& group : mGroups) {
|
||||
MOZ_RELEASE_ASSERT(group.GetKey()->GetHostProcess(mRemoteType) != this,
|
||||
for (const auto& group : mGroups) {
|
||||
MOZ_RELEASE_ASSERT(group->GetHostProcess(mRemoteType) != this,
|
||||
"still a host process for one of our groups?");
|
||||
}
|
||||
}
|
||||
@ -1922,8 +1921,8 @@ void ContentParent::RemoveFromList() {
|
||||
// Ensure that this BrowsingContextGroup is no longer used to host new
|
||||
// documents from any associated BrowsingContextGroups. It may become a host
|
||||
// again in the future, if it is restored to the pool.
|
||||
for (auto& group : mGroups) {
|
||||
group.GetKey()->RemoveHostProcess(this);
|
||||
for (const auto& group : mGroups) {
|
||||
group->RemoveHostProcess(this);
|
||||
}
|
||||
|
||||
StopRecycling(/* aForeground */ false);
|
||||
@ -2157,10 +2156,9 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) {
|
||||
// unsubscribed.
|
||||
BrowsingContext::DiscardFromContentParent(this);
|
||||
|
||||
nsTHashtable<nsRefPtrHashKey<BrowsingContextGroup>> groups;
|
||||
mGroups.SwapElements(groups);
|
||||
for (auto& group : groups) {
|
||||
group.GetKey()->Unsubscribe(this);
|
||||
const nsTHashSet<RefPtr<BrowsingContextGroup>> groups = std::move(mGroups);
|
||||
for (const auto& group : groups) {
|
||||
group->Unsubscribe(this);
|
||||
}
|
||||
MOZ_DIAGNOSTIC_ASSERT(mGroups.IsEmpty());
|
||||
}
|
||||
@ -3188,8 +3186,8 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
|
||||
|
||||
// Begin subscribing to any BrowsingContextGroups which were hosted by this
|
||||
// process before it finished launching.
|
||||
for (auto& group : mGroups) {
|
||||
group.GetKey()->Subscribe(this);
|
||||
for (const auto& group : mGroups) {
|
||||
group->Subscribe(this);
|
||||
}
|
||||
|
||||
// Start up nsPluginHost and run FindPlugins to cache the plugin list.
|
||||
@ -6154,10 +6152,9 @@ void ContentParent::EnsurePermissionsByKey(const nsCString& aKey,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mActivePermissionKeys.Contains(aKey)) {
|
||||
if (!mActivePermissionKeys.EnsureInserted(aKey)) {
|
||||
return;
|
||||
}
|
||||
mActivePermissionKeys.PutEntry(aKey);
|
||||
|
||||
nsTArray<IPC::Permission> perms;
|
||||
if (permManager->GetPermissionsFromOriginOrKey(aOrigin, aKey, perms)) {
|
||||
@ -7149,7 +7146,7 @@ void ContentParent::RemoveBrowsingContextGroup(BrowsingContextGroup* aGroup) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aGroup);
|
||||
// Remove the group from our list. This is called from the
|
||||
// BrowisngContextGroup when unsubscribing, so we don't need to do it here.
|
||||
mGroups.RemoveEntry(aGroup);
|
||||
mGroups.Remove(aGroup);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvCommitBrowsingContextTransaction(
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "nsClassHashtable.h"
|
||||
#include "nsTHashMap.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "nsPluginTags.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsIAsyncShutdown.h"
|
||||
@ -1593,7 +1594,7 @@ class ContentParent final
|
||||
// GetFilesHelper can be aborted by receiving RecvDeleteGetFilesRequest.
|
||||
nsRefPtrHashtable<nsIDHashKey, GetFilesHelper> mGetFilesPendingRequests;
|
||||
|
||||
nsTHashtable<nsCStringHashKey> mActivePermissionKeys;
|
||||
nsTHashSet<nsCString> mActivePermissionKeys;
|
||||
|
||||
nsTArray<nsCString> mBlobURLs;
|
||||
|
||||
@ -1622,7 +1623,7 @@ class ContentParent final
|
||||
static bool sEarlySandboxInit;
|
||||
#endif
|
||||
|
||||
nsTHashtable<nsRefPtrHashKey<BrowsingContextGroup>> mGroups;
|
||||
nsTHashSet<RefPtr<BrowsingContextGroup>> mGroups;
|
||||
|
||||
// See `BrowsingContext::mEpochs` for an explanation of this field.
|
||||
uint64_t mBrowsingContextFieldEpoch = 0;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "nsIPropertyBag2.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsTHashSet.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsTHashMap.h"
|
||||
|
||||
@ -170,7 +170,7 @@ class ProcessPriorityManagerImpl final : public nsIObserver,
|
||||
mParticularManagers;
|
||||
|
||||
/** Contains the PIDs of child processes holding high-priority wakelocks */
|
||||
nsTHashtable<nsUint64HashKey> mHighPriorityChildIDs;
|
||||
nsTHashSet<uint64_t> mHighPriorityChildIDs;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -287,7 +287,7 @@ class ParticularProcessPriorityManager final : public WakeLockObserver,
|
||||
nsCOMPtr<nsITimer> mResetPriorityTimer;
|
||||
|
||||
// This hashtable contains the list of active TabId for this process.
|
||||
nsTHashtable<nsUint64HashKey> mActiveBrowserParents;
|
||||
nsTHashSet<uint64_t> mActiveBrowserParents;
|
||||
};
|
||||
|
||||
/* static */
|
||||
@ -447,7 +447,7 @@ void ProcessPriorityManagerImpl::ObserveContentParentDestroyed(
|
||||
|
||||
if (auto entry = mParticularManagers.Lookup(childID)) {
|
||||
entry.Data()->ShutDown();
|
||||
mHighPriorityChildIDs.RemoveEntry(childID);
|
||||
mHighPriorityChildIDs.Remove(childID);
|
||||
entry.Remove();
|
||||
}
|
||||
}
|
||||
@ -459,10 +459,10 @@ void ProcessPriorityManagerImpl::NotifyProcessPriorityChanged(
|
||||
|
||||
if (newPriority >= PROCESS_PRIORITY_FOREGROUND_HIGH &&
|
||||
aOldPriority < PROCESS_PRIORITY_FOREGROUND_HIGH) {
|
||||
mHighPriorityChildIDs.PutEntry(aParticularManager->ChildID());
|
||||
mHighPriorityChildIDs.Insert(aParticularManager->ChildID());
|
||||
} else if (newPriority < PROCESS_PRIORITY_FOREGROUND_HIGH &&
|
||||
aOldPriority >= PROCESS_PRIORITY_FOREGROUND_HIGH) {
|
||||
mHighPriorityChildIDs.RemoveEntry(aParticularManager->ChildID());
|
||||
mHighPriorityChildIDs.Remove(aParticularManager->ChildID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,7 +661,7 @@ void ParticularProcessPriorityManager::OnBrowserParentDestroyed(
|
||||
return;
|
||||
}
|
||||
|
||||
mActiveBrowserParents.RemoveEntry(browserHost->GetTabId());
|
||||
mActiveBrowserParents.Remove(browserHost->GetTabId());
|
||||
|
||||
ResetPriority();
|
||||
}
|
||||
@ -796,9 +796,9 @@ void ParticularProcessPriorityManager::TabActivityChanged(
|
||||
MOZ_ASSERT(aBrowserParent);
|
||||
|
||||
if (!aIsActive) {
|
||||
mActiveBrowserParents.RemoveEntry(aBrowserParent->GetTabId());
|
||||
mActiveBrowserParents.Remove(aBrowserParent->GetTabId());
|
||||
} else {
|
||||
mActiveBrowserParents.PutEntry(aBrowserParent->GetTabId());
|
||||
mActiveBrowserParents.Insert(aBrowserParent->GetTabId());
|
||||
}
|
||||
|
||||
ResetPriority();
|
||||
|
Loading…
x
Reference in New Issue
Block a user