author | Jan Varga <jan.varga@gmail.com> |
Tue, 08 Aug 2017 23:02:16 +0200 | |
changeset 373547 | ddbbf8aa33dca6011c81dde0ecf4002bbfb4eb4f |
parent 373546 | 28506433e4f03f5c1d2f42fc59c4f86af6da3181 |
child 373548 | bbc3dc385fac9b8c629400a3fba14ab159cf0c97 |
push id | 32304 |
push user | cbook@mozilla.com |
push date | Wed, 09 Aug 2017 09:37:21 +0000 |
treeherder | mozilla-central@4c5fbf493763 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | billm |
bugs | 1350637 |
milestone | 57.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
|
ipc/glue/BackgroundImpl.cpp | file | annotate | diff | comparison | revisions | |
ipc/glue/BackgroundParent.h | file | annotate | diff | comparison | revisions |
--- a/ipc/glue/BackgroundImpl.cpp +++ b/ipc/glue/BackgroundImpl.cpp @@ -211,16 +211,21 @@ private: GetRawContentParentForComparison(PBackgroundParent* aBackgroundActor); // Forwarded from BackgroundParent. static uint64_t GetChildID(PBackgroundParent* aBackgroundActor); // Forwarded from BackgroundParent. static bool + GetLiveActorArray(PBackgroundParent* aBackgroundActor, + nsTArray<PBackgroundParent*>& aLiveActorArray); + + // Forwarded from BackgroundParent. + static bool Alloc(ContentParent* aContent, Endpoint<PBackgroundParent>&& aEndpoint); static bool CreateBackgroundThread(); static void ShutdownBackgroundThread(); @@ -700,16 +705,25 @@ BackgroundParent::GetRawContentParentFor uint64_t BackgroundParent::GetChildID(PBackgroundParent* aBackgroundActor) { return ParentImpl::GetChildID(aBackgroundActor); } // static bool +BackgroundParent::GetLiveActorArray( + PBackgroundParent* aBackgroundActor, + nsTArray<PBackgroundParent*>& aLiveActorArray) +{ + return ParentImpl::GetLiveActorArray(aBackgroundActor, aLiveActorArray); +} + +// static +bool BackgroundParent::Alloc(ContentParent* aContent, Endpoint<PBackgroundParent>&& aEndpoint) { return ParentImpl::Alloc(aContent, Move(aEndpoint)); } // ----------------------------------------------------------------------------- // BackgroundChild Public Methods @@ -868,16 +882,43 @@ ParentImpl::GetChildID(PBackgroundParent return actor->mContent->ChildID(); } return 0; } // static bool +ParentImpl::GetLiveActorArray(PBackgroundParent* aBackgroundActor, + nsTArray<PBackgroundParent*>& aLiveActorArray) +{ + AssertIsOnBackgroundThread(); + MOZ_ASSERT(aBackgroundActor); + MOZ_ASSERT(aLiveActorArray.IsEmpty()); + + auto actor = static_cast<ParentImpl*>(aBackgroundActor); + if (actor->mActorDestroyed) { + MOZ_ASSERT(false, + "GetLiveActorArray called after ActorDestroy was called!"); + return false; + } + + if (!actor->mLiveActorArray) { + return true; + } + + for (ParentImpl* liveActor : *actor->mLiveActorArray) { + aLiveActorArray.AppendElement(liveActor); + } + + return true; +} + +// static +bool ParentImpl::Alloc(ContentParent* aContent, Endpoint<PBackgroundParent>&& aEndpoint) { AssertIsInMainProcess(); AssertIsOnMainThread(); MOZ_ASSERT(aEndpoint.IsValid()); if (!sBackgroundThread && !CreateBackgroundThread()) {
--- a/ipc/glue/BackgroundParent.h +++ b/ipc/glue/BackgroundParent.h @@ -62,16 +62,20 @@ public: // ContentParent after the ContentParent has died. This function may only be // called on the background thread. static intptr_t GetRawContentParentForComparison(PBackgroundParent* aBackgroundActor); static uint64_t GetChildID(PBackgroundParent* aBackgroundActor); + static bool + GetLiveActorArray(PBackgroundParent* aBackgroundActor, + nsTArray<PBackgroundParent*>& aLiveActorArray); + private: // Only called by ContentParent for cross-process actors. static bool Alloc(ContentParent* aContent, Endpoint<PBackgroundParent>&& aEndpoint); }; // Implemented in BackgroundImpl.cpp.