Skip to content

Commit

Permalink
Bug 1283609 - Part 3: Core changes, stop using nested event loop in B…
Browse files Browse the repository at this point in the history
…ackgroundChild::GetOrCreateForCurrentThread(); r=billm

- BackgroundChild::GetOrCreateForCurrentThread(nsIIPCBackgroundChildCreateCallback* aCallback) emulates former asynchronous behavior
  • Loading branch information
janvarga committed Aug 3, 2017
1 parent 21db397 commit 04a5ac2
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 55 deletions.
3 changes: 2 additions & 1 deletion dom/ipc/ContentChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef mozilla_dom_ContentChild_h
#define mozilla_dom_ContentChild_h

#include "mozilla/Atomics.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/ContentBridgeParent.h"
#include "mozilla/dom/nsIContentChild.h"
Expand Down Expand Up @@ -755,7 +756,7 @@ class ContentChild final : public PContentChild

nsClassHashtable<nsUint64HashKey, AnonymousTemporaryFileCallback> mPendingAnonymousTemporaryFiles;

bool mShuttingDown;
mozilla::Atomic<bool> mShuttingDown;

DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
};
Expand Down
12 changes: 4 additions & 8 deletions ipc/glue/BackgroundChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ class PBackgroundChild;
// across threads. Each PBackgroundChild is unique and valid as long as its
// designated thread lives.
//
// Creation of PBackground is asynchronous. GetForCurrentThread() will return
// null until the sequence is complete.
// Creation of PBackground is synchronous. GetOrCreateForCurrentThread will
// create the actor if it doesn't exist yet. Thereafter (assuming success)
// GetForCurrentThread() will return the same actor every time.
// 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).
// emulates former asynchronous behavior and might be removed in future.
//
// CloseForCurrentThread() will close the current PBackground actor. Subsequent
// calls to GetForCurrentThread will return null. CloseForCurrentThread() may
Expand Down
Loading

0 comments on commit 04a5ac2

Please sign in to comment.