1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/glue/nsIIPCBackgroundChildCreateCallback.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef mozilla_ipc_nsiipcbackgroundchildcreatecallback_h 1.9 +#define mozilla_ipc_nsiipcbackgroundchildcreatecallback_h 1.10 + 1.11 +#include "mozilla/Attributes.h" 1.12 +#include "nsISupports.h" 1.13 + 1.14 +namespace mozilla { 1.15 +namespace ipc { 1.16 + 1.17 +class PBackgroundChild; 1.18 + 1.19 +} // namespace ipc 1.20 +} // namespace mozilla 1.21 + 1.22 +#define NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID \ 1.23 + {0x4de01707, 0x70e3, 0x4181, {0xbc, 0x9f, 0xa3, 0xec, 0xfe, 0x74, 0x1a, 0xe3}} 1.24 + 1.25 +class NS_NO_VTABLE nsIIPCBackgroundChildCreateCallback : public nsISupports 1.26 +{ 1.27 +public: 1.28 + typedef mozilla::ipc::PBackgroundChild PBackgroundChild; 1.29 + 1.30 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID) 1.31 + 1.32 + // This will be called upon successful creation of a PBackgroundChild actor. 1.33 + // The actor is unique per-thread and must not be shared across threads. It 1.34 + // may be saved and reused on the same thread for as long as the thread lives. 1.35 + // After this callback BackgroundChild::GetForCurrentThread() will return the 1.36 + // same actor. 1.37 + virtual void 1.38 + ActorCreated(PBackgroundChild*) = 0; 1.39 + 1.40 + // This will be called if for some reason the PBackgroundChild actor cannot be 1.41 + // created. This should never be called in child processes as the failure to 1.42 + // create the actor should result in the termination of the child process 1.43 + // first. This may be called for cross-thread actors in the main process. 1.44 + virtual void 1.45 + ActorFailed() = 0; 1.46 +}; 1.47 + 1.48 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCBackgroundChildCreateCallback, 1.49 + NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID) 1.50 + 1.51 +#define NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK \ 1.52 + virtual void \ 1.53 + ActorCreated(mozilla::ipc::PBackgroundChild*) MOZ_OVERRIDE; \ 1.54 + virtual void \ 1.55 + ActorFailed() MOZ_OVERRIDE; 1.56 + 1.57 +#define NS_FORWARD_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ 1.58 + virtual void \ 1.59 + ActorCreated(mozilla::ipc::PBackgroundChild* aActor) MOZ_OVERRIDE \ 1.60 + { _to ActorCreated(aActor); } \ 1.61 + virtual void \ 1.62 + ActorFailed() MOZ_OVERRIDE \ 1.63 + { _to ActorFailed(); } 1.64 + 1.65 +#define NS_FORWARD_SAFE_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \ 1.66 + virtual void \ 1.67 + ActorCreated(mozilla::ipc::PBackgroundChild* aActor) MOZ_OVERRIDE \ 1.68 + { if (_to) { _to->ActorCreated(aActor); } } \ 1.69 + virtual void \ 1.70 + ActorFailed() MOZ_OVERRIDE \ 1.71 + { if (_to) { _to->ActorFailed(); } } 1.72 + 1.73 +#endif // mozilla_ipc_nsiipcbackgroundchildcreatecallback_h