tor-browser

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

JSProcessActorParent.h (2072B)


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