Bug 1287626 - Add globally unique nsIXULAppinfo.uniqueProcessID r=billm
authorRob Wu <rob@robwu.nl>
Wed, 10 Aug 2016 16:07:40 -0700
changeset 350722 6e0577a5a59aac92c289edae5ff4219d526eae44
parent 350721 d83613a10eab2191faa1521df4ae500e585e3cf5
child 350723 a327a15f5d55fd391882a951bc936b73ef1f8504
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1287626
milestone51.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 1287626 - Add globally unique nsIXULAppinfo.uniqueProcessID r=billm MozReview-Commit-ID: 3bcW1CjTpjT
toolkit/xre/nsAppRunner.cpp
xpcom/system/nsIXULRuntime.idl
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -832,16 +832,28 @@ nsXULAppInfo::GetProcessID(uint32_t* aRe
 #ifdef XP_WIN
   *aResult = GetCurrentProcessId();
 #else
   *aResult = getpid();
 #endif
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsXULAppInfo::GetUniqueProcessID(uint64_t* aResult)
+{
+  if (XRE_IsContentProcess()) {
+    ContentChild* cc = ContentChild::GetSingleton();
+    *aResult = cc->GetID();
+  } else {
+    *aResult = 0;
+  }
+  return NS_OK;
+}
+
 static bool gBrowserTabsRemoteAutostart = false;
 static uint64_t gBrowserTabsRemoteStatus = 0;
 static bool gBrowserTabsRemoteAutostartInitialized = false;
 
 static bool gMultiprocessBlockPolicyInitialized = false;
 static uint32_t gMultiprocessBlockPolicy = 0;
 
 NS_IMETHODIMP
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -82,16 +82,21 @@ interface nsIXULRuntime : nsISupports
   readonly attribute unsigned long processType;
 
   /**
    * The system process ID of the caller's process.
    */
   readonly attribute unsigned long processID;
 
   /**
+   * A globally unique and non-recycled ID of the caller's process.
+   */
+  readonly attribute uint64_t uniqueProcessID;
+
+  /**
    * If true, browser tabs may be opened by default in a different process
    * from the main browser UI.
    */
   readonly attribute boolean browserTabsRemoteAutostart;
 
   /**
    * A numeric value indicating whether multiprocess might be blocked.
    * Possible values can be found at nsAppRunner.cpp. A value of 0