tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ActorsChild.h (2652B)


      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/. */
      6 
      7 #ifndef mozilla_dom_simpledb_ActorsChild_h
      8 #define mozilla_dom_simpledb_ActorsChild_h
      9 
     10 #include "ErrorList.h"
     11 #include "mozilla/RefPtr.h"
     12 #include "mozilla/dom/PBackgroundSDBConnectionChild.h"
     13 #include "mozilla/dom/PBackgroundSDBRequestChild.h"
     14 #include "mozilla/ipc/ProtocolUtils.h"
     15 #include "nsISupports.h"
     16 #include "nsStringFwd.h"
     17 
     18 namespace mozilla {
     19 namespace ipc {
     20 
     21 class BackgroundChildImpl;
     22 
     23 }  // namespace ipc
     24 
     25 namespace dom {
     26 
     27 class SDBConnection;
     28 class SDBRequest;
     29 
     30 class SDBConnectionChild final : public PBackgroundSDBConnectionChild {
     31  friend class mozilla::ipc::BackgroundChildImpl;
     32  friend class SDBConnection;
     33 
     34  SDBConnection* mConnection;
     35 
     36  NS_INLINE_DECL_REFCOUNTING(SDBConnectionChild, override)
     37 
     38 public:
     39  void AssertIsOnOwningThread() const {
     40    NS_ASSERT_OWNINGTHREAD(SDBConnectionChild);
     41  }
     42 
     43 private:
     44  // Only created by SDBConnection.
     45  explicit SDBConnectionChild(SDBConnection* aConnection);
     46 
     47  ~SDBConnectionChild();
     48 
     49  void SendDeleteMeInternal();
     50 
     51  // IPDL methods are only called by IPDL.
     52  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
     53 
     54  virtual PBackgroundSDBRequestChild* AllocPBackgroundSDBRequestChild(
     55      const SDBRequestParams& aParams) override;
     56 
     57  virtual bool DeallocPBackgroundSDBRequestChild(
     58      PBackgroundSDBRequestChild* aActor) override;
     59 
     60  virtual mozilla::ipc::IPCResult RecvAllowToClose() override;
     61 
     62  virtual mozilla::ipc::IPCResult RecvClosed() override;
     63 };
     64 
     65 class SDBRequestChild final : public PBackgroundSDBRequestChild {
     66  friend class SDBConnectionChild;
     67  friend class SDBConnection;
     68 
     69  RefPtr<SDBConnection> mConnection;
     70  RefPtr<SDBRequest> mRequest;
     71 
     72 public:
     73  void AssertIsOnOwningThread() const
     74 #ifdef DEBUG
     75      ;
     76 #else
     77  {
     78  }
     79 #endif
     80 
     81 private:
     82  // Only created by SDBConnection.
     83  explicit SDBRequestChild(SDBRequest* aRequest);
     84 
     85  // Only destroyed by SDBConnectionChild.
     86  ~SDBRequestChild();
     87 
     88  void HandleResponse(nsresult aResponse);
     89 
     90  void HandleResponse();
     91 
     92  void HandleResponse(const nsCString& aResponse);
     93 
     94  // IPDL methods are only called by IPDL.
     95  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
     96 
     97  virtual mozilla::ipc::IPCResult Recv__delete__(
     98      const SDBRequestResponse& aResponse) override;
     99 };
    100 
    101 }  // namespace dom
    102 }  // namespace mozilla
    103 
    104 #endif  // mozilla_dom_simpledb_ActorsChild_h