Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/base/ProcessMessageManager.cpp
Line
Count
Source (jump to first uncovered line)
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
#include "mozilla/dom/ParentProcessMessageManager.h"
8
#include "mozilla/dom/ProcessMessageManager.h"
9
#include "mozilla/dom/MessageManagerBinding.h"
10
#include "nsContentUtils.h"
11
12
namespace mozilla {
13
namespace dom {
14
15
ProcessMessageManager::ProcessMessageManager(ipc::MessageManagerCallback* aCallback,
16
                                             ParentProcessMessageManager* aParentManager,
17
                                             MessageManagerFlags aFlags)
18
  : MessageSender(aCallback, aParentManager,
19
                  aFlags | MessageManagerFlags::MM_CHROME |
20
                           MessageManagerFlags::MM_PROCESSMANAGER)
21
0
{
22
0
  MOZ_ASSERT(!(aFlags & ~(MessageManagerFlags::MM_GLOBAL |
23
0
                          MessageManagerFlags::MM_OWNSCALLBACK)));
24
0
25
0
  // This is a bit hackish. We attach to the parent manager, but only if we have a
26
0
  // callback (which is only for the in-process message manager). For other cases we wait
27
0
  // until the child process is running (see MessageSender::InitWithCallback).
28
0
  if (aParentManager && mCallback) {
29
0
    aParentManager->AddChildManager(this);
30
0
  }
31
0
}
32
33
JSObject*
34
ProcessMessageManager::WrapObject(JSContext* aCx,
35
                                  JS::Handle<JSObject*> aGivenProto)
36
0
{
37
0
  MOZ_ASSERT(nsContentUtils::IsSystemCaller(aCx));
38
0
39
0
  return ProcessMessageManager_Binding::Wrap(aCx, this, aGivenProto);
40
0
}
41
42
} // namespace dom
43
} // namespace mozilla