Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #ifndef mozilla_ipc_nsiipcbackgroundchildcreatecallback_h |
michael@0 | 6 | #define mozilla_ipc_nsiipcbackgroundchildcreatecallback_h |
michael@0 | 7 | |
michael@0 | 8 | #include "mozilla/Attributes.h" |
michael@0 | 9 | #include "nsISupports.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace ipc { |
michael@0 | 13 | |
michael@0 | 14 | class PBackgroundChild; |
michael@0 | 15 | |
michael@0 | 16 | } // namespace ipc |
michael@0 | 17 | } // namespace mozilla |
michael@0 | 18 | |
michael@0 | 19 | #define NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID \ |
michael@0 | 20 | {0x4de01707, 0x70e3, 0x4181, {0xbc, 0x9f, 0xa3, 0xec, 0xfe, 0x74, 0x1a, 0xe3}} |
michael@0 | 21 | |
michael@0 | 22 | class NS_NO_VTABLE nsIIPCBackgroundChildCreateCallback : public nsISupports |
michael@0 | 23 | { |
michael@0 | 24 | public: |
michael@0 | 25 | typedef mozilla::ipc::PBackgroundChild PBackgroundChild; |
michael@0 | 26 | |
michael@0 | 27 | NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID) |
michael@0 | 28 | |
michael@0 | 29 | // This will be called upon successful creation of a PBackgroundChild actor. |
michael@0 | 30 | // The actor is unique per-thread and must not be shared across threads. It |
michael@0 | 31 | // may be saved and reused on the same thread for as long as the thread lives. |
michael@0 | 32 | // After this callback BackgroundChild::GetForCurrentThread() will return the |
michael@0 | 33 | // same actor. |
michael@0 | 34 | virtual void |
michael@0 | 35 | ActorCreated(PBackgroundChild*) = 0; |
michael@0 | 36 | |
michael@0 | 37 | // This will be called if for some reason the PBackgroundChild actor cannot be |
michael@0 | 38 | // created. This should never be called in child processes as the failure to |
michael@0 | 39 | // create the actor should result in the termination of the child process |
michael@0 | 40 | // first. This may be called for cross-thread actors in the main process. |
michael@0 | 41 | virtual void |
michael@0 | 42 | ActorFailed() = 0; |
michael@0 | 43 | }; |
michael@0 | 44 | |
michael@0 | 45 | NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCBackgroundChildCreateCallback, |
michael@0 | 46 | NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID) |
michael@0 | 47 | |
michael@0 | 48 | #define NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK \ |
michael@0 | 49 | virtual void \ |
michael@0 | 50 | ActorCreated(mozilla::ipc::PBackgroundChild*) MOZ_OVERRIDE; \ |
michael@0 | 51 | virtual void \ |
michael@0 | 52 | ActorFailed() MOZ_OVERRIDE; |
michael@0 | 53 | |
michael@0 | 54 | #define NS_FORWARD_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ |
michael@0 | 55 | virtual void \ |
michael@0 | 56 | ActorCreated(mozilla::ipc::PBackgroundChild* aActor) MOZ_OVERRIDE \ |
michael@0 | 57 | { _to ActorCreated(aActor); } \ |
michael@0 | 58 | virtual void \ |
michael@0 | 59 | ActorFailed() MOZ_OVERRIDE \ |
michael@0 | 60 | { _to ActorFailed(); } |
michael@0 | 61 | |
michael@0 | 62 | #define NS_FORWARD_SAFE_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ |
michael@0 | 63 | virtual void \ |
michael@0 | 64 | ActorCreated(mozilla::ipc::PBackgroundChild* aActor) MOZ_OVERRIDE \ |
michael@0 | 65 | { if (_to) { _to->ActorCreated(aActor); } } \ |
michael@0 | 66 | virtual void \ |
michael@0 | 67 | ActorFailed() MOZ_OVERRIDE \ |
michael@0 | 68 | { if (_to) { _to->ActorFailed(); } } |
michael@0 | 69 | |
michael@0 | 70 | #endif // mozilla_ipc_nsiipcbackgroundchildcreatecallback_h |