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/. */
7 #ifndef mozilla_dom_ProcessMessageManager_h
8 #define mozilla_dom_ProcessMessageManager_h
10 #include "mozilla/dom/MessageSender.h"
12 namespace mozilla::dom
{
14 class ParentProcessMessageManager
;
17 * ProcessMessageManager is used in a parent process to communicate with a child
18 * process (or with the process itself in a single-process scenario).
20 class ProcessMessageManager final
: public MessageSender
{
22 ProcessMessageManager(
23 ipc::MessageManagerCallback
* aCallback
,
24 ParentProcessMessageManager
* aParentManager
,
25 MessageManagerFlags aFlags
= MessageManagerFlags::MM_NONE
);
27 virtual JSObject
* WrapObject(JSContext
* aCx
,
28 JS::Handle
<JSObject
*> aGivenProto
) override
;
30 // ProcessScriptLoader
31 void LoadProcessScript(const nsAString
& aUrl
, bool aAllowDelayedLoad
,
32 mozilla::ErrorResult
& aError
) {
33 LoadScript(aUrl
, aAllowDelayedLoad
, false, aError
);
35 void RemoveDelayedProcessScript(const nsAString
& aURL
) {
36 RemoveDelayedScript(aURL
);
38 void GetDelayedProcessScripts(JSContext
* aCx
,
39 nsTArray
<nsTArray
<JS::Value
>>& aScripts
,
40 mozilla::ErrorResult
& aError
) {
41 GetDelayedScripts(aCx
, aScripts
, aError
);
44 void SetOsPid(int32_t aPid
) { mPid
= aPid
; }
45 int32_t OsPid() const { return mPid
; }
47 bool IsInProcess() const { return mInProcess
; }
54 } // namespace mozilla::dom
56 #endif // mozilla_dom_ProcessMessageManager_h