Browse Source

pyxpcom: update for latest AppInfo changes

toddw 10 years ago
parent
commit
960c5346e2
1 changed files with 20 additions and 0 deletions
  1. 20 0
      xpcom/src/module/PyAppInfo.cpp

+ 20 - 0
xpcom/src/module/PyAppInfo.cpp

@@ -5,6 +5,14 @@
 #include "nsStringGlue.h"
 #include "nsXULAppAPI.h"
 
+#ifdef XP_UNIX
+#include <unistd.h>
+#endif
+
+#ifdef XP_WIN
+#include <process.h>
+#endif
+
 // This leaks. But we can't do much about that.
 static PyAppInfo* gAppInfo = nullptr;
 
@@ -227,6 +235,18 @@ PyAppInfo::GetProcessType(uint32_t *aProcessType)
     return NS_OK;
 }
 
+/* readonly attribute unsigned long processID; */
+NS_IMETHODIMP
+PyAppInfo::GetProcessID(uint32_t* aResult)
+{
+#ifdef XP_WIN
+  *aResult = GetCurrentProcessId();
+#else
+  *aResult = getpid();
+#endif
+  return NS_OK;
+}
+
 /* readonly attribute boolean browserTabsRemote; */
 NS_IMETHODIMP
 PyAppInfo::GetBrowserTabsRemote(bool* aResult)