| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CCThreadedTest_h | 5 #ifndef CCThreadedTest_h |
| 6 #define CCThreadedTest_h | 6 #define CCThreadedTest_h |
| 7 | 7 |
| 8 #include "CCLayerTreeHost.h" | 8 #include "CCLayerTreeHost.h" |
| 9 #include "CCLayerTreeHostImpl.h" | 9 #include "CCLayerTreeHostImpl.h" |
| 10 #include "CCScopedThreadProxy.h" | 10 #include "CCScopedThreadProxy.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Implementation of WebAnimationDelegate | 44 // Implementation of WebAnimationDelegate |
| 45 virtual void notifyAnimationStarted(double time) OVERRIDE { } | 45 virtual void notifyAnimationStarted(double time) OVERRIDE { } |
| 46 virtual void notifyAnimationFinished(double time) OVERRIDE { } | 46 virtual void notifyAnimationFinished(double time) OVERRIDE { } |
| 47 | 47 |
| 48 virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface()
; | 48 virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface()
; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class TimeoutTask; | 51 class TimeoutTask; |
| 52 class BeginTask; | 52 class BeginTask; |
| 53 class EndTestTask; | |
| 54 | 53 |
| 55 class MockCCLayerTreeHostClient : public WebCore::CCLayerTreeHostClient { | 54 class MockCCLayerTreeHostClient : public WebCore::CCLayerTreeHostClient { |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 // The CCThreadedTests runs with the main loop running. It instantiates a single
MockLayerTreeHost and associated | 57 // The CCThreadedTests runs with the main loop running. It instantiates a single
MockLayerTreeHost and associated |
| 59 // MockLayerTreeHostImpl/MockLayerTreeHostClient. | 58 // MockLayerTreeHostImpl/MockLayerTreeHostClient. |
| 60 // | 59 // |
| 61 // beginTest() is called once the main message loop is running and the layer tre
e host is initialized. | 60 // beginTest() is called once the main message loop is running and the layer tre
e host is initialized. |
| 62 // | 61 // |
| 63 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to CCThre
adedTest methods of similar names. | 62 // Key stages of the drawing loop, e.g. drawing or commiting, redirect to CCThre
adedTest methods of similar names. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 void postAcquireLayerTextures(); | 79 void postAcquireLayerTextures(); |
| 81 void postSetNeedsRedrawToMainThread(); | 80 void postSetNeedsRedrawToMainThread(); |
| 82 void postSetNeedsAnimateAndCommitToMainThread(); | 81 void postSetNeedsAnimateAndCommitToMainThread(); |
| 83 void postSetVisibleToMainThread(bool visible); | 82 void postSetVisibleToMainThread(bool visible); |
| 84 void postDidAddAnimationToMainThread(); | 83 void postDidAddAnimationToMainThread(); |
| 85 | 84 |
| 86 void doBeginTest(); | 85 void doBeginTest(); |
| 87 void timeout(); | 86 void timeout(); |
| 88 | 87 |
| 89 void clearTimeout() { m_timeoutTask = 0; } | 88 void clearTimeout() { m_timeoutTask = 0; } |
| 90 void clearEndTestTask() { m_endTestTask = 0; } | |
| 91 | 89 |
| 92 WebCore::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } | 90 WebCore::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } |
| 93 | 91 |
| 94 protected: | 92 protected: |
| 95 CCThreadedTest(); | 93 CCThreadedTest(); |
| 96 | 94 |
| 97 virtual void initializeSettings(WebCore::CCLayerTreeSettings&) { } | 95 virtual void initializeSettings(WebCore::CCLayerTreeSettings&) { } |
| 98 | 96 |
| 99 virtual void scheduleComposite(); | 97 virtual void scheduleComposite(); |
| 100 | 98 |
| 101 static void onEndTest(void* self); | 99 void realEndTest(); |
| 102 | 100 |
| 103 static void dispatchSetNeedsAnimate(void* self); | 101 void dispatchSetNeedsAnimate(); |
| 104 static void dispatchAddInstantAnimation(void* self); | 102 void dispatchAddInstantAnimation(); |
| 105 static void dispatchAddAnimation(void* self); | 103 void dispatchAddAnimation(); |
| 106 static void dispatchSetNeedsAnimateAndCommit(void* self); | 104 void dispatchSetNeedsAnimateAndCommit(); |
| 107 static void dispatchSetNeedsCommit(void* self); | 105 void dispatchSetNeedsCommit(); |
| 108 static void dispatchAcquireLayerTextures(void* self); | 106 void dispatchAcquireLayerTextures(); |
| 109 static void dispatchSetNeedsRedraw(void* self); | 107 void dispatchSetNeedsRedraw(); |
| 110 static void dispatchSetVisible(void* self); | 108 void dispatchSetVisible(bool); |
| 111 static void dispatchSetInvisible(void* self); | 109 void dispatchComposite(); |
| 112 static void dispatchComposite(void* self); | 110 void dispatchDidAddAnimation(); |
| 113 static void dispatchDidAddAnimation(void* self); | |
| 114 | 111 |
| 115 virtual void runTest(bool threaded); | 112 virtual void runTest(bool threaded); |
| 116 WebKit::WebThread* webThread() const { return m_webThread.get(); } | 113 WebKit::WebThread* webThread() const { return m_webThread.get(); } |
| 117 | 114 |
| 118 WebCore::CCLayerTreeSettings m_settings; | 115 WebCore::CCLayerTreeSettings m_settings; |
| 119 OwnPtr<MockCCLayerTreeHostClient> m_client; | 116 OwnPtr<MockCCLayerTreeHostClient> m_client; |
| 120 OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; | 117 OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; |
| 121 | 118 |
| 119 protected: |
| 120 RefPtr<WebCore::CCScopedThreadProxy> m_mainThreadProxy; |
| 121 |
| 122 private: | 122 private: |
| 123 bool m_beginning; | 123 bool m_beginning; |
| 124 bool m_endWhenBeginReturns; | 124 bool m_endWhenBeginReturns; |
| 125 bool m_timedOut; | 125 bool m_timedOut; |
| 126 bool m_finished; | 126 bool m_finished; |
| 127 bool m_scheduled; | 127 bool m_scheduled; |
| 128 bool m_started; | 128 bool m_started; |
| 129 | 129 |
| 130 OwnPtr<WebKit::WebThread> m_webThread; | 130 OwnPtr<WebKit::WebThread> m_webThread; |
| 131 RefPtr<WebCore::CCScopedThreadProxy> m_mainThreadProxy; | |
| 132 TimeoutTask* m_timeoutTask; | 131 TimeoutTask* m_timeoutTask; |
| 133 BeginTask* m_beginTask; | 132 BeginTask* m_beginTask; |
| 134 EndTestTask* m_endTestTask; | |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 class CCThreadedTestThreadOnly : public CCThreadedTest { | 135 class CCThreadedTestThreadOnly : public CCThreadedTest { |
| 138 public: | 136 public: |
| 139 void runTestThreaded() | 137 void runTestThreaded() |
| 140 { | 138 { |
| 141 CCThreadedTest::runTest(true); | 139 CCThreadedTest::runTest(true); |
| 142 } | 140 } |
| 143 }; | 141 }; |
| 144 | 142 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \ | 195 TEST_F(TEST_FIXTURE_NAME, runSingleThread) \ |
| 198 { \ | 196 { \ |
| 199 runTest(false); \ | 197 runTest(false); \ |
| 200 } \ | 198 } \ |
| 201 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ | 199 TEST_F(TEST_FIXTURE_NAME, runMultiThread) \ |
| 202 { \ | 200 { \ |
| 203 runTest(true); \ | 201 runTest(true); \ |
| 204 } | 202 } |
| 205 | 203 |
| 206 #endif // CCThreadedTest_h | 204 #endif // CCThreadedTest_h |
| OLD | NEW |