GPUProcessImpl.cpp (1435B)
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 "nsXPCOM.h" 8 #include "mozilla/ipc/ProcessUtils.h" 9 #include "mozilla/GeckoArgs.h" 10 11 #if defined(XP_WIN) && defined(MOZ_SANDBOX) 12 # include "nsAppShell.h" 13 # include "mozilla/sandboxTarget.h" 14 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX) 15 # include "mozilla/SandboxSettings.h" 16 #endif 17 18 namespace mozilla { 19 namespace gfx { 20 21 using namespace ipc; 22 23 GPUProcessImpl::~GPUProcessImpl() = default; 24 25 bool GPUProcessImpl::Init(int aArgc, char* aArgv[]) { 26 #if defined(MOZ_SANDBOX) && defined(XP_WIN) 27 nsAppShell::PrecacheEventWindow(); 28 mozilla::SandboxTarget::Instance()->StartSandbox(); 29 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX) 30 StartOpenBSDSandbox(GeckoProcessType_GPU); 31 #endif 32 33 Maybe<const char*> parentBuildID = 34 geckoargs::sParentBuildID.Get(aArgc, aArgv); 35 if (parentBuildID.isNothing()) { 36 return false; 37 } 38 39 if (!ProcessChild::InitPrefs(aArgc, aArgv)) { 40 return false; 41 } 42 43 return mGPU->Init(TakeInitialEndpoint(), *parentBuildID); 44 } 45 46 void GPUProcessImpl::CleanUp() { NS_ShutdownXPCOM(nullptr); } 47 48 } // namespace gfx 49 } // namespace mozilla