Title: [127079] trunk/Source
Revision
127079
Author
[email protected]
Date
2012-08-29 18:58:55 -0700 (Wed, 29 Aug 2012)

Log Message

Unreviewed, rolling out r126956.
http://trac.webkit.org/changeset/126956
https://bugs.webkit.org/show_bug.cgi?id=94721

Source/WebCore:

Breaks several unit tests - see https://bugs.webkit.org/show_bug.cgi?id=95358 for instance.

* platform/graphics/chromium/cc/CCScheduler.cpp:
(WebCore::CCScheduler::CCScheduler):
(WebCore::CCScheduler::beginFrameComplete):
(WebCore::CCScheduler::vsyncTick):
(WebCore::CCScheduler::processScheduledActions):
* platform/graphics/chromium/cc/CCScheduler.h:
(CCSchedulerClient):
(CCScheduler):
* platform/graphics/chromium/cc/CCTextureUpdateController.cpp:
(WebCore::CCTextureUpdateController::CCTextureUpdateController):
(WebCore::CCTextureUpdateController::hasMoreUpdates):
(WebCore):
(WebCore::CCTextureUpdateController::updateMoreTextures):
(WebCore::CCTextureUpdateController::onTimerFired):
(WebCore::CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining):
* platform/graphics/chromium/cc/CCTextureUpdateController.h:
(WebCore):
(WebCore::CCTextureUpdateController::create):
(CCTextureUpdateController):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::didLoseContextOnImplThread):
(WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):
(WebCore::CCThreadProxy::hasMoreResourceUpdates):
(WebCore):
(WebCore::CCThreadProxy::scheduledActionCommit):
* platform/graphics/chromium/cc/CCThreadProxy.h:
(WebCore):

Source/WebKit/chromium:

Breaks several unit tests

* tests/CCSchedulerTest.cpp:
(WebKitTests::FakeCCSchedulerClient::reset):
(WebKitTests::FakeCCSchedulerClient::setHasMoreResourceUpdates):
(WebKitTests::TEST):
* tests/CCTextureUpdateControllerTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127078 => 127079)


--- trunk/Source/WebCore/ChangeLog	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/ChangeLog	2012-08-30 01:58:55 UTC (rev 127079)
@@ -1,5 +1,41 @@
 2012-08-29  James Robinson  <[email protected]>
 
+        Unreviewed, rolling out r126956.
+        http://trac.webkit.org/changeset/126956
+        https://bugs.webkit.org/show_bug.cgi?id=94721
+
+        Breaks several unit tests - see https://bugs.webkit.org/show_bug.cgi?id=95358 for instance.
+
+        * platform/graphics/chromium/cc/CCScheduler.cpp:
+        (WebCore::CCScheduler::CCScheduler):
+        (WebCore::CCScheduler::beginFrameComplete):
+        (WebCore::CCScheduler::vsyncTick):
+        (WebCore::CCScheduler::processScheduledActions):
+        * platform/graphics/chromium/cc/CCScheduler.h:
+        (CCSchedulerClient):
+        (CCScheduler):
+        * platform/graphics/chromium/cc/CCTextureUpdateController.cpp:
+        (WebCore::CCTextureUpdateController::CCTextureUpdateController):
+        (WebCore::CCTextureUpdateController::hasMoreUpdates):
+        (WebCore):
+        (WebCore::CCTextureUpdateController::updateMoreTextures):
+        (WebCore::CCTextureUpdateController::onTimerFired):
+        (WebCore::CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining):
+        * platform/graphics/chromium/cc/CCTextureUpdateController.h:
+        (WebCore):
+        (WebCore::CCTextureUpdateController::create):
+        (CCTextureUpdateController):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::didLoseContextOnImplThread):
+        (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread):
+        (WebCore::CCThreadProxy::hasMoreResourceUpdates):
+        (WebCore):
+        (WebCore::CCThreadProxy::scheduledActionCommit):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+        (WebCore):
+
+2012-08-29  James Robinson  <[email protected]>
+
         [chromium] Register/unregister contents layers with GraphicsLayerChromium
         https://bugs.webkit.org/show_bug.cgi?id=95379
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp (127078 => 127079)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp	2012-08-30 01:58:55 UTC (rev 127079)
@@ -33,7 +33,6 @@
 CCScheduler::CCScheduler(CCSchedulerClient* client, PassOwnPtr<CCFrameRateController> frameRateController)
     : m_client(client)
     , m_frameRateController(frameRateController)
-    , m_hasMoreResourceUpdates(false)
     , m_updateMoreResourcesPending(false)
 {
     ASSERT(m_client);
@@ -88,10 +87,9 @@
     processScheduledActions();
 }
 
-void CCScheduler::beginFrameComplete(bool hasResourceUpdates)
+void CCScheduler::beginFrameComplete()
 {
     TRACE_EVENT0("cc", "CCScheduler::beginFrameComplete");
-    m_hasMoreResourceUpdates = hasResourceUpdates;
     m_stateMachine.beginFrameComplete();
     processScheduledActions();
 }
@@ -138,8 +136,7 @@
 {
     if (m_updateMoreResourcesPending) {
         m_updateMoreResourcesPending = false;
-        ASSERT(m_hasMoreResourceUpdates);
-        m_stateMachine.beginUpdateMoreResourcesComplete(true);
+        m_stateMachine.beginUpdateMoreResourcesComplete(m_client->hasMoreResourceUpdates());
     }
     TRACE_EVENT0("cc", "CCScheduler::vsyncTick");
 
@@ -148,17 +145,6 @@
     m_stateMachine.didLeaveVSync();
 }
 
-void CCScheduler::updateResourcesComplete()
-{
-    TRACE_EVENT0("cc", "CCScheduler::updateResourcesComplete");
-    if (m_updateMoreResourcesPending) {
-        m_updateMoreResourcesPending = false;
-        m_stateMachine.beginUpdateMoreResourcesComplete(false);
-    }
-    m_hasMoreResourceUpdates = false;
-    processScheduledActions();
-}
-
 CCSchedulerStateMachine::Action CCScheduler::nextAction()
 {
     m_stateMachine.setCanDraw(m_client->canDraw());
@@ -188,7 +174,7 @@
             m_client->scheduledActionBeginFrame();
             break;
         case CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES:
-            if (m_hasMoreResourceUpdates) {
+            if (m_client->hasMoreResourceUpdates()) {
                 m_client->scheduledActionUpdateMoreResources(m_frameRateController->nextTickTimeIfActivated());
                 m_updateMoreResourcesPending = true;
             } else

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h (127078 => 127079)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h	2012-08-30 01:58:55 UTC (rev 127079)
@@ -53,6 +53,7 @@
 class CCSchedulerClient {
 public:
     virtual bool canDraw() = 0;
+    virtual bool hasMoreResourceUpdates() const = 0;
 
     virtual void scheduledActionBeginFrame() = 0;
     virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() = 0;
@@ -92,7 +93,7 @@
     // Like setNeedsRedraw(), but ensures the draw will definitely happen even if we are not visible.
     void setNeedsForcedRedraw();
 
-    void beginFrameComplete(bool hasResourceUpdates);
+    void beginFrameComplete();
     void beginFrameAborted();
 
     void setMaxFramesPending(int);
@@ -109,8 +110,6 @@
     // CCFrameRateControllerClient implementation
     virtual void vsyncTick() OVERRIDE;
 
-    void updateResourcesComplete();
-
 private:
     CCScheduler(CCSchedulerClient*, PassOwnPtr<CCFrameRateController>);
 
@@ -120,7 +119,6 @@
     CCSchedulerClient* m_client;
     OwnPtr<CCFrameRateController> m_frameRateController;
     CCSchedulerStateMachine m_stateMachine;
-    bool m_hasMoreResourceUpdates;
     bool m_updateMoreResourcesPending;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdateController.cpp (127078 => 127079)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdateController.cpp	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdateController.cpp	2012-08-30 01:58:55 UTC (rev 127079)
@@ -113,9 +113,8 @@
         copier->flush();
 }
 
-CCTextureUpdateController::CCTextureUpdateController(CCTextureUpdateControllerClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
-    : m_client(client)
-    , m_timer(adoptPtr(new CCTimer(thread, this)))
+CCTextureUpdateController::CCTextureUpdateController(CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
+    : m_timer(adoptPtr(new CCTimer(thread, this)))
     , m_queue(queue)
     , m_resourceProvider(resourceProvider)
     , m_copier(copier)
@@ -129,40 +128,34 @@
 {
 }
 
+bool CCTextureUpdateController::hasMoreUpdates() const
+{
+    return m_queue->hasMoreUpdates();
+}
+
 void CCTextureUpdateController::updateMoreTextures(double monotonicTimeLimit)
 {
-    ASSERT(monotonicTimeLimit >= m_monotonicTimeLimit);
     m_monotonicTimeLimit = monotonicTimeLimit;
 
-    // Update already in progress.
-    if (m_timer->isActive())
+    if (!m_queue->hasMoreUpdates())
         return;
 
     // Call updateMoreTexturesNow() directly unless it's the first update
     // attempt. This ensures that we empty the update queue in a finite
     // amount of time.
     if (m_firstUpdateAttempt) {
-        // Post a 0-delay task when no updates were left. When it runs,
-        // updateTexturesCompleted() will be called.
-        if (!updateMoreTexturesIfEnoughTimeRemaining())
-            m_timer->startOneShot(0);
-
+        updateMoreTexturesIfEnoughTimeRemaining();
         m_firstUpdateAttempt = false;
     } else
         updateMoreTexturesNow();
 }
 
-void CCTextureUpdateController::discardUploads()
-{
-    // CCTextureUpdateControllerClient::updateTexturesCompleted will be
-    // called when all remaining texture copies are done.
-    m_queue->clearUploads();
-}
-
 void CCTextureUpdateController::onTimerFired()
 {
-    if (!updateMoreTexturesIfEnoughTimeRemaining())
-        m_client->updateTexturesCompleted();
+    if (!m_queue->hasMoreUpdates())
+        return;
+
+    updateMoreTexturesIfEnoughTimeRemaining();
 }
 
 double CCTextureUpdateController::monotonicTimeNow() const
@@ -180,16 +173,11 @@
     return textureUpdatesPerTick;
 }
 
-bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
+void CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
 {
-    if (!m_queue->hasMoreUpdates())
-        return false;
-
     bool hasTimeRemaining = monotonicTimeNow() < m_monotonicTimeLimit - updateMoreTexturesTime();
     if (hasTimeRemaining)
         updateMoreTexturesNow();
-
-    return true;
 }
 
 void CCTextureUpdateController::updateMoreTexturesNow()

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdateController.h (127078 => 127079)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdateController.h	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdateController.h	2012-08-30 01:58:55 UTC (rev 127079)
@@ -36,31 +36,21 @@
 class TextureCopier;
 class TextureUploader;
 
-class CCTextureUpdateControllerClient {
-public:
-    virtual void updateTexturesCompleted() = 0;
-
-protected:
-    virtual ~CCTextureUpdateControllerClient() { }
-};
-
 class CCTextureUpdateController : public CCTimerClient {
     WTF_MAKE_NONCOPYABLE(CCTextureUpdateController);
 public:
-    static PassOwnPtr<CCTextureUpdateController> create(CCTextureUpdateControllerClient* client, CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
+    static PassOwnPtr<CCTextureUpdateController> create(CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
     {
-        return adoptPtr(new CCTextureUpdateController(client, thread, queue, resourceProvider, copier, uploader));
+        return adoptPtr(new CCTextureUpdateController(thread, queue, resourceProvider, copier, uploader));
     }
     static size_t maxPartialTextureUpdates();
     static void updateTextures(CCResourceProvider*, TextureCopier*, TextureUploader*, CCTextureUpdateQueue*, size_t count);
 
     virtual ~CCTextureUpdateController();
 
+    bool hasMoreUpdates() const;
     void updateMoreTextures(double monotonicTimeLimit);
 
-    // Discard all remaining uploads.
-    void discardUploads();
-
     // CCTimerClient implementation.
     virtual void onTimerFired() OVERRIDE;
 
@@ -70,13 +60,11 @@
     virtual size_t updateMoreTexturesSize() const;
 
 protected:
-    CCTextureUpdateController(CCTextureUpdateControllerClient*, CCThread*, PassOwnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureCopier*, TextureUploader*);
+    CCTextureUpdateController(CCThread*, PassOwnPtr<CCTextureUpdateQueue>, CCResourceProvider*, TextureCopier*, TextureUploader*);
 
-    // This returns true when there were textures left to update.
-    bool updateMoreTexturesIfEnoughTimeRemaining();
+    void updateMoreTexturesIfEnoughTimeRemaining();
     void updateMoreTexturesNow();
 
-    CCTextureUpdateControllerClient* m_client;
     OwnPtr<CCTimer> m_timer;
     OwnPtr<CCTextureUpdateQueue> m_queue;
     bool m_contentsTexturesPurged;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (127078 => 127079)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-08-30 01:58:55 UTC (rev 127079)
@@ -34,6 +34,7 @@
 #include "CCLayerTreeHost.h"
 #include "CCScheduler.h"
 #include "CCScopedThreadProxy.h"
+#include "CCTextureUpdateController.h"
 #include "CCThreadTask.h"
 #include "TraceEvent.h"
 #include <public/WebSharedGraphicsContext3D.h>
@@ -313,8 +314,7 @@
 {
     ASSERT(isImplThread());
     TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread");
-    if (m_currentTextureUpdateControllerOnImplThread)
-        m_currentTextureUpdateControllerOnImplThread->discardUploads();
+    m_currentTextureUpdateControllerOnImplThread.clear();
     m_schedulerOnImplThread->didLoseContext();
 }
 
@@ -578,12 +578,10 @@
     } else
         m_resetContentsTexturesPurgedAfterCommitOnImplThread = true;
 
-    bool hasResourceUpdates = queue->hasMoreUpdates();
-    if (hasResourceUpdates)
-        m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(this, CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader());
+    m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader());
     m_commitCompletionEventOnImplThread = completion;
 
-    m_schedulerOnImplThread->beginFrameComplete(hasResourceUpdates);
+    m_schedulerOnImplThread->beginFrameComplete();
 }
 
 void CCThreadProxy::beginFrameAbortedOnImplThread()
@@ -596,6 +594,13 @@
     m_schedulerOnImplThread->beginFrameAborted();
 }
 
+bool CCThreadProxy::hasMoreResourceUpdates() const
+{
+    if (!m_currentTextureUpdateControllerOnImplThread)
+        return false;
+    return m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates();
+}
+
 bool CCThreadProxy::canDraw()
 {
     ASSERT(isImplThread());
@@ -615,6 +620,7 @@
 {
     TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit");
     ASSERT(isImplThread());
+    ASSERT(!hasMoreResourceUpdates());
     ASSERT(m_commitCompletionEventOnImplThread);
 
     m_currentTextureUpdateControllerOnImplThread.clear();
@@ -752,12 +758,6 @@
     return scheduledActionDrawAndSwapInternal(true);
 }
 
-void CCThreadProxy::updateTexturesCompleted()
-{
-    ASSERT(isImplThread());
-    m_schedulerOnImplThread->updateResourcesComplete();
-}
-
 void CCThreadProxy::didCommitAndDrawFrame()
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (127078 => 127079)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2012-08-30 01:58:55 UTC (rev 127079)
@@ -30,7 +30,6 @@
 #include "CCLayerTreeHostImpl.h"
 #include "CCProxy.h"
 #include "CCScheduler.h"
-#include "CCTextureUpdateController.h"
 #include <wtf/OwnPtr.h>
 
 namespace WebCore {
@@ -40,10 +39,11 @@
 class CCScheduler;
 class CCScopedThreadProxy;
 class CCTextureUpdateQueue;
+class CCTextureUpdateController;
 class CCThread;
 class CCThreadProxyContextRecreationTimer;
 
-class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClient, CCTextureUpdateControllerClient {
+class CCThreadProxy : public CCProxy, CCLayerTreeHostImplClient, CCSchedulerClient {
 public:
     static PassOwnPtr<CCProxy> create(CCLayerTreeHost*);
 
@@ -84,6 +84,7 @@
 
     // CCSchedulerClient implementation
     virtual bool canDraw() OVERRIDE;
+    virtual bool hasMoreResourceUpdates() const OVERRIDE;
     virtual void scheduledActionBeginFrame() OVERRIDE;
     virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE;
     virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced() OVERRIDE;
@@ -92,9 +93,6 @@
     virtual void scheduledActionBeginContextRecreation() OVERRIDE;
     virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE;
 
-    // CCTextureUpdateControllerClient implementation
-    virtual void updateTexturesCompleted() OVERRIDE;
-
 private:
     explicit CCThreadProxy(CCLayerTreeHost*);
     friend class CCThreadProxyContextRecreationTimer;

Modified: trunk/Source/WebKit/chromium/ChangeLog (127078 => 127079)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-30 01:58:55 UTC (rev 127079)
@@ -1,5 +1,19 @@
 2012-08-29  James Robinson  <[email protected]>
 
+        Unreviewed, rolling out r126956.
+        http://trac.webkit.org/changeset/126956
+        https://bugs.webkit.org/show_bug.cgi?id=94721
+
+        Breaks several unit tests
+
+        * tests/CCSchedulerTest.cpp:
+        (WebKitTests::FakeCCSchedulerClient::reset):
+        (WebKitTests::FakeCCSchedulerClient::setHasMoreResourceUpdates):
+        (WebKitTests::TEST):
+        * tests/CCTextureUpdateControllerTest.cpp:
+
+2012-08-29  James Robinson  <[email protected]>
+
         [chromium] Register/unregister contents layers with GraphicsLayerChromium
         https://bugs.webkit.org/show_bug.cgi?id=95379
 

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (127078 => 127079)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-08-30 01:58:55 UTC (rev 127079)
@@ -911,7 +911,7 @@
     int m_scrolls;
 };
 
-TEST_F(CCLayerTreeHostTestScrollSimple, DISABLED_runMultiThread)
+TEST_F(CCLayerTreeHostTestScrollSimple, runMultiThread)
 {
     runTest(true);
 }
@@ -991,7 +991,7 @@
     int m_scrolls;
 };
 
-TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, DISABLED_runMultiThread)
+TEST_F(CCLayerTreeHostTestScrollMultipleRedraw, runMultiThread)
 {
     runTest(true);
 }
@@ -2238,8 +2238,7 @@
     RefPtr<LayerChromium> m_rootScrollLayer;
 };
 
-// https://bugs.webkit.org/show_bug.cgi?id=95358
-TEST_F(CCLayerTreeHostTestScrollChildLayer, DISABLED_runMultiThread)
+TEST_F(CCLayerTreeHostTestScrollChildLayer, runMultiThread)
 {
     runTest(true);
 }

Modified: trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp (127078 => 127079)


--- trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebKit/chromium/tests/CCSchedulerTest.cpp	2012-08-30 01:58:55 UTC (rev 127079)
@@ -43,12 +43,14 @@
     void reset()
     {
         m_actions.clear();
+        m_hasMoreResourceUpdates = false;
         m_canDraw = true;
         m_drawWillHappen = true;
         m_swapWillHappenIfDrawHappens = true;
         m_numDraws = 0;
     }
 
+    void setHasMoreResourceUpdates(bool b) { m_hasMoreResourceUpdates = b; }
     void setCanDraw(bool b) { m_canDraw = b; }
 
     int numDraws() const { return m_numDraws; }
@@ -64,6 +66,7 @@
     }
 
     virtual bool canDraw() OVERRIDE { return m_canDraw; }
+    virtual bool hasMoreResourceUpdates() const OVERRIDE { return m_hasMoreResourceUpdates; }
     virtual void scheduledActionBeginFrame() OVERRIDE { m_actions.push_back("scheduledActionBeginFrame"); }
     virtual CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossible() OVERRIDE
     {
@@ -110,9 +113,9 @@
     EXPECT_FALSE(timeSource->active());
     client.reset();
 
-    // Since, hasResourceUpdates is false,
+    // Since, hasMoreResourceUpdates is set to false,
     // beginFrameComplete should commit
-    scheduler->beginFrameComplete(false);
+    scheduler->beginFrameComplete();
     EXPECT_EQ(1, client.numActions());
     EXPECT_STREQ("scheduledActionCommit", client.action(0));
     EXPECT_TRUE(timeSource->active());
@@ -146,9 +149,9 @@
     // Now setNeedsCommit again. Calling here means we need a second frame.
     scheduler->setNeedsCommit();
 
-    // Since, hasResourceUpdates is false, and another commit is
+    // Since, hasMoreResourceUpdates is set to false, and another commit is
     // needed, beginFrameComplete should commit, then begin another frame.
-    scheduler->beginFrameComplete(false);
+    scheduler->beginFrameComplete();
     EXPECT_EQ(1, client.numActions());
     EXPECT_STREQ("scheduledActionCommit", client.action(0));
     client.reset();
@@ -181,7 +184,7 @@
     EXPECT_FALSE(timeSource->active());
 
     // Trigger the commit
-    scheduler->beginFrameComplete(false);
+    scheduler->beginFrameComplete();
     EXPECT_TRUE(timeSource->active());
     client.reset();
 
@@ -209,7 +212,7 @@
     scheduler->setVisible(true);
 
     scheduler->setNeedsCommit();
-    scheduler->beginFrameComplete(false);
+    scheduler->beginFrameComplete();
     scheduler->setMainThreadNeedsLayerTextures();
     client.reset();
     // Verify that pending texture acquisition fires when visibility
@@ -378,7 +381,7 @@
     EXPECT_FALSE(timeSource->active());
     EXPECT_EQ(1, client.numDraws());
     EXPECT_TRUE(scheduler->commitPending());
-    scheduler->beginFrameComplete(false);
+    scheduler->beginFrameComplete();
 
     timeSource->tick();
     EXPECT_EQ(2, client.numDraws());

Modified: trunk/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp (127078 => 127079)


--- trunk/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp	2012-08-30 01:44:57 UTC (rev 127078)
+++ trunk/Source/WebKit/chromium/tests/CCTextureUpdateControllerTest.cpp	2012-08-30 01:58:55 UTC (rev 127079)
@@ -541,23 +541,11 @@
     EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads);
 }
 
-class FakeCCTextureUpdateControllerClient : public WebCore::CCTextureUpdateControllerClient {
-public:
-    FakeCCTextureUpdateControllerClient() { reset(); }
-    void reset() { m_completedCalled = false; }
-    bool completedCalled() const { return m_completedCalled; }
-
-    virtual void updateTexturesCompleted() OVERRIDE { m_completedCalled = true; }
-
-protected:
-    bool m_completedCalled;
-};
-
 class FakeCCTextureUpdateController : public WebCore::CCTextureUpdateController {
 public:
-    static PassOwnPtr<FakeCCTextureUpdateController> create(WebCore::CCTextureUpdateControllerClient* client, WebCore::CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
+    static PassOwnPtr<FakeCCTextureUpdateController> create(WebCore::CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
     {
-        return adoptPtr(new FakeCCTextureUpdateController(client, thread, queue, resourceProvider, copier, uploader));
+        return adoptPtr(new FakeCCTextureUpdateController(thread, queue, resourceProvider, copier, uploader));
     }
 
     void setMonotonicTimeNow(double time) { m_monotonicTimeNow = time; }
@@ -568,8 +556,8 @@
     virtual size_t updateMoreTexturesSize() const OVERRIDE { return m_updateMoreTexturesSize; }
 
 protected:
-    FakeCCTextureUpdateController(WebCore::CCTextureUpdateControllerClient* client, WebCore::CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
-        : WebCore::CCTextureUpdateController(client, thread, queue, resourceProvider, copier, uploader)
+    FakeCCTextureUpdateController(WebCore::CCThread* thread, PassOwnPtr<CCTextureUpdateQueue> queue, CCResourceProvider* resourceProvider, TextureCopier* copier, TextureUploader* uploader)
+        : WebCore::CCTextureUpdateController(thread, queue, resourceProvider, copier, uploader)
         , m_monotonicTimeNow(0)
         , m_updateMoreTexturesTime(0)
         , m_updateMoreTexturesSize(0) { }
@@ -579,17 +567,8 @@
     size_t m_updateMoreTexturesSize;
 };
 
-static void runPendingTasks(FakeCCThread* thread, FakeCCTextureUpdateController* controller)
-{
-    while (thread->hasPendingTask()) {
-        controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread->pendingDelayMs() / 1000.0);
-        thread->runPendingTask();
-    }
-}
-
 TEST_F(CCTextureUpdateControllerTest, UpdateMoreTextures)
 {
-    FakeCCTextureUpdateControllerClient client;
     FakeCCThread thread;
 
     setMaxUploadCountPerUpdate(1);
@@ -597,34 +576,39 @@
     appendPartialUploadsToUpdateQueue(0);
 
     DebugScopedSetImplThread implThread;
-    OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&client, &thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader));
+    OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader));
 
     controller->setMonotonicTimeNow(0);
     controller->setUpdateMoreTexturesTime(0.1);
     controller->setUpdateMoreTexturesSize(1);
     // Not enough time for any updates.
     controller->updateMoreTextures(0.09);
-    runPendingTasks(&thread, controller.get());
+    EXPECT_FALSE(thread.hasPendingTask());
     EXPECT_EQ(0, m_numBeginUploads);
     EXPECT_EQ(0, m_numEndUploads);
 
+    thread.reset();
     controller->setMonotonicTimeNow(0);
     controller->setUpdateMoreTexturesTime(0.1);
     controller->setUpdateMoreTexturesSize(1);
     // Only enough time for 1 update.
     controller->updateMoreTextures(0.12);
-    runPendingTasks(&thread, controller.get());
+    EXPECT_TRUE(thread.hasPendingTask());
+    controller->setMonotonicTimeNow(thread.pendingDelayMs() / 1000.0);
+    thread.runPendingTask();
     EXPECT_EQ(1, m_numBeginUploads);
     EXPECT_EQ(1, m_numEndUploads);
     EXPECT_EQ(1, m_numTotalUploads);
 
+    thread.reset();
     controller->setMonotonicTimeNow(0);
     controller->setUpdateMoreTexturesTime(0.1);
     controller->setUpdateMoreTexturesSize(1);
     // Enough time for 2 updates.
     controller->updateMoreTextures(0.22);
-    runPendingTasks(&thread, controller.get());
-    EXPECT_TRUE(client.completedCalled());
+    EXPECT_TRUE(thread.hasPendingTask());
+    controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0);
+    thread.runPendingTask();
     EXPECT_EQ(3, m_numBeginUploads);
     EXPECT_EQ(3, m_numEndUploads);
     EXPECT_EQ(3, m_numTotalUploads);
@@ -632,7 +616,6 @@
 
 TEST_F(CCTextureUpdateControllerTest, NoMoreUpdates)
 {
-    FakeCCTextureUpdateControllerClient client;
     FakeCCThread thread;
 
     setMaxUploadCountPerUpdate(1);
@@ -640,26 +623,30 @@
     appendPartialUploadsToUpdateQueue(0);
 
     DebugScopedSetImplThread implThread;
-    OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&client, &thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader));
+    OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader));
 
     controller->setMonotonicTimeNow(0);
     controller->setUpdateMoreTexturesTime(0.1);
     controller->setUpdateMoreTexturesSize(1);
     // Enough time for 3 updates but only 2 necessary.
     controller->updateMoreTextures(0.31);
-    runPendingTasks(&thread, controller.get());
-    EXPECT_TRUE(client.completedCalled());
+    EXPECT_TRUE(thread.hasPendingTask());
+    controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0);
+    thread.runPendingTask();
+    EXPECT_TRUE(thread.hasPendingTask());
+    controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0);
+    thread.runPendingTask();
     EXPECT_EQ(2, m_numBeginUploads);
     EXPECT_EQ(2, m_numEndUploads);
     EXPECT_EQ(2, m_numTotalUploads);
 
+    thread.reset();
     controller->setMonotonicTimeNow(0);
     controller->setUpdateMoreTexturesTime(0.1);
     controller->setUpdateMoreTexturesSize(1);
     // Enough time for updates but no more updates left.
     controller->updateMoreTextures(0.31);
-    runPendingTasks(&thread, controller.get());
-    EXPECT_TRUE(client.completedCalled());
+    EXPECT_FALSE(thread.hasPendingTask());
     EXPECT_EQ(2, m_numBeginUploads);
     EXPECT_EQ(2, m_numEndUploads);
     EXPECT_EQ(2, m_numTotalUploads);
@@ -667,7 +654,6 @@
 
 TEST_F(CCTextureUpdateControllerTest, UpdatesCompleteInFiniteTime)
 {
-    FakeCCTextureUpdateControllerClient client;
     FakeCCThread thread;
 
     setMaxUploadCountPerUpdate(1);
@@ -675,22 +661,25 @@
     appendPartialUploadsToUpdateQueue(0);
 
     DebugScopedSetImplThread implThread;
-    OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&client, &thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader));
+    OwnPtr<FakeCCTextureUpdateController> controller(FakeCCTextureUpdateController::create(&thread, m_queue.release(), m_resourceProvider.get(), &m_copier, &m_uploader));
 
     controller->setMonotonicTimeNow(0);
     controller->setUpdateMoreTexturesTime(0.5);
     controller->setUpdateMoreTexturesSize(1);
 
     for (int i = 0; i < 100; i++) {
-        if (client.completedCalled())
+        if (!controller->hasMoreUpdates())
             break;
 
         // Not enough time for any updates.
         controller->updateMoreTextures(0.4);
-        runPendingTasks(&thread, controller.get());
+
+        if (thread.hasPendingTask()) {
+            controller->setMonotonicTimeNow(controller->monotonicTimeNow() + thread.pendingDelayMs() / 1000.0);
+            thread.runPendingTask();
+        }
     }
 
-    EXPECT_TRUE(client.completedCalled());
     EXPECT_EQ(2, m_numBeginUploads);
     EXPECT_EQ(2, m_numEndUploads);
     EXPECT_EQ(2, m_numTotalUploads);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to