Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/media/gmp/GMPProcessChild.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "GMPProcessChild.h"
7
8
#include "base/command_line.h"
9
#include "base/string_util.h"
10
#include "mozilla/ipc/IOThreadChild.h"
11
#include "mozilla/BackgroundHangMonitor.h"
12
13
using mozilla::ipc::IOThreadChild;
14
15
namespace mozilla {
16
namespace gmp {
17
18
GMPProcessChild::GMPProcessChild(ProcessId aParentPid)
19
: ProcessChild(aParentPid)
20
0
{
21
0
}
22
23
GMPProcessChild::~GMPProcessChild()
24
0
{
25
0
}
26
27
bool
28
GMPProcessChild::Init(int aArgc, char* aArgv[])
29
0
{
30
0
  nsAutoString pluginFilename;
31
0
32
0
#if defined(OS_POSIX)
33
0
  // NB: need to be very careful in ensuring that the first arg
34
0
  // (after the binary name) here is indeed the plugin module path.
35
0
  // Keep in sync with dom/plugins/PluginModuleParent.
36
0
  std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv();
37
0
  MOZ_ASSERT(values.size() >= 2, "not enough args");
38
0
  pluginFilename = NS_ConvertUTF8toUTF16(nsDependentCString(values[1].c_str()));
39
#elif defined(OS_WIN)
40
  std::vector<std::wstring> values = CommandLine::ForCurrentProcess()->GetLooseValues();
41
  MOZ_ASSERT(values.size() >= 1, "not enough loose args");
42
  pluginFilename = nsDependentString(values[0].c_str());
43
#else
44
#error Not implemented
45
#endif
46
47
0
  BackgroundHangMonitor::Startup();
48
0
49
0
  return mPlugin.Init(pluginFilename,
50
0
                      ParentPid(),
51
0
                      IOThreadChild::message_loop(),
52
0
                      IOThreadChild::channel());
53
0
}
54
55
void
56
GMPProcessChild::CleanUp()
57
0
{
58
0
  BackgroundHangMonitor::Shutdown();
59
0
}
60
61
} // namespace gmp
62
} // namespace mozilla