dom/bluetooth/ipc/BluetoothChild.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:db3ac6979feb
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/. */
6
7 #ifndef mozilla_dom_bluetooth_ipc_bluetoothchild_h__
8 #define mozilla_dom_bluetooth_ipc_bluetoothchild_h__
9
10 #include "mozilla/dom/bluetooth/BluetoothCommon.h"
11
12 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
13 #include "mozilla/dom/bluetooth/PBluetoothChild.h"
14 #include "mozilla/dom/bluetooth/PBluetoothRequestChild.h"
15
16 #include "mozilla/Attributes.h"
17 #include "nsAutoPtr.h"
18
19 namespace mozilla {
20 namespace dom {
21 namespace bluetooth {
22
23 class BluetoothServiceChildProcess;
24
25 } // namespace bluetooth
26 } // namespace dom
27 } // namespace mozilla
28
29 BEGIN_BLUETOOTH_NAMESPACE
30
31 class BluetoothReplyRunnable;
32
33 /*******************************************************************************
34 * BluetoothChild
35 ******************************************************************************/
36
37 class BluetoothChild : public PBluetoothChild
38 {
39 friend class mozilla::dom::bluetooth::BluetoothServiceChildProcess;
40
41 enum ShutdownState
42 {
43 Running = 0,
44 SentStopNotifying,
45 ReceivedNotificationsStopped,
46 Dead
47 };
48
49 ShutdownState mShutdownState;
50
51 protected:
52 BluetoothChild(BluetoothServiceChildProcess* aBluetoothService);
53 virtual ~BluetoothChild();
54
55 void
56 BeginShutdown();
57
58 virtual void
59 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
60
61 virtual bool
62 RecvNotify(const BluetoothSignal& aSignal);
63
64 virtual bool
65 RecvEnabled(const bool& aEnabled) MOZ_OVERRIDE;
66
67 virtual bool
68 RecvBeginShutdown() MOZ_OVERRIDE;
69
70 virtual bool
71 RecvNotificationsStopped() MOZ_OVERRIDE;
72
73 virtual PBluetoothRequestChild*
74 AllocPBluetoothRequestChild(const Request& aRequest) MOZ_OVERRIDE;
75
76 virtual bool
77 DeallocPBluetoothRequestChild(PBluetoothRequestChild* aActor) MOZ_OVERRIDE;
78 };
79
80 /*******************************************************************************
81 * BluetoothRequestChild
82 ******************************************************************************/
83
84 class BluetoothRequestChild : public PBluetoothRequestChild
85 {
86 friend class mozilla::dom::bluetooth::BluetoothChild;
87
88 nsRefPtr<BluetoothReplyRunnable> mReplyRunnable;
89
90 public:
91 BluetoothRequestChild(BluetoothReplyRunnable* aReplyRunnable);
92
93 protected:
94 virtual ~BluetoothRequestChild();
95
96 virtual void
97 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
98
99 virtual bool
100 Recv__delete__(const BluetoothReply& aReply) MOZ_OVERRIDE;
101 };
102
103 END_BLUETOOTH_NAMESPACE
104
105 #endif // mozilla_dom_bluetooth_ipc_bluetoothchild_h__

mercurial