ParentProcessMessageManager.h (1692B)
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_ParentProcessMessageManager_h 8 #define mozilla_dom_ParentProcessMessageManager_h 9 10 #include "mozilla/dom/MessageBroadcaster.h" 11 12 namespace mozilla::dom { 13 14 /** 15 * Implementation for the WebIDL ParentProcessMessageManager interface. 16 * ParentProcessMessageManager is used in a parent process to communicate with 17 * all the child processes. 18 */ 19 class ParentProcessMessageManager final : public MessageBroadcaster { 20 public: 21 ParentProcessMessageManager(); 22 23 virtual JSObject* WrapObject(JSContext* aCx, 24 JS::Handle<JSObject*> aGivenProto) override; 25 26 // ProcessScriptLoader 27 void LoadProcessScript(const nsAString& aUrl, bool aAllowDelayedLoad, 28 mozilla::ErrorResult& aError) { 29 LoadScript(aUrl, aAllowDelayedLoad, false, aError); 30 } 31 void RemoveDelayedProcessScript(const nsAString& aURL) { 32 RemoveDelayedScript(aURL); 33 } 34 void GetDelayedProcessScripts(JSContext* aCx, 35 nsTArray<nsTArray<JS::Value>>& aScripts, 36 mozilla::ErrorResult& aError) { 37 GetDelayedScripts(aCx, aScripts, aError); 38 } 39 40 // GlobalProcessScriptLoader 41 using nsFrameMessageManager::GetInitialProcessData; 42 43 private: 44 virtual ~ParentProcessMessageManager(); 45 }; 46 47 } // namespace mozilla::dom 48 49 #endif // mozilla_dom_ParentProcessMessageManager_h