michael@0: /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_bluetooth_ipc_bluetoothchild_h__ michael@0: #define mozilla_dom_bluetooth_ipc_bluetoothchild_h__ michael@0: michael@0: #include "mozilla/dom/bluetooth/BluetoothCommon.h" michael@0: michael@0: #include "mozilla/dom/bluetooth/BluetoothTypes.h" michael@0: #include "mozilla/dom/bluetooth/PBluetoothChild.h" michael@0: #include "mozilla/dom/bluetooth/PBluetoothRequestChild.h" michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsAutoPtr.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: namespace bluetooth { michael@0: michael@0: class BluetoothServiceChildProcess; michael@0: michael@0: } // namespace bluetooth michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: BEGIN_BLUETOOTH_NAMESPACE michael@0: michael@0: class BluetoothReplyRunnable; michael@0: michael@0: /******************************************************************************* michael@0: * BluetoothChild michael@0: ******************************************************************************/ michael@0: michael@0: class BluetoothChild : public PBluetoothChild michael@0: { michael@0: friend class mozilla::dom::bluetooth::BluetoothServiceChildProcess; michael@0: michael@0: enum ShutdownState michael@0: { michael@0: Running = 0, michael@0: SentStopNotifying, michael@0: ReceivedNotificationsStopped, michael@0: Dead michael@0: }; michael@0: michael@0: ShutdownState mShutdownState; michael@0: michael@0: protected: michael@0: BluetoothChild(BluetoothServiceChildProcess* aBluetoothService); michael@0: virtual ~BluetoothChild(); michael@0: michael@0: void michael@0: BeginShutdown(); michael@0: michael@0: virtual void michael@0: ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvNotify(const BluetoothSignal& aSignal); michael@0: michael@0: virtual bool michael@0: RecvEnabled(const bool& aEnabled) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvBeginShutdown() MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvNotificationsStopped() MOZ_OVERRIDE; michael@0: michael@0: virtual PBluetoothRequestChild* michael@0: AllocPBluetoothRequestChild(const Request& aRequest) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPBluetoothRequestChild(PBluetoothRequestChild* aActor) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: /******************************************************************************* michael@0: * BluetoothRequestChild michael@0: ******************************************************************************/ michael@0: michael@0: class BluetoothRequestChild : public PBluetoothRequestChild michael@0: { michael@0: friend class mozilla::dom::bluetooth::BluetoothChild; michael@0: michael@0: nsRefPtr mReplyRunnable; michael@0: michael@0: public: michael@0: BluetoothRequestChild(BluetoothReplyRunnable* aReplyRunnable); michael@0: michael@0: protected: michael@0: virtual ~BluetoothRequestChild(); michael@0: michael@0: virtual void michael@0: ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: Recv__delete__(const BluetoothReply& aReply) MOZ_OVERRIDE; michael@0: }; michael@0: michael@0: END_BLUETOOTH_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_bluetooth_ipc_bluetoothchild_h__