Changeset 95312 in webkit
- Timestamp:
- Sep 16, 2011 1:05:01 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95310 r95312 1 2011-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 1 22 2011-09-16 Filip Pizlo <fpizlo@apple.com> 2 23 -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r95309 r95312 121 121 void ContentLayerChromium::createTextureUpdater(const CCLayerTreeHost* host) 122 122 { 123 #if !USE(THREADED_COMPOSITING)124 123 #if USE(SKIA) 125 124 // Note that host->skiaContext() will crash if called while in threaded … … 131 130 } 132 131 #endif // SKIA 133 #endif // !THREADED_COMPOSITING134 132 135 133 m_textureUpdater = LayerTextureUpdaterBitmap::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r95309 r95312 149 149 , m_offscreenFramebufferId(0) 150 150 , m_zoomAnimatorScale(1) 151 , m_contentsTextureMemoryUseBytes(0)152 151 , m_context(context) 153 152 , m_defaultRenderSurface(0) -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r95309 r95312 100 100 PassOwnPtr<CCThread> createCompositorThread(); 101 101 PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D(); 102 virtualPassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl();102 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(); 103 103 void didRecreateGraphicsContext(bool success); 104 104 #if !USE(THREADED_COMPOSITING) … … 155 155 protected: 156 156 CCLayerTreeHost(CCLayerTreeHostClient*, PassRefPtr<LayerChromium> rootLayer, const CCSettings&); 157 bool initialize();158 157 159 158 private: … … 165 164 void updateCompositorResources(LayerChromium*, GraphicsContext3D*); 166 165 void clearPendingUpdate(); 166 167 bool initialize(); 167 168 168 169 bool m_animating; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r95309 r95312 47 47 virtual ~CCLayerTreeHostImpl(); 48 48 49 // Virtual for testing50 49 virtual void beginCommit(); 51 50 virtual void commitComplete(); 52 virtual void drawLayers();53 51 54 52 GraphicsContext3D* context(); 53 54 void drawLayers(); 55 55 56 56 void finishAllRendering(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r95309 r95312 85 85 GraphicsContext3D* CCThreadProxy::context() 86 86 { 87 ASSERT_NOT_REACHED(); 87 88 return 0; 88 89 } … … 186 187 TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0); 187 188 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 190 191 } 191 192 … … 247 248 ASSERT(isImplThread()); 248 249 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(); 251 251 } 252 252 … … 254 254 { 255 255 TRACE_EVENT("CCThreadProxy::setNeedsRedrawOnCCThread", this, 0); 256 // TEMP HACK so we can exercise this code in unit tests. 257 drawLayersOnCCThread(); 256 ASSERT_NOT_REACHED(); 258 257 } 259 258 … … 286 285 } 287 286 288 } // namespace WebCore287 } -
trunk/Source/WebKit/chromium/ChangeLog
r95309 r95312 1 2011-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 1 62 2011-09-16 Iain Merrick <husky@google.com> 2 63 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r95309 r95312 29 29 #include "cc/CCLayerTreeHost.h" 30 30 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" 37 32 #include "cc/CCLayerTreeHostImpl.h" 38 33 #include "cc/CCMainThreadTask.h" … … 44 39 #include <wtf/Vector.h> 45 40 41 46 42 using namespace WebCore; 47 using namespace WebKit;48 43 using namespace WTF; 49 44 50 45 namespace { 51 46 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 }; 47 class MockLayerTreeHost; 48 class MockLayerTreeHostClient; 49 class MockLayerTreeHostImpl; 178 50 179 51 // The CCLayerTreeHostTest runs with the main loop running. It instantiates a single MockLayerTreeHost and associated … … 187 59 // The test continues until someone calls endTest. endTest can be called on any thread, but be aware that 188 60 // 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: 61 class CCLayerTreeHostTest : public testing::Test { 62 public: 207 63 CCLayerTreeHostTest() 208 64 : m_beginning(false) … … 211 67 , m_timedOut(false) { } 212 68 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 83 protected: 213 84 void doBeginTest(); 214 85 … … 218 89 } 219 90 91 void doEndTest() 92 { 93 } 94 220 95 static void onEndTest(void* self) 221 96 { 222 97 ASSERT(isMainThread()); 98 CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self); 99 test->m_layerTreeHost.clear(); 100 test->m_client.clear(); 223 101 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();245 102 } 246 103 … … 253 110 bool timedOut = m_timedOut; // Save whether we're timed out in case RunAllPendingMessages has the timeout. 254 111 webkit_support::RunAllPendingMessages(); 255 ASSERT(!m_layerTreeHost.get());256 m_client.clear();257 112 if (timedOut) { 113 printf("Test timed out"); 258 114 FAIL() << "Test timed out"; 259 115 return; … … 271 127 } 272 128 129 Mutex m_tracesLock; 130 Vector<std::string> m_traces; 131 273 132 OwnPtr<MockLayerTreeHostClient> m_client; 274 RefPtr< CCLayerTreeHost> m_layerTreeHost;133 RefPtr<MockLayerTreeHost> m_layerTreeHost; 275 134 276 135 private: … … 281 140 }; 282 141 142 class MockLayerTreeHostClient : public CCLayerTreeHostClient { 143 public: 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 160 private: 161 CCLayerTreeHostTest* m_test; 162 }; 163 164 class MockLayerTreeHostCommitter : public CCLayerTreeHostCommitter { 165 public: 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 177 private: 178 MockLayerTreeHostCommitter(CCLayerTreeHostTest* test) : m_test(test) { } 179 CCLayerTreeHostTest* m_test; 180 }; 181 182 class MockLayerTreeHostImpl : public CCLayerTreeHostImpl { 183 public: 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 206 private: 207 MockLayerTreeHostImpl(CCLayerTreeHostImplClient* client, CCLayerTreeHostTest* test) 208 : CCLayerTreeHostImpl(client) 209 , m_test(test) 210 { 211 } 212 213 CCLayerTreeHostTest* m_test; 214 }; 215 216 class MockLayerTreeHostImplProxy : public CCLayerTreeHostImplProxy { 217 public: 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 228 private: 229 MockLayerTreeHostImplProxy(CCLayerTreeHost* host, CCLayerTreeHostTest* test) 230 : CCLayerTreeHostImplProxy(host) 231 , m_test(test) { } 232 233 CCLayerTreeHostTest* m_test; 234 }; 235 236 class MockLayerTreeHost : public CCLayerTreeHost { 237 public: 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 271 private: 272 CCLayerTreeHostTest* m_test; 273 }; 274 283 275 void CCLayerTreeHostTest::doBeginTest() 284 276 { 285 ASSERT(isMainThread());286 277 ASSERT(!m_running); 287 278 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(); 296 282 m_beginning = true; 297 283 beginTest(); … … 342 328 virtual void beginTest() 343 329 { 344 postSetNeedsCommitToMainThread();330 m_layerTreeHost->setNeedsCommitAndRedraw(); 345 331 endTest(); 346 332 } … … 362 348 virtual void beginTest() 363 349 { 364 postSetNeedsRedrawToMainThread();350 m_layerTreeHost->setNeedsRedraw(); 365 351 endTest(); 366 352 } … … 386 372 virtual void beginTest() 387 373 { 388 postSetNeedsCommitToMainThread();374 m_layerTreeHost->setNeedsCommitAndRedraw(); 389 375 endTest(); 390 376 } 391 377 392 virtual void commitCompleteOnCCThread( CCLayerTreeHostImpl*)378 virtual void commitCompleteOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl) 393 379 { 394 380 m_numCompleteCommits++; … … 397 383 } 398 384 399 virtual void drawLayers OnCCThread(CCLayerTreeHostImpl*)385 virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl) 400 386 { 401 387 if (m_numDraws == 1) 402 postSetNeedsCommitToMainThread();388 layerTreeHostImpl->setNeedsCommitAndRedraw(); 403 389 m_numDraws++; 404 postSetNeedsRedrawToMainThread();390 layerTreeHostImpl->setNeedsRedraw(); 405 391 } 406 392 … … 430 416 virtual void beginTest() 431 417 { 432 postSetNeedsCommitToMainThread();433 postSetNeedsCommitToMainThread();434 } 435 436 virtual void drawLayers OnCCThread(CCLayerTreeHostImpl* impl)418 m_layerTreeHost->setNeedsCommitAndRedraw(); 419 m_layerTreeHost->setNeedsCommitAndRedraw(); 420 } 421 422 virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* layerTreeHostImpl) 437 423 { 438 424 m_numDraws++; 439 if (! impl->sourceFrameNumber())425 if (!layerTreeHostImpl->sourceFrameNumber()) 440 426 endTest(); 441 427 } 442 428 443 virtual void commit CompleteOnCCThread(CCLayerTreeHostImpl*)429 virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* impl) 444 430 { 445 431 m_numCommits++; … … 473 459 virtual void beginTest() 474 460 { 475 postSetNeedsCommitToMainThread();476 } 477 478 virtual void drawLayers OnCCThread(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) 483 469 endTest(); 484 470 } 485 471 486 virtual void commit CompleteOnCCThread(CCLayerTreeHostImpl*)472 virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* impl) 487 473 { 488 474 m_numCommits++; … … 516 502 virtual void beginTest() 517 503 { 518 postSetNeedsCommitToMainThread(); 519 } 520 521 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) 504 } 505 506 virtual void drawLayersAndPresentOnCCThread(MockLayerTreeHostImpl* impl) 522 507 { 523 508 EXPECT_EQ(0, impl->sourceFrameNumber()); 524 509 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. 526 511 else 527 512 endTest(); … … 529 514 } 530 515 531 virtual void commit CompleteOnCCThread(CCLayerTreeHostImpl*)516 virtual void commitOnCCThread(MockLayerTreeHost* layerTreeHost, MockLayerTreeHostImpl* impl) 532 517 { 533 518 m_numCommits++;
Note: See TracChangeset
for help on using the changeset viewer.