Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / base / ProcessMessageManager.cpp
blob393a1954d952330b84b5d7735102b81647a452e7
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 #include "mozilla/dom/ParentProcessMessageManager.h"
8 #include "mozilla/dom/ProcessMessageManager.h"
9 #include "mozilla/dom/MessageManagerBinding.h"
10 #include "nsContentUtils.h"
12 namespace mozilla::dom {
14 ProcessMessageManager::ProcessMessageManager(
15 ipc::MessageManagerCallback* aCallback,
16 ParentProcessMessageManager* aParentManager, MessageManagerFlags aFlags)
17 : MessageSender(aCallback, aParentManager,
18 aFlags | MessageManagerFlags::MM_CHROME |
19 MessageManagerFlags::MM_PROCESSMANAGER),
20 mPid(-1),
21 // aCallback is only specified if this is the in-process manager.
22 mInProcess(!!aCallback) {
23 MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
24 MessageManagerFlags::MM_OWNSCALLBACK)));
26 // This is a bit hackish. We attach to the parent manager, but only if we have
27 // a callback (which is only for the in-process message manager). For other
28 // cases we wait until the child process is running (see
29 // MessageSender::InitWithCallback).
30 if (aParentManager && mCallback) {
31 aParentManager->AddChildManager(this);
35 JSObject* ProcessMessageManager::WrapObject(JSContext* aCx,
36 JS::Handle<JSObject*> aGivenProto) {
37 MOZ_ASSERT(nsContentUtils::IsSystemCaller(aCx));
39 return ProcessMessageManager_Binding::Wrap(aCx, this, aGivenProto);
42 } // namespace mozilla::dom