LCOV - code coverage report
Current view: top level - ipc/glue - ProcessChild.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 8 13 61.5 %
Date: 2017-07-14 16:53:18 Functions: 1 4 25.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "nsDebug.h"
       8             : 
       9             : #ifdef XP_WIN
      10             : #include <stdlib.h> // for _exit()
      11             : #else
      12             : #include <unistd.h> // for _exit()
      13             : #endif
      14             : 
      15             : #include "mozilla/ipc/IOThreadChild.h"
      16             : #include "mozilla/ipc/ProcessChild.h"
      17             : 
      18             : namespace mozilla {
      19             : namespace ipc {
      20             : 
      21             : ProcessChild* ProcessChild::gProcessChild;
      22             : 
      23           2 : ProcessChild::ProcessChild(ProcessId aParentPid)
      24           2 :   : ChildProcess(new IOThreadChild())
      25           2 :   , mUILoop(MessageLoop::current())
      26           4 :   , mParentPid(aParentPid)
      27             : {
      28           2 :   MOZ_ASSERT(mUILoop, "UILoop should be created by now");
      29           2 :   MOZ_ASSERT(!gProcessChild, "should only be one ProcessChild");
      30           2 :   gProcessChild = this;
      31           2 : }
      32             : 
      33           0 : ProcessChild::~ProcessChild()
      34             : {
      35           0 :   gProcessChild = nullptr;
      36           0 : }
      37             : 
      38             : /* static */ void
      39           0 : ProcessChild::QuickExit()
      40             : {
      41             : #ifdef XP_WIN
      42             :   // In bug 1254829, the destructor got called when dll got detached on windows,
      43             :   // switch to TerminateProcess to bypass dll detach handler during the process
      44             :   // termination.
      45             :   TerminateProcess(GetCurrentProcess(), 0);
      46             : #else
      47           0 :   _exit(0);
      48             : #endif
      49             : }
      50             : 
      51             : } // namespace ipc
      52             : } // namespace mozilla

Generated by: LCOV version 1.13