michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_ipc_nsiipcbackgroundchildcreatecallback_h michael@0: #define mozilla_ipc_nsiipcbackgroundchildcreatecallback_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsISupports.h" michael@0: michael@0: namespace mozilla { michael@0: namespace ipc { michael@0: michael@0: class PBackgroundChild; michael@0: michael@0: } // namespace ipc michael@0: } // namespace mozilla michael@0: michael@0: #define NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID \ michael@0: {0x4de01707, 0x70e3, 0x4181, {0xbc, 0x9f, 0xa3, 0xec, 0xfe, 0x74, 0x1a, 0xe3}} michael@0: michael@0: class NS_NO_VTABLE nsIIPCBackgroundChildCreateCallback : public nsISupports michael@0: { michael@0: public: michael@0: typedef mozilla::ipc::PBackgroundChild PBackgroundChild; michael@0: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID) michael@0: michael@0: // This will be called upon successful creation of a PBackgroundChild actor. michael@0: // The actor is unique per-thread and must not be shared across threads. It michael@0: // may be saved and reused on the same thread for as long as the thread lives. michael@0: // After this callback BackgroundChild::GetForCurrentThread() will return the michael@0: // same actor. michael@0: virtual void michael@0: ActorCreated(PBackgroundChild*) = 0; michael@0: michael@0: // This will be called if for some reason the PBackgroundChild actor cannot be michael@0: // created. This should never be called in child processes as the failure to michael@0: // create the actor should result in the termination of the child process michael@0: // first. This may be called for cross-thread actors in the main process. michael@0: virtual void michael@0: ActorFailed() = 0; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCBackgroundChildCreateCallback, michael@0: NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID) michael@0: michael@0: #define NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK \ michael@0: virtual void \ michael@0: ActorCreated(mozilla::ipc::PBackgroundChild*) MOZ_OVERRIDE; \ michael@0: virtual void \ michael@0: ActorFailed() MOZ_OVERRIDE; michael@0: michael@0: #define NS_FORWARD_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ michael@0: virtual void \ michael@0: ActorCreated(mozilla::ipc::PBackgroundChild* aActor) MOZ_OVERRIDE \ michael@0: { _to ActorCreated(aActor); } \ michael@0: virtual void \ michael@0: ActorFailed() MOZ_OVERRIDE \ michael@0: { _to ActorFailed(); } michael@0: michael@0: #define NS_FORWARD_SAFE_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ michael@0: virtual void \ michael@0: ActorCreated(mozilla::ipc::PBackgroundChild* aActor) MOZ_OVERRIDE \ michael@0: { if (_to) { _to->ActorCreated(aActor); } } \ michael@0: virtual void \ michael@0: ActorFailed() MOZ_OVERRIDE \ michael@0: { if (_to) { _to->ActorFailed(); } } michael@0: michael@0: #endif // mozilla_ipc_nsiipcbackgroundchildcreatecallback_h