Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / gfx / ipc / GPUProcessImpl.cpp
blob7147689f7669c7f4e501aedb53d1725e489dee76
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 #include "GPUProcessImpl.h"
7 #include "mozilla/ipc/IOThreadChild.h"
8 #include "nsXPCOM.h"
9 #include "mozilla/ipc/ProcessUtils.h"
10 #include "mozilla/GeckoArgs.h"
12 #if defined(OS_WIN) && defined(MOZ_SANDBOX)
13 # include "mozilla/sandboxTarget.h"
14 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
15 # include "mozilla/SandboxSettings.h"
16 #endif
18 namespace mozilla {
19 namespace gfx {
21 using namespace ipc;
23 GPUProcessImpl::GPUProcessImpl(ProcessId aParentPid)
24 : ProcessChild(aParentPid) {}
26 GPUProcessImpl::~GPUProcessImpl() = default;
28 bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) {
29 #if defined(MOZ_SANDBOX) && defined(OS_WIN)
30 mozilla::SandboxTarget::Instance()->StartSandbox();
31 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
32 StartOpenBSDSandbox(GeckoProcessType_GPU);
33 #endif
35 Maybe<const char*> parentBuildID =
36 geckoargs::sParentBuildID.Get(aArgc, aArgv);
37 if (parentBuildID.isNothing()) {
38 return false;
41 if (!ProcessChild::InitPrefs(aArgc, aArgv)) {
42 return false;
45 return mGPU.Init(ParentPid(), *parentBuildID,
46 IOThreadChild::TakeInitialPort());
49 void GPUProcessImpl::CleanUp() { NS_ShutdownXPCOM(nullptr); }
51 } // namespace gfx
52 } // namespace mozilla