Bug 931456 - Initialize the chrome process pid information while we are constructing OpenFileFinder. r=dhylands
authorAlan Huang <ahuang@mozilla.com>
Wed, 04 Dec 2013 10:24:36 +0800
changeset 173593 bb4d1db9477cd9eaec3d1a02f0463f073b421013
parent 173592 9d27443233412e2dd8a51b69daa454db47719caf
child 173594 eb7a2bcb3e6f49e2f8efc2fac3bf31fe3b31799f
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs931456
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 931456 - Initialize the chrome process pid information while we are constructing OpenFileFinder. r=dhylands
dom/system/gonk/OpenFileFinder.cpp
--- a/dom/system/gonk/OpenFileFinder.cpp
+++ b/dom/system/gonk/OpenFileFinder.cpp
@@ -14,19 +14,20 @@ namespace mozilla {
 namespace system {
 
 OpenFileFinder::OpenFileFinder(const nsACString& aPath,
                                bool aCheckIsB2gOrDescendant /* = true */)
   : mPath(aPath),
     mProcDir(nullptr),
     mFdDir(nullptr),
     mPid(0),
-    mMyPid(-1),
     mCheckIsB2gOrDescendant(aCheckIsB2gOrDescendant)
 {
+  // We assume that we're running in the parent process
+  mMyPid = getpid();
 }
 
 OpenFileFinder::~OpenFileFinder()
 {
   Close();
 }
 
 bool
@@ -157,20 +158,16 @@ OpenFileFinder::FillInfo(OpenFileFinder:
   }
   nsDependentCSubstring comm(&openParen[1], closeParen - openParen - 1);
   aInfo->mComm = comm;
   // There is a single character field after the comm and then
   // the parent pid (the field we're interested in).
   // ) X ppid
   // 01234
   int ppid = atoi(&closeParen[4]);
-  // We assume that we're running in the parent process
-  if (mMyPid == -1) {
-    mMyPid = getpid();
-  }
 
   if (mPid == mMyPid) {
     // This is chrome process
     aInfo->mIsB2gOrDescendant = true;
     DBG("Chrome process has open file(s)");
     return;
   }
   // For the rest (non-chrome process), we recursively check the ppid to know