tor-browser

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

RemoteWorkerServiceParent.h (1717B)


      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_RemoteWorkerServiceParent_h
      8 #define mozilla_dom_RemoteWorkerServiceParent_h
      9 
     10 #include "mozilla/dom/PRemoteWorkerServiceParent.h"
     11 #include "mozilla/dom/RemoteType.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 class ContentParent;
     16 class RemoteWorkerManager;
     17 class ThreadsafeContentParentHandle;
     18 
     19 /**
     20 * PBackground-thread parent actor that registers with the PBackground
     21 * RemoteWorkerManager and used to relay spawn requests.
     22 */
     23 class RemoteWorkerServiceParent final : public PRemoteWorkerServiceParent {
     24 public:
     25  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RemoteWorkerServiceParent, override);
     26 
     27  static RefPtr<RemoteWorkerServiceParent> CreateForProcess(
     28      ContentParent* aProcess, Endpoint<PRemoteWorkerServiceChild>* aChildEp);
     29 
     30  void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override;
     31 
     32  bool IsOtherProcessActor() const { return mProcess != nullptr; }
     33 
     34  ThreadsafeContentParentHandle* GetContentParentHandle() const {
     35    return mProcess;
     36  }
     37 
     38  nsCString GetRemoteType() const;
     39 
     40 private:
     41  explicit RemoteWorkerServiceParent(ThreadsafeContentParentHandle* aProcess);
     42  ~RemoteWorkerServiceParent();
     43 
     44  void InitializeOnThread(Endpoint<PRemoteWorkerServiceParent> aEndpoint);
     45 
     46  const RefPtr<ThreadsafeContentParentHandle> mProcess;
     47  RefPtr<RemoteWorkerManager> mManager;
     48 };
     49 
     50 }  // namespace mozilla::dom
     51 
     52 #endif  // mozilla_dom_RemoteWorkerServiceParent_h