[TexMap][Qt] Start PageClientQ[Graphics]Widget::syncTimer only when the syncTimer
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 07:09:24 +0000 (07:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 07:09:24 +0000 (07:09 +0000)
is inactive.
https://bugs.webkit.org/show_bug.cgi?id=70407

Make sure we only activate the synchronization timer in
PageClientQWidget/PageClientQGraphicsWidget if it's not already active,
otherwise syncLayers may be called redundantly.

Patch by Huang Dongsung <luxtella@company100.net> on 2011-11-15
Reviewed by Noam Rosenthal.

* WebCoreSupport/PageClientQt.cpp:
(WebCore::PageClientQWidget::markForSync):
(WebCore::PageClientQWidget::syncLayers):
(WebCore::PageClientQGraphicsWidget::syncLayers):
(WebCore::PageClientQGraphicsWidget::markForSync):
* WebCoreSupport/PageClientQt.h:
(WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp
Source/WebKit/qt/WebCoreSupport/PageClientQt.h

index 9be81dc4fc6e8841c8ea0f4073977becc469f49c..e0263a83dbce97d351f712493403c12aa7be3e01 100644 (file)
@@ -1,3 +1,23 @@
+2011-11-15  Huang Dongsung  <luxtella@company100.net>
+
+        [TexMap][Qt] Start PageClientQ[Graphics]Widget::syncTimer only when the syncTimer
+        is inactive.
+        https://bugs.webkit.org/show_bug.cgi?id=70407
+
+        Make sure we only activate the synchronization timer in
+        PageClientQWidget/PageClientQGraphicsWidget if it's not already active,
+        otherwise syncLayers may be called redundantly.
+
+        Reviewed by Noam Rosenthal.
+
+        * WebCoreSupport/PageClientQt.cpp:
+        (WebCore::PageClientQWidget::markForSync):
+        (WebCore::PageClientQWidget::syncLayers):
+        (WebCore::PageClientQGraphicsWidget::syncLayers):
+        (WebCore::PageClientQGraphicsWidget::markForSync):
+        * WebCoreSupport/PageClientQt.h:
+        (WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget):
+
 2011-11-15  Jochen Eisinger  <jochen@chromium.org>
 
         Rename ReferrerPolicy to clarify its meaning
index a49c69cc0f138d5ba104f72b4f894c5f424e1456..40e6b148d94a1f3daf038e67071a888bad11eb5e 100644 (file)
@@ -85,6 +85,8 @@ void PageClientQWidget::setRootGraphicsLayer(GraphicsLayer* layer)
 
 void PageClientQWidget::markForSync(bool scheduleSync)
 {
+    if (syncTimer.isActive())
+        return;
     syncTimer.startOneShot(0);
 }
 
@@ -95,7 +97,7 @@ void PageClientQWidget::syncLayers(Timer<PageClientQWidget>*)
     QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateIncludingSubframes();
     if (!textureMapperNodeClient)
         return;
-    if (textureMapperNodeClient->rootNode()->descendantsOrSelfHaveRunningAnimations())
+    if (textureMapperNodeClient->rootNode()->descendantsOrSelfHaveRunningAnimations() && !syncTimer.isActive())
         syncTimer.startOneShot(1.0 / 60.0);
     update(view->rect());
 }
@@ -251,12 +253,9 @@ void PageClientQGraphicsWidget::syncLayers()
     if (!textureMapperNodeClient)
         return;
 
-    if (textureMapperNodeClient->rootNode()->descendantsOrSelfHaveRunningAnimations())
+    if (textureMapperNodeClient->rootNode()->descendantsOrSelfHaveRunningAnimations() && !syncTimer.isActive())
         syncTimer.startOneShot(1.0 / 60.0);
     update(view->boundingRect().toAlignedRect());
-    if (!shouldSync)
-        return;
-    shouldSync = false;
 #endif
 }
 
@@ -298,7 +297,8 @@ void PageClientQGraphicsWidget::setRootGraphicsLayer(GraphicsLayer* layer)
 
 void PageClientQGraphicsWidget::markForSync(bool scheduleSync)
 {
-    shouldSync = true;
+    if (syncTimer.isActive())
+        return;
     syncTimer.startOneShot(0);
 }
 
index 5be3fdad7558e73ea8c4ae15403b068f3c40a95d..3480449d2b9830e692f7ce38eb5f806329d06f49 100644 (file)
@@ -161,7 +161,6 @@ public:
         , viewResizesToContents(false)
 #if USE(ACCELERATED_COMPOSITING)
         , syncTimer(this, &PageClientQGraphicsWidget::syncLayersTimeout)
-        , shouldSync(false)
 #endif
         , overlay(0)
     {
@@ -230,10 +229,6 @@ public:
 #endif
     // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue
     Timer<PageClientQGraphicsWidget> syncTimer;
-
-    // we need to sync the layers if we get a special call from the WebCore
-    // compositor telling us to do so. We'll get that call from ChromeClientQt
-    bool shouldSync;
 #endif
     // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached
     QGraphicsItemOverlay* overlay;