зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1783933, part 2 - Use StaticAutoPtr in ContentParent. r=nika
This avoids static ctors and dtors, but my main motivation is to keeps us from asserting when a ContentParent leaks, in order to keep different leaks from getting bucketed together on TreeHerder. StaticAutoPtr has no destructor, so sContentParents will leak instead of running the destructor that will assert if the list is not empty. Differential Revision: https://phabricator.services.mozilla.com/D154142
This commit is contained in:
Родитель
b3cc31f86a
Коммит
5522054cb3
|
@ -593,16 +593,16 @@ ProcessID GetTelemetryProcessID(const nsACString& remoteType) {
|
|||
|
||||
} // anonymous namespace
|
||||
|
||||
UniquePtr<nsTHashMap<nsUint32HashKey, ContentParent*>>
|
||||
StaticAutoPtr<nsTHashMap<nsUint32HashKey, ContentParent*>>
|
||||
ContentParent::sJSPluginContentParents;
|
||||
UniquePtr<LinkedList<ContentParent>> ContentParent::sContentParents;
|
||||
StaticAutoPtr<LinkedList<ContentParent>> ContentParent::sContentParents;
|
||||
StaticRefPtr<ContentParent> ContentParent::sRecycledE10SProcess;
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
UniquePtr<SandboxBrokerPolicyFactory>
|
||||
StaticAutoPtr<SandboxBrokerPolicyFactory>
|
||||
ContentParent::sSandboxBrokerPolicyFactory;
|
||||
#endif
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
UniquePtr<std::vector<std::string>> ContentParent::sMacSandboxParams;
|
||||
StaticAutoPtr<std::vector<std::string>> ContentParent::sMacSandboxParams;
|
||||
#endif
|
||||
|
||||
// Set to true when the first content process gets created.
|
||||
|
@ -675,11 +675,11 @@ void ContentParent::StartUp() {
|
|||
kFissionOmitBlockListValues);
|
||||
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
sSandboxBrokerPolicyFactory = MakeUnique<SandboxBrokerPolicyFactory>();
|
||||
sSandboxBrokerPolicyFactory = new SandboxBrokerPolicyFactory();
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
sMacSandboxParams = MakeUnique<std::vector<std::string>>();
|
||||
sMacSandboxParams = new std::vector<std::string>();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1180,8 +1180,7 @@ already_AddRefed<ContentParent> ContentParent::GetNewOrUsedJSPluginProcess(
|
|||
if (sJSPluginContentParents) {
|
||||
p = sJSPluginContentParents->Get(aPluginID);
|
||||
} else {
|
||||
sJSPluginContentParents =
|
||||
MakeUnique<nsTHashMap<nsUint32HashKey, ContentParent*>>();
|
||||
sJSPluginContentParents = new nsTHashMap<nsUint32HashKey, ContentParent*>();
|
||||
}
|
||||
|
||||
if (p) {
|
||||
|
@ -2837,7 +2836,7 @@ ContentParent::ContentParent(const nsACString& aRemoteType, int32_t aJSPluginID)
|
|||
|
||||
// Insert ourselves into the global linked list of ContentParent objects.
|
||||
if (!sContentParents) {
|
||||
sContentParents = MakeUnique<LinkedList<ContentParent>>();
|
||||
sContentParents = new LinkedList<ContentParent>();
|
||||
}
|
||||
sContentParents->insertBack(this);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/MemoryReportingProcess.h"
|
||||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
|
@ -696,9 +697,9 @@ class ContentParent final : public PContentParent,
|
|||
*/
|
||||
static nsClassHashtable<nsCStringHashKey, nsTArray<ContentParent*>>*
|
||||
sBrowserContentParents;
|
||||
static UniquePtr<nsTHashMap<nsUint32HashKey, ContentParent*>>
|
||||
static mozilla::StaticAutoPtr<nsTHashMap<nsUint32HashKey, ContentParent*>>
|
||||
sJSPluginContentParents;
|
||||
static UniquePtr<LinkedList<ContentParent>> sContentParents;
|
||||
static mozilla::StaticAutoPtr<LinkedList<ContentParent>> sContentParents;
|
||||
|
||||
/**
|
||||
* In order to avoid rapidly creating and destroying content processes when
|
||||
|
@ -715,7 +716,7 @@ class ContentParent final : public PContentParent,
|
|||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
|
||||
// Cached Mac sandbox params used when launching content processes.
|
||||
static UniquePtr<std::vector<std::string>> sMacSandboxParams;
|
||||
static mozilla::StaticAutoPtr<std::vector<std::string>> sMacSandboxParams;
|
||||
#endif
|
||||
|
||||
// Set aLoadUri to true to load aURIToLoad and to false to only create the
|
||||
|
@ -1590,7 +1591,7 @@ class ContentParent final : public PContentParent,
|
|||
|
||||
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
|
||||
mozilla::UniquePtr<SandboxBroker> mSandboxBroker;
|
||||
static mozilla::UniquePtr<SandboxBrokerPolicyFactory>
|
||||
static mozilla::StaticAutoPtr<SandboxBrokerPolicyFactory>
|
||||
sSandboxBrokerPolicyFactory;
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче