1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=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_simpledb_ActorsChild_h
8 #define mozilla_dom_simpledb_ActorsChild_h
11 #include "ErrorList.h"
12 #include "mozilla/RefPtr.h"
13 #include "mozilla/dom/PBackgroundSDBConnectionChild.h"
14 #include "mozilla/dom/PBackgroundSDBRequestChild.h"
15 #include "mozilla/ipc/ProtocolUtils.h"
16 #include "nsISupports.h"
17 #include "nsStringFwd.h"
22 class BackgroundChildImpl
;
31 class SDBConnectionChild final
: public PBackgroundSDBConnectionChild
{
32 friend class mozilla::ipc::BackgroundChildImpl
;
33 friend class SDBConnection
;
35 SDBConnection
* mConnection
;
40 void AssertIsOnOwningThread() const {
41 NS_ASSERT_OWNINGTHREAD(SDBConnectionChild
);
45 // Only created by SDBConnection.
46 explicit SDBConnectionChild(SDBConnection
* aConnection
);
48 // Only destroyed by mozilla::ipc::BackgroundChildImpl.
49 ~SDBConnectionChild();
51 void SendDeleteMeInternal();
53 // IPDL methods are only called by IPDL.
54 virtual void ActorDestroy(ActorDestroyReason aWhy
) override
;
56 virtual PBackgroundSDBRequestChild
* AllocPBackgroundSDBRequestChild(
57 const SDBRequestParams
& aParams
) override
;
59 virtual bool DeallocPBackgroundSDBRequestChild(
60 PBackgroundSDBRequestChild
* aActor
) override
;
62 virtual mozilla::ipc::IPCResult
RecvAllowToClose() override
;
64 virtual mozilla::ipc::IPCResult
RecvClosed() override
;
67 class SDBRequestChild final
: public PBackgroundSDBRequestChild
{
68 friend class SDBConnectionChild
;
69 friend class SDBConnection
;
71 RefPtr
<SDBConnection
> mConnection
;
72 RefPtr
<SDBRequest
> mRequest
;
75 void AssertIsOnOwningThread() const
84 // Only created by SDBConnection.
85 explicit SDBRequestChild(SDBRequest
* aRequest
);
87 // Only destroyed by SDBConnectionChild.
90 void HandleResponse(nsresult aResponse
);
92 void HandleResponse();
94 void HandleResponse(const nsCString
& aResponse
);
96 // IPDL methods are only called by IPDL.
97 virtual void ActorDestroy(ActorDestroyReason aWhy
) override
;
99 virtual mozilla::ipc::IPCResult
Recv__delete__(
100 const SDBRequestResponse
& aResponse
) override
;
104 } // namespace mozilla
106 #endif // mozilla_dom_simpledb_ActorsChild_h