Changeset 95312 in webkit


Ignore:
Timestamp:
Sep 16, 2011 1:05:01 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r95309.
http://trac.webkit.org/changeset/95309
https://bugs.webkit.org/show_bug.cgi?id=68271

Broke many chromium gpu tests. (Requested by dave_levin on
#webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-09-16

Source/WebCore:

  • platform/graphics/chromium/ContentLayerChromium.cpp:

(WebCore::ContentLayerChromium::createTextureUpdater):

  • platform/graphics/chromium/LayerRendererChromium.cpp:

(WebCore::LayerRendererChromium::LayerRendererChromium):

  • platform/graphics/chromium/cc/CCLayerTreeHost.h:
  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
  • platform/graphics/chromium/cc/CCThreadProxy.cpp:

(WebCore::CCThreadProxy::context):
(WebCore::CCThreadProxy::beginFrameAndCommitOnCCThread):
(WebCore::CCThreadProxy::setNeedsCommitAndRedrawOnCCThread):
(WebCore::CCThreadProxy::setNeedsRedrawOnCCThread):

Source/WebKit/chromium:

  • tests/CCLayerTreeHostTest.cpp:

(WTF::CCLayerTreeHostTest::CCLayerTreeHostTest):
(WTF::CCLayerTreeHostTest::animateAndLayout):
(WTF::CCLayerTreeHostTest::beginCommitOnCCThread):
(WTF::CCLayerTreeHostTest::beginCommitOnMainThread):
(WTF::CCLayerTreeHostTest::commitOnCCThread):
(WTF::CCLayerTreeHostTest::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTest::commitCompleteOnMainThread):
(WTF::CCLayerTreeHostTest::drawLayersAndPresentOnCCThread):
(WTF::CCLayerTreeHostTest::updateLayers):
(WTF::CCLayerTreeHostTest::onBeginTest):
(WTF::CCLayerTreeHostTest::doEndTest):
(WTF::CCLayerTreeHostTest::onEndTest):
(WTF::CCLayerTreeHostTest::runTest):
(WTF::CCLayerTreeHostTest::testTimeout):
(WTF::MockLayerTreeHostClient::MockLayerTreeHostClient):
(WTF::MockLayerTreeHostClient::createLayerTreeHostContext3D):
(WTF::MockLayerTreeHostClient::animateAndLayout):
(WTF::MockLayerTreeHostClient::updateLayers):
(WTF::MockLayerTreeHostCommitter::create):
(WTF::MockLayerTreeHostCommitter::commit):
(WTF::MockLayerTreeHostCommitter::MockLayerTreeHostCommitter):
(WTF::MockLayerTreeHostImpl::create):
(WTF::MockLayerTreeHostImpl::beginCommit):
(WTF::MockLayerTreeHostImpl::commitComplete):
(WTF::MockLayerTreeHostImpl::drawLayersAndPresent):
(WTF::MockLayerTreeHostImpl::MockLayerTreeHostImpl):
(WTF::MockLayerTreeHostImplProxy::create):
(WTF::MockLayerTreeHostImplProxy::createLayerTreeHostImpl):
(WTF::MockLayerTreeHostImplProxy::MockLayerTreeHostImplProxy):
(WTF::MockLayerTreeHost::MockLayerTreeHost):
(WTF::MockLayerTreeHost::createLayerTreeHostImplProxy):
(WTF::MockLayerTreeHost::updateLayers):
(WTF::MockLayerTreeHost::createLayerTreeHostCommitter):
(WTF::MockLayerTreeHost::beginCommit):
(WTF::MockLayerTreeHost::commitComplete):
(WTF::CCLayerTreeHostTest::doBeginTest):
(WTF::CCLayerTreeHostTestShortlived2::beginTest):
(WTF::CCLayerTreeHostTestShortlived3::beginTest):
(WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::beginTest):
(WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::drawLayersAndPresentOnCCThread):
(WTF::CCLayerTreeHostTestSetNeedsCommit1::beginTest):
(WTF::CCLayerTreeHostTestSetNeedsCommit1::drawLayersAndPresentOnCCThread):
(WTF::CCLayerTreeHostTestSetNeedsCommit1::commitOnCCThread):
(WTF::CCLayerTreeHostTestSetNeedsCommit2::beginTest):
(WTF::CCLayerTreeHostTestSetNeedsCommit2::drawLayersAndPresentOnCCThread):
(WTF::CCLayerTreeHostTestSetNeedsCommit2::commitOnCCThread):
(WTF::CCLayerTreeHostTestSetNeedsRedraw::beginTest):
(WTF::CCLayerTreeHostTestSetNeedsRedraw::drawLayersAndPresentOnCCThread):
(WTF::CCLayerTreeHostTestSetNeedsRedraw::commitOnCCThread):

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r95310 r95312  
     12011-09-16  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r95309.
     4        http://trac.webkit.org/changeset/95309
     5        https://bugs.webkit.org/show_bug.cgi?id=68271
     6
     7        Broke many chromium gpu tests. (Requested by dave_levin on
     8        #webkit).
     9
     10        * platform/graphics/chromium/ContentLayerChromium.cpp:
     11        (WebCore::ContentLayerChromium::createTextureUpdater):
     12        * platform/graphics/chromium/LayerRendererChromium.cpp:
     13        (WebCore::LayerRendererChromium::LayerRendererChromium):
     14        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
     15        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
     16        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
     17        (WebCore::CCThreadProxy::context):
     18        (WebCore::CCThreadProxy::beginFrameAndCommitOnCCThread):
     19        (WebCore::CCThreadProxy::setNeedsCommitAndRedrawOnCCThread):
     20        (WebCore::CCThreadProxy::setNeedsRedrawOnCCThread):
     21
    1222011-09-16  Filip Pizlo  <fpizlo@apple.com>
    223
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp

    r95309 r95312  
    121121void ContentLayerChromium::createTextureUpdater(const CCLayerTreeHost* host)
    122122{
    123 #if !USE(THREADED_COMPOSITING)
    124123#if USE(SKIA)
    125124    // Note that host->skiaContext() will crash if called while in threaded
     
    131130    }
    132131#endif // SKIA
    133 #endif // !THREADED_COMPOSITING
    134132
    135133    m_textureUpdater = LayerTextureUpdaterBitmap::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r95309 r95312  
    149149    , m_offscreenFramebufferId(0)
    150150    , m_zoomAnimatorScale(1)
    151     , m_contentsTextureMemoryUseBytes(0)
    152151    , m_context(context)
    153152    , m_defaultRenderSurface(0)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

    r95309 r95312  
    100100    PassOwnPtr<CCThread> createCompositorThread();
    101101    PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D();
    102     virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl();
     102    PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl();
    103103    void didRecreateGraphicsContext(bool success);
    104104#if !USE(THREADED_COMPOSITING)
     
    155155protected:
    156156    CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&);
    157     bool initialize();
    158157
    159158private:
     
    165164    void updateCompositorResources(LayerChromium*, GraphicsContext3D*);
    166165    void clearPendingUpdate();
     166
     167    bool initialize();
    167168
    168169    bool m_animating;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r95309 r95312  
    4747    virtual ~CCLayerTreeHostImpl();
    4848
    49     // Virtual for testing
    5049    virtual void beginCommit();
    5150    virtual void commitComplete();
    52     virtual void drawLayers();
    5351
    5452    GraphicsContext3D* context();
     53
     54    void drawLayers();
    5555
    5656    void finishAllRendering();
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp

    r95309 r95312  
    8585GraphicsContext3D* CCThreadProxy::context()
    8686{
     87    ASSERT_NOT_REACHED();
    8788    return 0;
    8889}
     
    186187    TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0);
    187188    ASSERT(isImplThread());
    188     // TEMP HACK so we can exercise this code in unit tests.
    189     CCMainThread::postTask(createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, 0.0));
     189    ASSERT_NOT_REACHED();
     190    // FIXME: call beginFrameAndCommit on main thread
    190191}
    191192
     
    247248    ASSERT(isImplThread());
    248249    ASSERT(m_layerTreeHostImpl);
    249     // TEMP HACK so we can exercise this code in unit tests.
    250     CCMainThread::postTask(createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, 0.0));
     250    ASSERT_NOT_REACHED();
    251251}
    252252
     
    254254{
    255255    TRACE_EVENT("CCThreadProxy::setNeedsRedrawOnCCThread", this, 0);
    256     // TEMP HACK so we can exercise this code in unit tests.
    257     drawLayersOnCCThread();
     256    ASSERT_NOT_REACHED();
    258257}
    259258
     
    286285}
    287286
    288 } // namespace WebCore
     287}
  • trunk/Source/WebKit/chromium/ChangeLog

    r95309 r95312  
     12011-09-16  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r95309.
     4        http://trac.webkit.org/changeset/95309
     5        https://bugs.webkit.org/show_bug.cgi?id=68271
     6
     7        Broke many chromium gpu tests. (Requested by dave_levin on
     8        #webkit).
     9
     10        * tests/CCLayerTreeHostTest.cpp:
     11        (WTF::CCLayerTreeHostTest::CCLayerTreeHostTest):
     12        (WTF::CCLayerTreeHostTest::animateAndLayout):
     13        (WTF::CCLayerTreeHostTest::beginCommitOnCCThread):
     14        (WTF::CCLayerTreeHostTest::beginCommitOnMainThread):
     15        (WTF::CCLayerTreeHostTest::commitOnCCThread):
     16        (WTF::CCLayerTreeHostTest::commitCompleteOnCCThread):
     17        (WTF::CCLayerTreeHostTest::commitCompleteOnMainThread):
     18        (WTF::CCLayerTreeHostTest::drawLayersAndPresentOnCCThread):
     19        (WTF::CCLayerTreeHostTest::updateLayers):
     20        (WTF::CCLayerTreeHostTest::onBeginTest):
     21        (WTF::CCLayerTreeHostTest::doEndTest):
     22        (WTF::CCLayerTreeHostTest::onEndTest):
     23        (WTF::CCLayerTreeHostTest::runTest):
     24        (WTF::CCLayerTreeHostTest::testTimeout):
     25        (WTF::MockLayerTreeHostClient::MockLayerTreeHostClient):
     26        (WTF::MockLayerTreeHostClient::createLayerTreeHostContext3D):
     27        (WTF::MockLayerTreeHostClient::animateAndLayout):
     28        (WTF::MockLayerTreeHostClient::updateLayers):
     29        (WTF::MockLayerTreeHostCommitter::create):
     30        (WTF::MockLayerTreeHostCommitter::commit):
     31        (WTF::MockLayerTreeHostCommitter::MockLayerTreeHostCommitter):
     32        (WTF::MockLayerTreeHostImpl::create):
     33        (WTF::MockLayerTreeHostImpl::beginCommit):
     34        (WTF::MockLayerTreeHostImpl::commitComplete):
     35        (WTF::MockLayerTreeHostImpl::drawLayersAndPresent):
     36        (WTF::MockLayerTreeHostImpl::MockLayerTreeHostImpl):
     37        (WTF::MockLayerTreeHostImplProxy::create):
     38        (WTF::MockLayerTreeHostImplProxy::createLayerTreeHostImpl):
     39        (WTF::MockLayerTreeHostImplProxy::MockLayerTreeHostImplProxy):
     40        (WTF::MockLayerTreeHost::MockLayerTreeHost):
     41        (WTF::MockLayerTreeHost::createLayerTreeHostImplProxy):
     42        (WTF::MockLayerTreeHost::updateLayers):
     43        (WTF::MockLayerTreeHost::createLayerTreeHostCommitter):
     44        (WTF::MockLayerTreeHost::beginCommit):
     45        (WTF::MockLayerTreeHost::commitComplete):
     46        (WTF::CCLayerTreeHostTest::doBeginTest):
     47        (WTF::CCLayerTreeHostTestShortlived2::beginTest):
     48        (WTF::CCLayerTreeHostTestShortlived3::beginTest):
     49        (WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::beginTest):
     50        (WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::commitCompleteOnCCThread):
     51        (WTF::CCLayerTreeHostTestCommitingWithContinuousRedraw::drawLayersAndPresentOnCCThread):
     52        (WTF::CCLayerTreeHostTestSetNeedsCommit1::beginTest):
     53        (WTF::CCLayerTreeHostTestSetNeedsCommit1::drawLayersAndPresentOnCCThread):
     54        (WTF::CCLayerTreeHostTestSetNeedsCommit1::commitOnCCThread):
     55        (WTF::CCLayerTreeHostTestSetNeedsCommit2::beginTest):
     56        (WTF::CCLayerTreeHostTestSetNeedsCommit2::drawLayersAndPresentOnCCThread):
     57        (WTF::CCLayerTreeHostTestSetNeedsCommit2::commitOnCCThread):
     58        (WTF::CCLayerTreeHostTestSetNeedsRedraw::beginTest):
     59        (WTF::CCLayerTreeHostTestSetNeedsRedraw::drawLayersAndPresentOnCCThread):
     60        (WTF::CCLayerTreeHostTestSetNeedsRedraw::commitOnCCThread):
     61
    1622011-09-16  Iain Merrick  <husky@google.com>
    263
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r95309 r95312  
    2929#include "cc/CCLayerTreeHost.h"
    3030
    31 #include "CCThreadImpl.h"
    32 #include "GraphicsContext3DPrivate.h"
    33 #include "LayerChromium.h"
    34 #include "LayerPainterChromium.h"
    35 #include "MockWebGraphicsContext3D.h"
    36 #include "TextureManager.h"
     31#include "GraphicsContext3D.h"
    3732#include "cc/CCLayerTreeHostImpl.h"
    3833#include "cc/CCMainThreadTask.h"
     
    4439#include <wtf/Vector.h>
    4540
     41
    4642using namespace WebCore;
    47 using namespace WebKit;
    4843using namespace WTF;
    4944
    5045namespace {
    5146
    52 // Used by test stubs to notify the test when something interesting happens.
    53 class TestHooks {
    54 public:
    55     virtual void beginCommitOnCCThread(CCLayerTreeHostImpl*) { }
    56     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*) { }
    57     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*) { }
    58 };
    59 
    60 // Adapts CCLayerTreeHostImpl for test. Runs real code, then invokes test hooks.
    61 class MockLayerTreeHostImpl : public CCLayerTreeHostImpl {
    62 public:
    63     static PassOwnPtr<MockLayerTreeHostImpl> create(TestHooks* testHooks, const CCSettings& settings)
    64     {
    65         return adoptPtr(new MockLayerTreeHostImpl(testHooks, settings));
    66     }
    67 
    68     virtual void beginCommit()
    69     {
    70         CCLayerTreeHostImpl::beginCommit();
    71         m_testHooks->beginCommitOnCCThread(this);
    72     }
    73 
    74     virtual void commitComplete()
    75     {
    76         CCLayerTreeHostImpl::commitComplete();
    77         m_testHooks->commitCompleteOnCCThread(this);
    78     }
    79 
    80     virtual void drawLayers()
    81     {
    82         CCLayerTreeHostImpl::drawLayers();
    83         m_testHooks->drawLayersOnCCThread(this);
    84     }
    85 
    86 private:
    87     MockLayerTreeHostImpl(TestHooks* testHooks, const CCSettings& settings)
    88         : CCLayerTreeHostImpl(settings)
    89         , m_testHooks(testHooks)
    90     {
    91     }
    92 
    93     TestHooks* m_testHooks;
    94 };
    95 
    96 // Adapts CCLayerTreeHost for test. Injects MockLayerTreeHostImpl.
    97 class MockLayerTreeHost : public CCLayerTreeHost {
    98 public:
    99     static PassRefPtr<MockLayerTreeHost> create(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
    100     {
    101         return adoptRef(new MockLayerTreeHost(testHooks, client, rootLayer, settings));
    102     }
    103 
    104     virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl()
    105     {
    106         return MockLayerTreeHostImpl::create(m_testHooks, settings());
    107     }
    108 
    109 private:
    110     MockLayerTreeHost(TestHooks* testHooks, CCLayerTreeHostClient* client, PassRefPtr<LayerChromium> rootLayer, const CCSettings& settings)
    111         : CCLayerTreeHost(client, rootLayer, settings)
    112         , m_testHooks(testHooks)
    113     {
    114         bool success = initialize();
    115         ASSERT(success);
    116     }
    117 
    118     TestHooks* m_testHooks;
    119 };
    120 
    121 // Test stub for WebGraphicsContext3D. Returns canned values needed for compositor initialization.
    122 class CompositorMockWebGraphicsContext3D : public MockWebGraphicsContext3D {
    123 public:
    124     static PassOwnPtr<CompositorMockWebGraphicsContext3D> create()
    125     {
    126         return adoptPtr(new CompositorMockWebGraphicsContext3D());
    127     }
    128 
    129     virtual bool makeContextCurrent() { return true; }
    130     virtual WebGLId createProgram() { return 1; }
    131     virtual WebGLId createShader(WGC3Denum) { return 1; }
    132     virtual void getShaderiv(WebGLId, WGC3Denum, WGC3Dint* value) { *value = 1; }
    133     virtual void getProgramiv(WebGLId, WGC3Denum, WGC3Dint* value) { *value = 1; }
    134 
    135 private:
    136     CompositorMockWebGraphicsContext3D() { }
    137 };
    138 
    139 // Implementation of CCLayerTreeHost callback interface.
    140 class MockLayerTreeHostClient : public CCLayerTreeHostClient {
    141 public:
    142     static PassOwnPtr<MockLayerTreeHostClient> create(TestHooks* testHooks)
    143     {
    144         return adoptPtr(new MockLayerTreeHostClient(testHooks));
    145     }
    146 
    147     virtual void animateAndLayout(double frameBeginTime)
    148     {
    149     }
    150 
    151     virtual PassOwnPtr<CCThread> createCompositorThread()
    152     {
    153         return CCThreadImpl::create();
    154     }
    155 
    156     virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D()
    157     {
    158         OwnPtr<WebGraphicsContext3D> mock = CompositorMockWebGraphicsContext3D::create();
    159         GraphicsContext3D::Attributes attrs;
    160         RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(mock.release(), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnAnotherThread);
    161         return context;
    162     }
    163 
    164     virtual PassOwnPtr<LayerPainterChromium> createRootLayerPainter()
    165     {
    166         return nullptr;
    167     }
    168 
    169     virtual void didRecreateGraphicsContext(bool)
    170     {
    171     }
    172 
    173 private:
    174     explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { }
    175 
    176     TestHooks* m_testHooks;
    177 };
     47class MockLayerTreeHost;
     48class MockLayerTreeHostClient;
     49class MockLayerTreeHostImpl;
    17850
    17951// The CCLayerTreeHostTest runs with the main loop running. It instantiates a single MockLayerTreeHost and associated
     
    18759// The test continues until someone calls endTest. endTest can be called on any thread, but be aware that
    18860// ending the test is an asynchronous process.
    189 class CCLayerTreeHostTest : public testing::Test, TestHooks {
    190 public:
    191     virtual void afterTest() = 0;
    192     virtual void beginTest() = 0;
    193 
    194     void endTest();
    195 
    196     void postSetNeedsCommitToMainThread()
    197     {
    198         callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsCommit, this);
    199     }
    200 
    201     void postSetNeedsRedrawToMainThread()
    202     {
    203         callOnMainThread(CCLayerTreeHostTest::dispatchSetNeedsRedraw, this);
    204     }
    205 
    206 protected:
     61class CCLayerTreeHostTest : public testing::Test {
     62public:
    20763    CCLayerTreeHostTest()
    20864        : m_beginning(false)
     
    21167        , m_timedOut(false) { }
    21268
     69    virtual void afterTest() = 0;
     70
     71    virtual void beginTest() = 0;
     72    virtual void animateAndLayout(MockLayerTreeHostClient* layerTreeHost, double frameBeginTime) { }
     73    virtual void beginCommitOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl) { }
     74    virtual void beginCommitOnMainThread(MockLayerTreeHost* layerTreeHost) { }
     75    virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* layerTreeHostImpl) { }
     76    virtual void commitCompleteOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl) { }
     77    virtual void commitCompleteOnMainThread(MockLayerTreeHost* layerTreeHost) { }
     78    virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl) { }
     79    virtual void updateLayers(MockLayerTreeHost* layerTreeHost) { }
     80
     81    void endTest();
     82
     83protected:
    21384    void doBeginTest();
    21485
     
    21889    }
    21990
     91    void doEndTest()
     92    {
     93    }
     94
    22095    static void onEndTest(void* self)
    22196    {
    22297        ASSERT(isMainThread());
     98        CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
     99        test->m_layerTreeHost.clear();
     100        test->m_client.clear();
    223101        webkit_support::QuitMessageLoop();
    224         CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
    225         ASSERT(test);
    226         test->m_layerTreeHost.clear();
    227     }
    228 
    229     static void dispatchSetNeedsCommit(void* self)
    230     {
    231       ASSERT(isMainThread());
    232       CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
    233       ASSERT(test);
    234       if (test->m_layerTreeHost)
    235           test->m_layerTreeHost->setNeedsCommitAndRedraw();
    236     }
    237 
    238     static void dispatchSetNeedsRedraw(void* self)
    239     {
    240       ASSERT(isMainThread());
    241       CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
    242       ASSERT(test);
    243       if (test->m_layerTreeHost)
    244           test->m_layerTreeHost->setNeedsRedraw();
    245102    }
    246103
     
    253110        bool timedOut = m_timedOut; // Save whether we're timed out in case RunAllPendingMessages has the timeout.
    254111        webkit_support::RunAllPendingMessages();
    255         ASSERT(!m_layerTreeHost.get());
    256         m_client.clear();
    257112        if (timedOut) {
     113            printf("Test timed out");
    258114            FAIL() << "Test timed out";
    259115            return;
     
    271127    }
    272128
     129    Mutex m_tracesLock;
     130    Vector<std::string> m_traces;
     131
    273132    OwnPtr<MockLayerTreeHostClient> m_client;
    274     RefPtr<CCLayerTreeHost> m_layerTreeHost;
     133    RefPtr<MockLayerTreeHost> m_layerTreeHost;
    275134
    276135private:
     
    281140};
    282141
     142class MockLayerTreeHostClient : public CCLayerTreeHostClient {
     143public:
     144    MockLayerTreeHostClient(CCLayerTreeHostTest* test) : m_test(test) { }
     145
     146    virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D()
     147    {
     148        return adoptRef<GraphicsContext3D>(0);
     149    }
     150
     151    virtual void animateAndLayout(double frameBeginTime)
     152    {
     153        m_test->animateAndLayout(this, frameBeginTime);
     154    }
     155
     156    virtual void updateLayers()
     157    {
     158    }
     159
     160private:
     161    CCLayerTreeHostTest* m_test;
     162};
     163
     164class MockLayerTreeHostCommitter : public CCLayerTreeHostCommitter {
     165public:
     166    static PassOwnPtr<MockLayerTreeHostCommitter> create(CCLayerTreeHostTest* test)
     167    {
     168        return adoptPtr(new MockLayerTreeHostCommitter(test));
     169    }
     170
     171    virtual void commit(CCLayerTreeHost* host, CCLayerTreeHostImpl* hostImpl)
     172    {
     173        CCLayerTreeHostCommitter::commit(host, hostImpl);
     174        m_test->commitOnCCThread(reinterpret_cast<MockLayerTreeHost*>(host), reinterpret_cast<MockLayerTreeHostImpl*>(hostImpl));
     175    }
     176
     177private:
     178    MockLayerTreeHostCommitter(CCLayerTreeHostTest* test) : m_test(test) { }
     179    CCLayerTreeHostTest* m_test;
     180};
     181
     182class MockLayerTreeHostImpl : public CCLayerTreeHostImpl {
     183public:
     184    static PassOwnPtr<MockLayerTreeHostImpl> create(CCLayerTreeHostImplClient* client, CCLayerTreeHostTest* test)
     185    {
     186        return adoptPtr(new MockLayerTreeHostImpl(client, test));
     187    }
     188
     189    virtual void beginCommit()
     190    {
     191        CCLayerTreeHostImpl::beginCommit();
     192        m_test->beginCommitOnCCThread(this);
     193    }
     194
     195    virtual void commitComplete()
     196    {
     197        CCLayerTreeHostImpl::commitComplete();
     198        m_test->commitCompleteOnCCThread(this);
     199    }
     200
     201    virtual void drawLayersAndPresent()
     202    {
     203        m_test->drawLayersAndPresentOnCCThread(this);
     204    }
     205
     206private:
     207    MockLayerTreeHostImpl(CCLayerTreeHostImplClient* client, CCLayerTreeHostTest* test)
     208            : CCLayerTreeHostImpl(client)
     209            , m_test(test)
     210    {
     211    }
     212
     213    CCLayerTreeHostTest* m_test;
     214};
     215
     216class MockLayerTreeHostImplProxy : public CCLayerTreeHostImplProxy {
     217public:
     218    static PassOwnPtr<MockLayerTreeHostImplProxy> create(CCLayerTreeHost* host, CCLayerTreeHostTest* test)
     219    {
     220        return adoptPtr(new MockLayerTreeHostImplProxy(host, test));
     221    }
     222
     223    PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl()
     224    {
     225        return MockLayerTreeHostImpl::create(this, m_test);
     226    }
     227
     228private:
     229    MockLayerTreeHostImplProxy(CCLayerTreeHost* host, CCLayerTreeHostTest* test)
     230        : CCLayerTreeHostImplProxy(host)
     231        , m_test(test) { }
     232
     233    CCLayerTreeHostTest* m_test;
     234};
     235
     236class MockLayerTreeHost : public CCLayerTreeHost {
     237public:
     238    MockLayerTreeHost(CCLayerTreeHostClient* client, CCLayerTreeHostTest* test)
     239        : CCLayerTreeHost(client)
     240        , m_test(test) { }
     241
     242    virtual PassOwnPtr<CCLayerTreeHostImplProxy> createLayerTreeHostImplProxy()
     243    {
     244        OwnPtr<CCLayerTreeHostImplProxy> proxy = MockLayerTreeHostImplProxy::create(this, m_test);
     245        proxy->start();
     246        return proxy.release();
     247    }
     248
     249    virtual void updateLayers()
     250    {
     251        m_test->updateLayers(this);
     252    }
     253
     254    virtual PassOwnPtr<CCLayerTreeHostCommitter> createLayerTreeHostCommitter()
     255    {
     256        return MockLayerTreeHostCommitter::create(m_test);
     257    }
     258
     259    virtual void beginCommit()
     260    {
     261        CCLayerTreeHost::beginCommit();
     262        m_test->beginCommitOnMainThread(this);
     263    }
     264
     265    virtual void commitComplete()
     266    {
     267        m_test->commitCompleteOnMainThread(this);
     268        CCLayerTreeHost::commitComplete();
     269    }
     270
     271private:
     272    CCLayerTreeHostTest* m_test;
     273};
     274
    283275void CCLayerTreeHostTest::doBeginTest()
    284276{
    285     ASSERT(isMainThread());
    286277    ASSERT(!m_running);
    287278    m_running = true;
    288     m_client = MockLayerTreeHostClient::create(this);
    289 
    290     CCSettings settings;
    291     settings.enableCompositorThread = true;
    292     RefPtr<LayerChromium> rootLayer;
    293     m_layerTreeHost = MockLayerTreeHost::create(this, m_client.get(), rootLayer, settings);
    294     ASSERT(m_layerTreeHost);
    295 
     279    m_client = adoptPtr(new MockLayerTreeHostClient(this));
     280    m_layerTreeHost = adoptRef(new MockLayerTreeHost(m_client.get(), this));
     281    m_layerTreeHost->init();
    296282    m_beginning = true;
    297283    beginTest();
     
    342328    virtual void beginTest()
    343329    {
    344         postSetNeedsCommitToMainThread();
     330        m_layerTreeHost->setNeedsCommitAndRedraw();
    345331        endTest();
    346332    }
     
    362348    virtual void beginTest()
    363349    {
    364         postSetNeedsRedrawToMainThread();
     350        m_layerTreeHost->setNeedsRedraw();
    365351        endTest();
    366352    }
     
    386372    virtual void beginTest()
    387373    {
    388         postSetNeedsCommitToMainThread();
     374        m_layerTreeHost->setNeedsCommitAndRedraw();
    389375        endTest();
    390376    }
    391377
    392     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
     378    virtual void commitCompleteOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl)
    393379    {
    394380        m_numCompleteCommits++;
     
    397383    }
    398384
    399     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl*)
     385    virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl)
    400386    {
    401387        if (m_numDraws == 1)
    402           postSetNeedsCommitToMainThread();
     388            layerTreeHostImpl->setNeedsCommitAndRedraw();
    403389        m_numDraws++;
    404         postSetNeedsRedrawToMainThread();
     390        layerTreeHostImpl->setNeedsRedraw();
    405391    }
    406392
     
    430416    virtual void beginTest()
    431417    {
    432         postSetNeedsCommitToMainThread();
    433         postSetNeedsCommitToMainThread();
    434     }
    435 
    436     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
     418        m_layerTreeHost->setNeedsCommitAndRedraw();
     419        m_layerTreeHost->setNeedsCommitAndRedraw();
     420    }
     421
     422    virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl)
    437423    {
    438424        m_numDraws++;
    439         if (!impl->sourceFrameNumber())
     425        if (!layerTreeHostImpl->sourceFrameNumber())
    440426            endTest();
    441427    }
    442428
    443     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
     429    virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* impl)
    444430    {
    445431        m_numCommits++;
     
    473459    virtual void beginTest()
    474460    {
    475         postSetNeedsCommitToMainThread();
    476     }
    477 
    478     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
    479     {
    480         if (!impl->sourceFrameNumber())
    481             postSetNeedsCommitToMainThread();
    482         else if (impl->sourceFrameNumber() == 1)
     461        m_layerTreeHost->setNeedsCommitAndRedraw();
     462    }
     463
     464    virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl)
     465    {
     466        if (!layerTreeHostImpl->sourceFrameNumber())
     467            layerTreeHostImpl->setNeedsCommitAndRedraw();
     468        else if (layerTreeHostImpl->sourceFrameNumber() == 1)
    483469            endTest();
    484470    }
    485471
    486     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
     472    virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* impl)
    487473    {
    488474        m_numCommits++;
     
    516502    virtual void beginTest()
    517503    {
    518         postSetNeedsCommitToMainThread();
    519     }
    520 
    521     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
     504    }
     505
     506    virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* impl)
    522507    {
    523508        EXPECT_EQ(0, impl->sourceFrameNumber());
    524509        if (!m_numDraws)
    525             postSetNeedsRedrawToMainThread(); // Redraw again to verify that the second redraw doesn't commit.
     510            impl->setNeedsRedraw(); // redraw again to verify that the second redraw doesnt commit.
    526511        else
    527512            endTest();
     
    529514    }
    530515
    531     virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl*)
     516    virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* impl)
    532517    {
    533518        m_numCommits++;
Note: See TracChangeset for help on using the changeset viewer.