Title: [117608] trunk/Source/WebKit/chromium
Revision
117608
Author
[email protected]
Date
2012-05-18 11:11:13 -0700 (Fri, 18 May 2012)

Log Message

[chromium] Multithreaded compositor unit tests intermittently failing
https://bugs.webkit.org/show_bug.cgi?id=74623

Patch by Ian Vollick <[email protected]> on 2012-05-18
Reviewed by Adrienne Walker.

The flakiness of the CCLayerTreeHost tests stem from processing tasks after the
tests finish. To fix this, I've disabled the dispatch* methods after endTest is
called, effectively preventing any further tasks scheduled by the tests from
being processed. I have also reworked the checks in
CCLayerTreeHostTestWriteLayersRedraw to make the test more robust.

* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTest::CCLayerTreeHostTest):
(WTF::CCLayerTreeHostTest::dispatchSetNeedsAnimate):
(WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
(WTF::CCLayerTreeHostTest::dispatchAddAnimation):
(WTF::CCLayerTreeHostTest::dispatchSetNeedsAnimateAndCommit):
(WTF::CCLayerTreeHostTest::dispatchSetNeedsCommit):
(WTF::CCLayerTreeHostTest::dispatchAcquireLayerTextures):
(WTF::CCLayerTreeHostTest::dispatchSetNeedsRedraw):
(WTF::CCLayerTreeHostTest::dispatchSetVisible):
(WTF::CCLayerTreeHostTest::dispatchSetInvisible):
(CCLayerTreeHostTest):
(WTF::CCLayerTreeHostTest::endTest):
(WTF::CCLayerTreeHostTestWriteLayersRedraw::drawLayersOnCCThread):
(WTF::CCLayerTreeHostTestWriteLayersRedraw::afterTest):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (117607 => 117608)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-18 18:09:16 UTC (rev 117607)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-18 18:11:13 UTC (rev 117608)
@@ -1,3 +1,32 @@
+2012-05-18  Ian Vollick  <[email protected]>
+
+        [chromium] Multithreaded compositor unit tests intermittently failing
+        https://bugs.webkit.org/show_bug.cgi?id=74623
+
+        Reviewed by Adrienne Walker.
+
+        The flakiness of the CCLayerTreeHost tests stem from processing tasks after the
+        tests finish. To fix this, I've disabled the dispatch* methods after endTest is
+        called, effectively preventing any further tasks scheduled by the tests from
+        being processed. I have also reworked the checks in
+        CCLayerTreeHostTestWriteLayersRedraw to make the test more robust.
+
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest):
+        (WTF::CCLayerTreeHostTest::dispatchSetNeedsAnimate):
+        (WTF::CCLayerTreeHostTest::dispatchAddInstantAnimation):
+        (WTF::CCLayerTreeHostTest::dispatchAddAnimation):
+        (WTF::CCLayerTreeHostTest::dispatchSetNeedsAnimateAndCommit):
+        (WTF::CCLayerTreeHostTest::dispatchSetNeedsCommit):
+        (WTF::CCLayerTreeHostTest::dispatchAcquireLayerTextures):
+        (WTF::CCLayerTreeHostTest::dispatchSetNeedsRedraw):
+        (WTF::CCLayerTreeHostTest::dispatchSetVisible):
+        (WTF::CCLayerTreeHostTest::dispatchSetInvisible):
+        (CCLayerTreeHostTest):
+        (WTF::CCLayerTreeHostTest::endTest):
+        (WTF::CCLayerTreeHostTestWriteLayersRedraw::drawLayersOnCCThread):
+        (WTF::CCLayerTreeHostTestWriteLayersRedraw::afterTest):
+
 2012-05-18  MORITA Hajime  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=85515

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (117607 => 117608)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-05-18 18:09:16 UTC (rev 117607)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-05-18 18:11:13 UTC (rev 117608)
@@ -367,7 +367,8 @@
     CCLayerTreeHostTest()
         : m_beginning(false)
         , m_endWhenBeginReturns(false)
-        , m_timedOut(false) { }
+        , m_timedOut(false)
+        , m_finished(false) { }
 
     void doBeginTest();
 
@@ -379,8 +380,11 @@
 
     static void dispatchSetNeedsAnimate(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT(test);
         if (test->m_layerTreeHost)
             test->m_layerTreeHost->setNeedsAnimate();
@@ -388,8 +392,11 @@
 
     static void dispatchAddInstantAnimation(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT(test);
         if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
             addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 0, 0, 0.5, false);
@@ -397,8 +404,11 @@
 
     static void dispatchAddAnimation(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT(test);
         if (test->m_layerTreeHost && test->m_layerTreeHost->rootLayer())
             addOpacityTransitionToLayer(*test->m_layerTreeHost->rootLayer(), 10, 0, 0.5, true);
@@ -406,8 +416,11 @@
 
     static void dispatchSetNeedsAnimateAndCommit(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT(test);
         if (test->m_layerTreeHost) {
             test->m_layerTreeHost->setNeedsAnimate();
@@ -417,8 +430,11 @@
 
     static void dispatchSetNeedsCommit(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT_TRUE(test);
         if (test->m_layerTreeHost)
             test->m_layerTreeHost->setNeedsCommit();
@@ -426,17 +442,23 @@
 
     static void dispatchAcquireLayerTextures(void* self)
     {
-      ASSERT(isMainThread());
-      CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
-      ASSERT_TRUE(test);
-      if (test->m_layerTreeHost)
-          test->m_layerTreeHost->acquireLayerTextures();
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
+        ASSERT(isMainThread());
+        ASSERT_TRUE(test);
+        if (test->m_layerTreeHost)
+            test->m_layerTreeHost->acquireLayerTextures();
     }
 
     static void dispatchSetNeedsRedraw(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT_TRUE(test);
         if (test->m_layerTreeHost)
             test->m_layerTreeHost->setNeedsRedraw();
@@ -444,8 +466,11 @@
 
     static void dispatchSetVisible(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT(test);
         if (test->m_layerTreeHost)
             test->m_layerTreeHost->setVisible(true);
@@ -453,8 +478,11 @@
 
     static void dispatchSetInvisible(void* self)
     {
+        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+        if (test->m_finished)
+            return;
+
         ASSERT(isMainThread());
-        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
         ASSERT(test);
         if (test->m_layerTreeHost)
             test->m_layerTreeHost->setVisible(false);
@@ -547,6 +575,7 @@
     bool m_beginning;
     bool m_endWhenBeginReturns;
     bool m_timedOut;
+    bool m_finished;
 
     OwnPtr<WebThread> m_webThread;
     RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
@@ -574,6 +603,8 @@
 
 void CCLayerTreeHostTest::endTest()
 {
+    m_finished = true;
+
     // If we are called from the CCThread, re-call endTest on the main thread.
     if (!isMainThread())
         m_mainThreadProxy->postTask(createCCThreadTask(this, &CCLayerTreeHostTest::endTest));
@@ -930,8 +961,8 @@
 
     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
     {
-        EXPECT_EQ(1, impl->sourceFrameNumber());
         m_numDraws++;
+        EXPECT_EQ(m_numDraws, m_numCommits);
     }
 
     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
@@ -942,7 +973,6 @@
 
     virtual void afterTest()
     {
-        EXPECT_EQ(0, m_numDraws);
         EXPECT_EQ(1, m_numCommits);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to