Bug 569500 - e10s: /netwerk/test/unit_ipc/* fails on windows 7 r=bsmedberg
authorJim Mathies <jmathies@mozilla.com>
Wed, 30 Jun 2010 15:51:44 -0700
changeset 46947 ff63836f5fca48374b0c4394845bf17d3846884c
parent 46946 d1dc03b03aefd307243d25b26fe07af0a637cf86
child 46948 4aebd52d74e85d3059a5e0e9b8b43715e57491d3
child 46949 66b53c62916415ad04240d10c31d3c8e7fdfe7ac
child 46957 735b94e5d1021ef71948e6843365ec810ea69fd8
push id14210
push userdougt@mozilla.com
push dateThu, 01 Jul 2010 06:28:42 +0000
treeherdermozilla-central@3aff97777291 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs569500
milestone2.0b2pre
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 569500 - e10s: /netwerk/test/unit_ipc/* fails on windows 7 r=bsmedberg
ipc/glue/GeckoChildProcessHost.cpp
ipc/glue/GeckoChildProcessHost.h
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -102,19 +102,46 @@ GeckoChildProcessHost::~GeckoChildProces
   if (mChildProcessHandle > 0)
     ProcessWatcher::EnsureProcessTerminated(mChildProcessHandle
 #if defined(NS_BUILD_REFCNT_LOGGING)
                                             , false // don't "force"
 #endif
     );
 }
 
+#ifdef XP_WIN
+void GeckoChildProcessHost::InitWindowsGroupID()
+{
+  // On Win7+, pass the application user model to the child, so it can
+  // register with it. This insures windows created by the container
+  // properly group with the parent app on the Win7 taskbar.
+  nsCOMPtr<nsIWinTaskbar> taskbarInfo =
+    do_GetService(NS_TASKBAR_CONTRACTID);
+  if (taskbarInfo) {
+    PRBool isSupported = PR_FALSE;
+    taskbarInfo->GetAvailable(&isSupported);
+    nsAutoString appId;
+    if (isSupported && NS_SUCCEEDED(taskbarInfo->GetDefaultGroupId(appId))) {
+      mGroupId.Assign(PRUnichar('\"'));
+      mGroupId.Append(appId);
+      mGroupId.Append(PRUnichar('\"'));
+    } else {
+      mGroupId.AssignLiteral("-");
+    }
+  }
+}
+#endif
+
 bool
 GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts)
 {
+#ifdef XP_WIN
+  InitWindowsGroupID();
+#endif
+
   MessageLoop* ioLoop = XRE_GetIOMessageLoop();
   NS_ASSERTION(MessageLoop::current() != ioLoop, "sync launch from the IO thread NYI");
 
   ioLoop->PostTask(FROM_HERE,
                    NewRunnableMethod(this,
                                      &GeckoChildProcessHost::PerformAsyncLaunch,
                                      aExtraOpts));
 
@@ -126,16 +153,20 @@ GeckoChildProcessHost::SyncLaunch(std::v
   }
 
   return true;
 }
 
 bool
 GeckoChildProcessHost::AsyncLaunch(std::vector<std::string> aExtraOpts)
 {
+#ifdef XP_WIN
+  InitWindowsGroupID();
+#endif
+
   MessageLoop* ioLoop = XRE_GetIOMessageLoop();
   ioLoop->PostTask(FROM_HERE,
                    NewRunnableMethod(this,
                                      &GeckoChildProcessHost::PerformAsyncLaunch,
                                      aExtraOpts));
 
   // This may look like the sync launch wait, but we only delay as
   // long as it takes to create the channel.
@@ -284,41 +315,17 @@ GeckoChildProcessHost::PerformAsyncLaunc
   cmdLine.AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
 
   for (std::vector<std::string>::iterator it = aExtraOpts.begin();
        it != aExtraOpts.end();
        ++it) {
       cmdLine.AppendLooseValue(UTF8ToWide(*it));
   }
 
-  // On Win7+, pass the application user model to the child, so it can
-  // register with it. This insures windows created by the container
-  // properly group with the parent app on the Win7 taskbar.
-  nsCOMPtr<nsIWinTaskbar> taskbarInfo =
-    do_GetService(NS_TASKBAR_CONTRACTID);
-  PRBool set = PR_FALSE;
-  if (taskbarInfo) {
-    PRBool isSupported = PR_FALSE;
-    taskbarInfo->GetAvailable(&isSupported);
-    if (isSupported) {
-      // Set the id for the container.
-      nsAutoString appId, param;
-      param.Append(PRUnichar('\"'));
-      if (NS_SUCCEEDED(taskbarInfo->GetDefaultGroupId(appId))) {
-        param.Append(appId);
-        param.Append(PRUnichar('\"'));
-        cmdLine.AppendLooseValue(std::wstring(param.get()));
-        set = PR_TRUE;
-      }
-    }
-  }
-  if (!set) {
-    cmdLine.AppendLooseValue(std::wstring(L"-"));
-  }
-
+  cmdLine.AppendLooseValue(std::wstring(mGroupId.get()));
   cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
   cmdLine.AppendLooseValue(UTF8ToWide(childProcessType));
 #if defined(MOZ_CRASHREPORTER)
   cmdLine.AppendLooseValue(
     UTF8ToWide(CrashReporter::GetChildNotificationPipe()));
 #endif
 
   base::LaunchApp(cmdLine, false, false, &process);
--- a/ipc/glue/GeckoChildProcessHost.h
+++ b/ipc/glue/GeckoChildProcessHost.h
@@ -91,16 +91,21 @@ public:
 
 protected:
   GeckoProcessType mProcessType;
   Monitor mMonitor;
   bool mLaunched;
   bool mChannelInitialized;
   FilePath mProcessPath;
 
+#ifdef XP_WIN
+  void InitWindowsGroupID();
+  nsString mGroupId;
+#endif
+
 #if defined(OS_POSIX)
   base::file_handle_mapping_vector mFileMap;
 #endif
 
   base::WaitableEventWatcher::Delegate* mDelegate;
 
   ProcessHandle mChildProcessHandle;