dom/bluetooth/ipc/BluetoothChild.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 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_dom_bluetooth_ipc_bluetoothchild_h__
     8 #define mozilla_dom_bluetooth_ipc_bluetoothchild_h__
    10 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
    12 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
    13 #include "mozilla/dom/bluetooth/PBluetoothChild.h"
    14 #include "mozilla/dom/bluetooth/PBluetoothRequestChild.h"
    16 #include "mozilla/Attributes.h"
    17 #include "nsAutoPtr.h"
    19 namespace mozilla {
    20 namespace dom {
    21 namespace bluetooth {
    23 class BluetoothServiceChildProcess;
    25 } // namespace bluetooth
    26 } // namespace dom
    27 } // namespace mozilla
    29 BEGIN_BLUETOOTH_NAMESPACE
    31 class BluetoothReplyRunnable;
    33 /*******************************************************************************
    34  * BluetoothChild
    35  ******************************************************************************/
    37 class BluetoothChild : public PBluetoothChild
    38 {
    39   friend class mozilla::dom::bluetooth::BluetoothServiceChildProcess;
    41   enum ShutdownState
    42   {
    43     Running = 0,
    44     SentStopNotifying,
    45     ReceivedNotificationsStopped,
    46     Dead
    47   };
    49   ShutdownState mShutdownState;
    51 protected:
    52   BluetoothChild(BluetoothServiceChildProcess* aBluetoothService);
    53   virtual ~BluetoothChild();
    55   void
    56   BeginShutdown();
    58   virtual void
    59   ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
    61   virtual bool
    62   RecvNotify(const BluetoothSignal& aSignal);
    64   virtual bool
    65   RecvEnabled(const bool& aEnabled) MOZ_OVERRIDE;
    67   virtual bool
    68   RecvBeginShutdown() MOZ_OVERRIDE;
    70   virtual bool
    71   RecvNotificationsStopped() MOZ_OVERRIDE;
    73   virtual PBluetoothRequestChild*
    74   AllocPBluetoothRequestChild(const Request& aRequest) MOZ_OVERRIDE;
    76   virtual bool
    77   DeallocPBluetoothRequestChild(PBluetoothRequestChild* aActor) MOZ_OVERRIDE;
    78 };
    80 /*******************************************************************************
    81  * BluetoothRequestChild
    82  ******************************************************************************/
    84 class BluetoothRequestChild : public PBluetoothRequestChild
    85 {
    86   friend class mozilla::dom::bluetooth::BluetoothChild;
    88   nsRefPtr<BluetoothReplyRunnable> mReplyRunnable;
    90 public:
    91   BluetoothRequestChild(BluetoothReplyRunnable* aReplyRunnable);
    93 protected:
    94   virtual ~BluetoothRequestChild();
    96   virtual void
    97   ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
    99   virtual bool
   100   Recv__delete__(const BluetoothReply& aReply) MOZ_OVERRIDE;
   101 };
   103 END_BLUETOOTH_NAMESPACE
   105 #endif // mozilla_dom_bluetooth_ipc_bluetoothchild_h__

mercurial