Bug 683803 - [backout] Add a 60 FPS Cap to throttle plugin drawing. r=backout
authorBenoit Girard <b56girard@gmail.com>
Tue, 20 Sep 2011 22:35:13 -0400
changeset 77232 eb6bdbfa89c1fe4d3328804b186da81d4d3a5578
parent 77231 182d4c0c11640d822536421e902c2bbcff118c66
child 77233 1ed711ae0b35a53aeb1866e95b23a70b3ae0ea1e
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersbackout
bugs683803
milestone9.0a1
Bug 683803 - [backout] Add a 60 FPS Cap to throttle plugin drawing. r=backout
dom/plugins/ipc/PluginInstanceChild.cpp
layout/base/tests/test_flush_on_paint.html
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -3347,26 +3347,16 @@ PluginInstanceChild::InvalidateRectDelay
 
     mCurrentInvalidateTask = nsnull;
     if (mAccumulatedInvalidRect.IsEmpty()) {
         return;
     }
 
     if (!ShowPluginFrame()) {
         AsyncShowPluginFrame();
-    } else if (!mCurrentInvalidateTask) {
-        // We have just painted a frame. Prepare a delayed mCurrentInvalidateTask
-        // task 15ms from now. This will cause any invalidate rect calls to
-        // accumulate. If none are made during this time the task will do
-        // nothing on an empty mAccumulatedInvalidRect.
-        // See bug 683803
-        mCurrentInvalidateTask =
-            NewRunnableMethod(this, &PluginInstanceChild::InvalidateRectDelayed);
-        MessageLoop::current()->PostDelayedTask(
-            FROM_HERE, mCurrentInvalidateTask, 15);
     }
 }
 
 void
 PluginInstanceChild::AsyncShowPluginFrame(void)
 {
     if (mCurrentInvalidateTask) {
         return;
--- a/layout/base/tests/test_flush_on_paint.html
+++ b/layout/base/tests/test_flush_on_paint.html
@@ -15,41 +15,48 @@
 SimpleTest.waitForExplicitFinish();
 
 var iterations = 0;
 var plugin = document.getElementById("plugin");
 var lastPaintCount;
 var expectedWidth;
 
 var toggle = true;
+function invalidationLoop() {
+  toggle = !toggle;
+  var color = toggle ? "8F" : "00";
+  plugin.setColor("FFFFFF" + color);
+  setTimeout(invalidationLoop, 20);
+}
+invalidationLoop();
 
 function doIteration() {
   lastPaintCount = window.mozPaintCount;
   ok(true, "Beginning iteration " + iterations + ", last paint count: " + lastPaintCount);
 
   expectedWidth = 201 + iterations;
   plugin.style.width = expectedWidth + "px";
-  setTimeout(checkDone, 60);
+  checkDone();
 }
 
 function checkDone() {
   ok(true, "Check to see if we're done: " + window.mozPaintCount);
   if (window.mozPaintCount == lastPaintCount) {
     setTimeout(checkDone, 30);
     return;
   }
 
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
                  getInterface(Components.interfaces.nsIDOMWindowUtils);
   is(plugin.getWidthAtLastPaint(), utils.screenPixelsPerCSSPixel*expectedWidth,
      "Check that we set width before painting");
 
   ++iterations;
-  if (iterations < 25) {
+  if (iterations < 100) {
     doIteration();
   } else {
     SimpleTest.finish();
   }
 }
 </script>
 </pre>
 </body>