author | Justin Lebar <justin.lebar@gmail.com> |
Fri, 22 Feb 2013 23:24:28 -0500 | |
changeset 122716 | 257c5fd48f5ac91587650c02abb5aa8d0bbcd8cf |
parent 122715 | f6f8457d343608bc986adca400b4e70fba97a2e3 |
child 122717 | 93ccd4912321292701928ab69dd3885e1f088927 |
push id | 24356 |
push user | gszorc@mozilla.com |
push date | Sun, 24 Feb 2013 01:00:12 +0000 |
treeherder | mozilla-central@195e706140d1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | cjones |
bugs | 842679 |
milestone | 22.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/ipc/ContentChild.cpp | file | annotate | diff | comparison | revisions | |
dom/ipc/ContentChild.h | file | annotate | diff | comparison | revisions |
--- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -560,41 +560,66 @@ static void FirstIdle(void) sFirstIdleTask = nullptr; ContentChild::GetSingleton()->SendFirstIdle(); } PBrowserChild* ContentChild::AllocPBrowser(const IPCTabContext& aContext, const uint32_t& aChromeFlags) { + // We'll happily accept any kind of IPCTabContext here; we don't need to + // check that it's of a certain type for security purposes, because we + // believe whatever the parent process tells us. + + nsRefPtr<TabChild> child = TabChild::Create(TabContext(aContext), aChromeFlags); + + // The ref here is released in DeallocPBrowser. + return child.forget().get(); +} + +bool +ContentChild::RecvPBrowserConstructor(PBrowserChild* actor, + const IPCTabContext& context, + const uint32_t& chromeFlags) +{ + // This runs after AllocPBrowser() returns and the IPC machinery for this + // PBrowserChild has been set up. + // + // We have to NotifyObservers("tab-child-created") before we + // TemporarilyLockProcessPriority because the NotifyObservers call may cause + // us to initialize the ProcessPriorityManager, and + // TemporarilyLockProcessPriority only works after the + // ProcessPriorityManager has been initialized. + + nsCOMPtr<nsIObserverService> os = services::GetObserverService(); + if (os) { + nsITabChild* tc = + static_cast<nsITabChild*>(static_cast<TabChild*>(actor)); + os->NotifyObservers(tc, "tab-child-created", nullptr); + } + static bool hasRunOnce = false; if (!hasRunOnce) { hasRunOnce = true; MOZ_ASSERT(!sFirstIdleTask); sFirstIdleTask = NewRunnableFunction(FirstIdle); MessageLoop::current()->PostIdleTask(FROM_HERE, sFirstIdleTask); // We are either a brand-new process loading its first PBrowser, or we // are the preallocated process transforming into a particular // app/browser. Either way, our parent has already set our process // priority, and we want to leave it there for a few seconds while we // start up. TemporarilyLockProcessPriority(); } - // We'll happily accept any kind of IPCTabContext here; we don't need to - // check that it's of a certain type for security purposes, because we - // believe whatever the parent process tells us. + return true; +} - nsRefPtr<TabChild> child = TabChild::Create(TabContext(aContext), aChromeFlags); - - // The ref here is released below. - return child.forget().get(); -} bool ContentChild::DeallocPBrowser(PBrowserChild* iframe) { TabChild* child = static_cast<TabChild*>(iframe); NS_RELEASE(child); return true; }
--- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -199,16 +199,21 @@ public: uint64_t GetID() { return mID; } bool IsForApp() { return mIsForApp; } bool IsForBrowser() { return mIsForBrowser; } BlobChild* GetOrCreateActorForBlob(nsIDOMBlob* aBlob); +protected: + virtual bool RecvPBrowserConstructor(PBrowserChild* actor, + const IPCTabContext& context, + const uint32_t& chromeFlags); + private: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; virtual void ProcessingError(Result what) MOZ_OVERRIDE; /** * Exit *now*. Do not shut down XPCOM, do not pass Go, do not run * static destructors, do not collect $200.