tor-browser

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

SharedWorkerChild.h (1570B)


      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
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_dom_SharedWorkerChild_h
      8 #define mozilla_dom_dom_SharedWorkerChild_h
      9 
     10 #include "mozilla/dom/PSharedWorkerChild.h"
     11 #include "nsISupportsImpl.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 class SharedWorker;
     16 
     17 /**
     18 * Held by SharedWorker bindings to remotely control sharedworker lifecycle and
     19 * receive error and termination reports.
     20 */
     21 class SharedWorkerChild final : public mozilla::dom::PSharedWorkerChild {
     22  friend class PSharedWorkerChild;
     23 
     24 public:
     25  NS_INLINE_DECL_REFCOUNTING(SharedWorkerChild)
     26 
     27  SharedWorkerChild();
     28 
     29  void SetParent(SharedWorker* aSharedWorker) { mParent = aSharedWorker; }
     30 
     31  void SendClose();
     32 
     33  void SendSuspend();
     34 
     35  void SendResume();
     36 
     37  void SendFreeze();
     38 
     39  void SendThaw();
     40 
     41 private:
     42  ~SharedWorkerChild();
     43 
     44  mozilla::ipc::IPCResult RecvError(const ErrorValue& aValue);
     45 
     46  mozilla::ipc::IPCResult RecvNotifyLock(bool aCreated);
     47 
     48  mozilla::ipc::IPCResult RecvNotifyWebTransport(bool aCreated);
     49 
     50  mozilla::ipc::IPCResult RecvTerminate();
     51 
     52  void ActorDestroy(ActorDestroyReason aWhy) override;
     53 
     54  // Raw pointer because mParent is set to null when released.
     55  SharedWorker* MOZ_NON_OWNING_REF mParent;
     56  bool mActive;
     57 };
     58 
     59 }  // namespace mozilla::dom
     60 
     61 #endif  // mozilla_dom_dom_SharedWorkerChild_h