Don't run the compositor:created notification from within unsafer callers. (bug 1201684, r=mattwoodrow)
authorDavid Anderson <dvander@alliedmods.net>
Sun, 13 Sep 2015 23:51:45 -0700
changeset 294882 8d28818620984759e64d3e78dd0c841cf8bba493
parent 294881 346b9ee524d1a704ea953ef16237f3d0c7ee56d1
child 294883 e91af2be3c3e384a619839cc28a7e8f81a9d0d43
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1201684
milestone43.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
Don't run the compositor:created notification from within unsafer callers. (bug 1201684, r=mattwoodrow)
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2479,19 +2479,21 @@ gfxPlatform::NotifyCompositorCreated(Lay
   }
 
   NS_ASSERTION(mCompositorBackend == LayersBackend::LAYERS_NONE, "Compositor backend changed.");
 
   // Set the backend before we notify so it's available immediately.
   mCompositorBackend = aBackend;
 
   // Notify that we created a compositor, so telemetry can update.
-  if (nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService()) {
-    obsvc->NotifyObservers(nullptr, "compositor:created", nullptr);
-  }
+  NS_DispatchToMainThread(NS_NewRunnableFunction([] {
+    if (nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService()) {
+      obsvc->NotifyObservers(nullptr, "compositor:created", nullptr);
+    }
+  }));
 }
 
 void
 gfxPlatform::GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
   aOut->useAcceleration() = ShouldUseLayersAcceleration();
 }