test refresh driver with callback init
authorMason Chang <mchang@mozilla.com>
Wed, 11 Mar 2015 19:43:36 -0700
changeset 326758 75173caa99c2241af218f69e5bda35b0f121ec5c
parent 326757 31a59327cceee16441c3228d699abe42d236ae5f
child 326759 43c30e1f459d8c95facde3cd0e0531f27ee17b8e
push id10169
push userdminor@mozilla.com
push dateThu, 28 Jan 2016 13:10:48 +0000
milestone39.0a1
test refresh driver with callback init
layout/base/nsRefreshDriver.cpp
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -769,34 +769,26 @@ class VsyncChildCreateCallback MOZ_FINAL
   NS_DECL_ISUPPORTS
 
 public:
   VsyncChildCreateCallback()
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
 
-  static void CreateVsyncActor(PBackgroundChild* aPBackgroundChild)
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-    MOZ_ASSERT(aPBackgroundChild);
-
-    layout::PVsyncChild* actor = aPBackgroundChild->SendPVsyncConstructor();
-    layout::VsyncChild* child = static_cast<layout::VsyncChild*>(actor);
-    nsRefreshDriver::PVsyncActorCreated(child);
-  }
-
 private:
   virtual ~VsyncChildCreateCallback() {}
 
   virtual void ActorCreated(PBackgroundChild* aPBackgroundChild) MOZ_OVERRIDE
   {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(aPBackgroundChild);
-    CreateVsyncActor(aPBackgroundChild);
+    layout::PVsyncChild* actor = aPBackgroundChild->SendPVsyncConstructor();
+    layout::VsyncChild* child = static_cast<layout::VsyncChild*>(actor);
+    nsRefreshDriver::PVsyncActorCreated(child);
   }
 
   virtual void ActorFailed() MOZ_OVERRIDE
   {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_CRASH("Failed To Create VsyncChild Actor");
   }
 }; // VsyncChildCreateCallback
@@ -814,30 +806,16 @@ static nsITimer *sDisableHighPrecisionTi
 #endif
 
 static void
 CreateContentVsyncRefreshTimer(void*)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!XRE_IsParentProcess());
 
-  // Create the PVsync actor child for vsync-base refresh timer.
-  // PBackgroundChild is created asynchronously. If PBackgroundChild is still
-  // unavailable, setup VsyncChildCreateCallback callback to handle the async
-  // connect. We will still use software timer before PVsync ready, and change
-  // to use hw timer when the connection is done. Please check
-  // VsyncChildCreateCallback::CreateVsyncActor() and
-  // nsRefreshDriver::PVsyncActorCreated().
-  PBackgroundChild* backgroundChild = BackgroundChild::GetForCurrentThread();
-  if (backgroundChild) {
-    // If we already have PBackgroundChild, create the
-    // child VsyncRefreshDriverTimer here.
-    VsyncChildCreateCallback::CreateVsyncActor(backgroundChild);
-    return;
-  }
   // Setup VsyncChildCreateCallback callback
   nsRefPtr<nsIIPCBackgroundChildCreateCallback> callback = new VsyncChildCreateCallback();
   if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(callback))) {
     MOZ_CRASH("PVsync actor create failed!");
   }
 }
 
 static void