dom/bluetooth/ipc/BluetoothChild.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bluetooth/ipc/BluetoothChild.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,105 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_bluetooth_ipc_bluetoothchild_h__
    1.11 +#define mozilla_dom_bluetooth_ipc_bluetoothchild_h__
    1.12 +
    1.13 +#include "mozilla/dom/bluetooth/BluetoothCommon.h"
    1.14 +
    1.15 +#include "mozilla/dom/bluetooth/BluetoothTypes.h"
    1.16 +#include "mozilla/dom/bluetooth/PBluetoothChild.h"
    1.17 +#include "mozilla/dom/bluetooth/PBluetoothRequestChild.h"
    1.18 +
    1.19 +#include "mozilla/Attributes.h"
    1.20 +#include "nsAutoPtr.h"
    1.21 +
    1.22 +namespace mozilla {
    1.23 +namespace dom {
    1.24 +namespace bluetooth {
    1.25 +
    1.26 +class BluetoothServiceChildProcess;
    1.27 +
    1.28 +} // namespace bluetooth
    1.29 +} // namespace dom
    1.30 +} // namespace mozilla
    1.31 +
    1.32 +BEGIN_BLUETOOTH_NAMESPACE
    1.33 +
    1.34 +class BluetoothReplyRunnable;
    1.35 +
    1.36 +/*******************************************************************************
    1.37 + * BluetoothChild
    1.38 + ******************************************************************************/
    1.39 +
    1.40 +class BluetoothChild : public PBluetoothChild
    1.41 +{
    1.42 +  friend class mozilla::dom::bluetooth::BluetoothServiceChildProcess;
    1.43 +
    1.44 +  enum ShutdownState
    1.45 +  {
    1.46 +    Running = 0,
    1.47 +    SentStopNotifying,
    1.48 +    ReceivedNotificationsStopped,
    1.49 +    Dead
    1.50 +  };
    1.51 +
    1.52 +  ShutdownState mShutdownState;
    1.53 +
    1.54 +protected:
    1.55 +  BluetoothChild(BluetoothServiceChildProcess* aBluetoothService);
    1.56 +  virtual ~BluetoothChild();
    1.57 +
    1.58 +  void
    1.59 +  BeginShutdown();
    1.60 +
    1.61 +  virtual void
    1.62 +  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
    1.63 +
    1.64 +  virtual bool
    1.65 +  RecvNotify(const BluetoothSignal& aSignal);
    1.66 +
    1.67 +  virtual bool
    1.68 +  RecvEnabled(const bool& aEnabled) MOZ_OVERRIDE;
    1.69 +
    1.70 +  virtual bool
    1.71 +  RecvBeginShutdown() MOZ_OVERRIDE;
    1.72 +
    1.73 +  virtual bool
    1.74 +  RecvNotificationsStopped() MOZ_OVERRIDE;
    1.75 +
    1.76 +  virtual PBluetoothRequestChild*
    1.77 +  AllocPBluetoothRequestChild(const Request& aRequest) MOZ_OVERRIDE;
    1.78 +
    1.79 +  virtual bool
    1.80 +  DeallocPBluetoothRequestChild(PBluetoothRequestChild* aActor) MOZ_OVERRIDE;
    1.81 +};
    1.82 +
    1.83 +/*******************************************************************************
    1.84 + * BluetoothRequestChild
    1.85 + ******************************************************************************/
    1.86 +
    1.87 +class BluetoothRequestChild : public PBluetoothRequestChild
    1.88 +{
    1.89 +  friend class mozilla::dom::bluetooth::BluetoothChild;
    1.90 +
    1.91 +  nsRefPtr<BluetoothReplyRunnable> mReplyRunnable;
    1.92 +
    1.93 +public:
    1.94 +  BluetoothRequestChild(BluetoothReplyRunnable* aReplyRunnable);
    1.95 +
    1.96 +protected:
    1.97 +  virtual ~BluetoothRequestChild();
    1.98 +
    1.99 +  virtual void
   1.100 +  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
   1.101 +
   1.102 +  virtual bool
   1.103 +  Recv__delete__(const BluetoothReply& aReply) MOZ_OVERRIDE;
   1.104 +};
   1.105 +
   1.106 +END_BLUETOOTH_NAMESPACE
   1.107 +
   1.108 +#endif // mozilla_dom_bluetooth_ipc_bluetoothchild_h__

mercurial