tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

VRProcessChild.cpp (1223B)


      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 "VRProcessChild.h"
      8 
      9 #include "mozilla/BackgroundHangMonitor.h"
     10 #include "mozilla/GeckoArgs.h"
     11 #include "mozilla/ipc/ProcessUtils.h"
     12 #include "mozilla/StaticPrefs_dom.h"
     13 
     14 using namespace mozilla;
     15 using namespace mozilla::gfx;
     16 
     17 StaticRefPtr<VRParent> sVRParent;
     18 
     19 VRProcessChild::~VRProcessChild() { sVRParent = nullptr; }
     20 
     21 /*static*/
     22 VRParent* VRProcessChild::GetVRParent() {
     23  MOZ_ASSERT(sVRParent);
     24  return sVRParent;
     25 }
     26 
     27 bool VRProcessChild::Init(int aArgc, char* aArgv[]) {
     28  Maybe<const char*> parentBuildID =
     29      geckoargs::sParentBuildID.Get(aArgc, aArgv);
     30  if (parentBuildID.isNothing()) {
     31    return false;
     32  }
     33 
     34  if (!ProcessChild::InitPrefs(aArgc, aArgv)) {
     35    return false;
     36  }
     37 
     38  sVRParent = new VRParent();
     39  sVRParent->Init(TakeInitialEndpoint(), *parentBuildID);
     40 
     41  return true;
     42 }
     43 
     44 void VRProcessChild::CleanUp() {
     45  sVRParent = nullptr;
     46  NS_ShutdownXPCOM(nullptr);
     47 }