Bug 1287626 - Add globally unique nsIXULAppinfo.uniqueProcessID draft
authorRob Wu <rob@robwu.nl>
Wed, 10 Aug 2016 16:07:40 -0700
changeset 399728 fb4247cf5198c67f9d10b93810ffcbc281f3a333
parent 399141 c12bb83ad278a7884af9c70c3622dc6b4c819eaf
child 399729 3356ceda68a15c9f3321653dfd9b38bc98b73e52
child 399731 6d6680c931ec7bd3589979974fb5e5ac0c36e664
push id25962
push userbmo:rob@robwu.nl
push dateThu, 11 Aug 2016 23:00:40 +0000
bugs1287626
milestone51.0a1
Bug 1287626 - Add globally unique nsIXULAppinfo.uniqueProcessID 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