ipc/glue/nsIIPCBackgroundChildCreateCallback.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial