mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1842825 - Split new Observer() outside of ipc::UtilityProcessManager r=ipc-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D183260
This commit is contained in:
parent
0b2d2afdea
commit
b65d4356c8
@ -48,6 +48,7 @@ RefPtr<UtilityProcessManager> UtilityProcessManager::GetSingleton() {
|
||||
|
||||
if (!sXPCOMShutdown && sSingleton == nullptr) {
|
||||
sSingleton = new UtilityProcessManager();
|
||||
sSingleton->Init();
|
||||
}
|
||||
return sSingleton;
|
||||
}
|
||||
@ -57,11 +58,14 @@ RefPtr<UtilityProcessManager> UtilityProcessManager::GetIfExists() {
|
||||
return sSingleton;
|
||||
}
|
||||
|
||||
UtilityProcessManager::UtilityProcessManager() : mObserver(new Observer(this)) {
|
||||
UtilityProcessManager::UtilityProcessManager() {
|
||||
LOGD("[%p] UtilityProcessManager::UtilityProcessManager", this);
|
||||
}
|
||||
|
||||
void UtilityProcessManager::Init() {
|
||||
// Start listening for pref changes so we can
|
||||
// forward them to the process once it is running.
|
||||
mObserver = new Observer(this);
|
||||
nsContentUtils::RegisterShutdownObserver(mObserver);
|
||||
Preferences::AddStrongObserver(mObserver, "");
|
||||
}
|
||||
@ -75,9 +79,8 @@ UtilityProcessManager::~UtilityProcessManager() {
|
||||
|
||||
NS_IMPL_ISUPPORTS(UtilityProcessManager::Observer, nsIObserver);
|
||||
|
||||
UtilityProcessManager::Observer::Observer(
|
||||
RefPtr<UtilityProcessManager> aManager)
|
||||
: mManager(std::move(aManager)) {}
|
||||
UtilityProcessManager::Observer::Observer(UtilityProcessManager* aManager)
|
||||
: mManager(aManager) {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UtilityProcessManager::Observer::Observe(nsISupports* aSubject,
|
||||
|
@ -41,9 +41,6 @@ class UtilityProcessManager final : public UtilityProcessHost::Listener {
|
||||
using WindowsUtilsPromise =
|
||||
MozPromise<RefPtr<dom::WindowsUtilsParent>, nsresult, true>;
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
static RefPtr<UtilityProcessManager> GetSingleton();
|
||||
|
||||
static RefPtr<UtilityProcessManager> GetIfExists();
|
||||
@ -165,6 +162,8 @@ class UtilityProcessManager final : public UtilityProcessHost::Listener {
|
||||
|
||||
UtilityProcessManager();
|
||||
|
||||
void Init();
|
||||
|
||||
void DestroyProcess(SandboxingKind aSandbox);
|
||||
|
||||
bool IsShutdown() const;
|
||||
@ -173,7 +172,7 @@ class UtilityProcessManager final : public UtilityProcessHost::Listener {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
explicit Observer(RefPtr<UtilityProcessManager> aManager);
|
||||
explicit Observer(UtilityProcessManager* aManager);
|
||||
|
||||
protected:
|
||||
~Observer() = default;
|
||||
|
Loading…
Reference in New Issue
Block a user