Skip to content

Commit

Permalink
Bug 1283609 - Part 2: Rename BackgroundChild::SynchronouslyCreateForC…
Browse files Browse the repository at this point in the history
…urrentThread to BackgroundChild::GetOrCreateForCurrentThread; r=billm
  • Loading branch information
janvarga committed Aug 3, 2017
1 parent df32731 commit 21db397
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions dom/media/systemservices/CamerasChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class InitializeIPCThread : public Runnable
if (!existingBackgroundChild) {
LOG(("No existingBackgroundChild"));
existingBackgroundChild =
ipc::BackgroundChild::SynchronouslyCreateForCurrentThread();
ipc::BackgroundChild::GetOrCreateForCurrentThread();
LOG(("BackgroundChild: %p", existingBackgroundChild));
if (!existingBackgroundChild) {
return NS_ERROR_FAILURE;
Expand Down Expand Up @@ -130,7 +130,7 @@ GetCamerasChild() {
// At this point we are in the MediaManager thread, and the thread we are
// dispatching to is the specific Cameras IPC thread that was just made
// above, so now we will fire off a runnable to run
// BackgroundChild::SynchronouslyCreateForCurrentThread there, while we
// BackgroundChild::GetOrCreateForCurrentThread there, while we
// block in this thread.
// We block until the following happens in the Cameras IPC thread:
// 1) Creation of PBackground finishes
Expand Down
4 changes: 2 additions & 2 deletions dom/workers/RuntimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2849,10 +2849,10 @@ WorkerThreadPrimaryRunnable::Run()

profiler_register_thread(threadName.get(), &stackBaseGuess);

// Note: SynchronouslyCreateForCurrentThread() must be called prior to
// Note: GetOrCreateForCurrentThread() must be called prior to
// mWorkerPrivate->SetThread() in order to avoid accidentally consuming
// worker messages here.
if (NS_WARN_IF(!BackgroundChild::SynchronouslyCreateForCurrentThread())) {
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread())) {
// XXX need to fire an error at parent.
// Failed in creating BackgroundChild: probably in shutdown. Continue to run
// without BackgroundChild created.
Expand Down
2 changes: 1 addition & 1 deletion dom/workers/WorkerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ WorkerThread::Observer::OnProcessNextEvent(nsIThreadInternal* /* aThread */,

// If the PBackground child is not created yet, then we must permit
// blocking event processing to support
// BackgroundChild::SynchronouslyCreateForCurrentThread(). If this occurs
// BackgroundChild::GetOrCreateCreateForCurrentThread(). If this occurs
// then we are spinning on the event queue at the start of
// PrimaryWorkerRunnable::Run() and don't want to process the event in
// mWorkerPrivate yet.
Expand Down
16 changes: 9 additions & 7 deletions ipc/glue/BackgroundChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ class PBackgroundChild;
// designated thread lives.
//
// Creation of PBackground is asynchronous. GetForCurrentThread() will return
// null until the sequence is complete. GetOrCreateForCurrentThread() will start
// the creation sequence and will call back via the
// nsIIPCBackgroundChildCreateCallback interface when completed. Thereafter
// (assuming success) GetForCurrentThread() will return the same actor every
// time. SynchronouslyCreateForCurrentThread() will spin the event loop until
// the BackgroundChild until the creation sequence is complete.
// null until the sequence is complete.
// GetOrCreateForCurrentThread(nsIIPCBackgroundChildCreateCallback* aCallback)
// will start the creation sequence and will call back via the passed interface
// when completed. Thereafter (assuming success) GetForCurrentThread() will
// return the same actor every time. GetOrCreateForCurrentThread() is like
// GetOrCreateForCurrentThread(nsIIPCBackgroundChildCreateCallback* aCallback)
// but it will return the actor synchronously (it will spin the event loop
// until the creation sequence is complete).
//
// CloseForCurrentThread() will close the current PBackground actor. Subsequent
// calls to GetForCurrentThread will return null. CloseForCurrentThread() may
Expand Down Expand Up @@ -68,7 +70,7 @@ class BackgroundChild final

// See above.
static PBackgroundChild*
SynchronouslyCreateForCurrentThread();
GetOrCreateForCurrentThread();

// See above.
static void
Expand Down
10 changes: 4 additions & 6 deletions ipc/glue/BackgroundImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class ChildImpl final : public BackgroundChildImpl

// Forwarded from BackgroundChild.
static PBackgroundChild*
SynchronouslyCreateForCurrentThread();
GetOrCreateForCurrentThread();

// Forwarded from BackgroundChild.
static void
Expand Down Expand Up @@ -864,9 +864,9 @@ BackgroundChild::GetOrCreateForCurrentThread(

// static
PBackgroundChild*
BackgroundChild::SynchronouslyCreateForCurrentThread()
BackgroundChild::GetOrCreateForCurrentThread()
{
return ChildImpl::SynchronouslyCreateForCurrentThread();
return ChildImpl::GetOrCreateForCurrentThread();
}

// static
Expand Down Expand Up @@ -1655,10 +1655,8 @@ NS_IMPL_ISUPPORTS(Callback, nsIIPCBackgroundChildCreateCallback)

/* static */
PBackgroundChild*
ChildImpl::SynchronouslyCreateForCurrentThread()
ChildImpl::GetOrCreateForCurrentThread()
{
MOZ_ASSERT(!GetForCurrentThread());

bool done = false;
nsCOMPtr<nsIIPCBackgroundChildCreateCallback> callback = new Callback(&done);

Expand Down

0 comments on commit 21db397

Please sign in to comment.