tor-browser

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

JSProcessActorChild.h (1881B)


      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_JSProcessActorChild_h
      8 #define mozilla_dom_JSProcessActorChild_h
      9 
     10 #include "mozilla/dom/BindingDeclarations.h"
     11 #include "mozilla/dom/JSActor.h"
     12 #include "nsIDOMProcessChild.h"
     13 
     14 namespace mozilla::dom {
     15 
     16 // Placeholder implementation.
     17 class JSProcessActorChild final : public JSActor {
     18 public:
     19  NS_DECL_ISUPPORTS_INHERITED
     20  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JSProcessActorChild, JSActor)
     21 
     22  explicit JSProcessActorChild(nsISupports* aGlobal = nullptr)
     23      : JSActor(aGlobal) {}
     24 
     25  JSObject* WrapObject(JSContext* aCx,
     26                       JS::Handle<JSObject*> aGivenProto) override;
     27 
     28  static already_AddRefed<JSProcessActorChild> Constructor(
     29      GlobalObject& aGlobal) {
     30    return MakeAndAddRef<JSProcessActorChild>(aGlobal.GetAsSupports());
     31  }
     32 
     33  nsIDOMProcessChild* Manager() const { return mManager; }
     34 
     35  void Init(const nsACString& aName, nsIDOMProcessChild* aManager);
     36  void ClearManager() override;
     37 
     38 protected:
     39  // Send the message described by the structured clone data |aData|, and the
     40  // message metadata |aMetadata|. The underlying transport should call the
     41  // |ReceiveMessage| method on the other side asynchronously.
     42  void SendRawMessage(const JSActorMessageMeta& aMetadata, JSIPCValue&& aData,
     43                      UniquePtr<ipc::StructuredCloneData> aStack,
     44                      ErrorResult& aRv) override;
     45 
     46 private:
     47  ~JSProcessActorChild() { MOZ_ASSERT(!mManager); }
     48 
     49  nsCOMPtr<nsIDOMProcessChild> mManager;
     50 };
     51 
     52 }  // namespace mozilla::dom
     53 
     54 #endif  // mozilla_dom_JSProcessActorChild_h