Bug 1269056: Part 3 - Consolidate XPCOM and chromium event queues for the main thread. r=froydnj
authorKyle Huey <khuey@kylehuey.com>
Thu, 12 May 2016 15:15:43 -0700
changeset 297236 3533a2d51e97b17157ae76b194525dff1a9f422c
parent 297235 7ebbd63adcd9b29f6d5a846cbae7fa384fcd1ada
child 297237 5d493625548f7c9492183e1c7313606e6a7daf40
push id76660
push userkhuey@mozilla.com
push dateThu, 12 May 2016 22:16:05 +0000
treeherdermozilla-inbound@3533a2d51e97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1269056
milestone49.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 1269056: Part 3 - Consolidate XPCOM and chromium event queues for the main thread. r=froydnj
ipc/glue/MessagePump.cpp
--- a/ipc/glue/MessagePump.cpp
+++ b/ipc/glue/MessagePump.cpp
@@ -198,17 +198,23 @@ MessagePump::ScheduleDelayedWork(const b
   uint32_t delayMS = uint32_t(delay.InMilliseconds());
   mDelayedWorkTimer->InitWithCallback(mDoWorkEvent, delayMS,
                                       nsITimer::TYPE_ONE_SHOT);
 }
 
 nsIEventTarget*
 MessagePump::GetXPCOMThread()
 {
-  return mThread;
+  if (mThread) {
+    return mThread;
+  }
+
+  // Main thread
+  nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
+  return mainThread;
 }
 
 void
 MessagePump::DoDelayedWork(base::MessagePump::Delegate* aDelegate)
 {
   aDelegate->DoDelayedWork(&delayed_work_time_);
   if (!delayed_work_time_.is_null()) {
     ScheduleDelayedWork(delayed_work_time_);