| 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 #include "cc/test/layer_tree_test.h" | 5 #include "cc/test/layer_tree_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 main_task_runner, | 74 main_task_runner, |
| 75 impl_task_runner, | 75 impl_task_runner, |
| 76 external_begin_frame_source.Pass())); | 76 external_begin_frame_source.Pass())); |
| 77 } | 77 } |
| 78 | 78 |
| 79 ~ThreadProxyForTest() override {} | 79 ~ThreadProxyForTest() override {} |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 TestHooks* test_hooks_; | 82 TestHooks* test_hooks_; |
| 83 | 83 |
| 84 void WillBeginImplFrame(const BeginFrameArgs& args) override { | |
| 85 ThreadProxy::WillBeginImplFrame(args); | |
| 86 test_hooks_->WillBeginImplFrame(args); | |
| 87 } | |
| 88 | |
| 89 void ScheduledActionSendBeginMainFrame() override { | 84 void ScheduledActionSendBeginMainFrame() override { |
| 90 test_hooks_->ScheduledActionWillSendBeginMainFrame(); | 85 test_hooks_->ScheduledActionWillSendBeginMainFrame(); |
| 91 ThreadProxy::ScheduledActionSendBeginMainFrame(); | 86 ThreadProxy::ScheduledActionSendBeginMainFrame(); |
| 92 test_hooks_->ScheduledActionSendBeginMainFrame(); | 87 test_hooks_->ScheduledActionSendBeginMainFrame(); |
| 93 } | 88 } |
| 94 | 89 |
| 95 DrawResult ScheduledActionDrawAndSwapIfPossible() override { | 90 DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
| 96 DrawResult result = ThreadProxy::ScheduledActionDrawAndSwapIfPossible(); | 91 DrawResult result = ThreadProxy::ScheduledActionDrawAndSwapIfPossible(); |
| 97 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); | 92 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); |
| 98 return result; | 93 return result; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 void ScheduledActionPrepareTiles() override { | 111 void ScheduledActionPrepareTiles() override { |
| 117 ThreadProxy::ScheduledActionPrepareTiles(); | 112 ThreadProxy::ScheduledActionPrepareTiles(); |
| 118 test_hooks_->ScheduledActionPrepareTiles(); | 113 test_hooks_->ScheduledActionPrepareTiles(); |
| 119 } | 114 } |
| 120 | 115 |
| 121 void ScheduledActionInvalidateOutputSurface() override { | 116 void ScheduledActionInvalidateOutputSurface() override { |
| 122 ThreadProxy::ScheduledActionInvalidateOutputSurface(); | 117 ThreadProxy::ScheduledActionInvalidateOutputSurface(); |
| 123 test_hooks_->ScheduledActionInvalidateOutputSurface(); | 118 test_hooks_->ScheduledActionInvalidateOutputSurface(); |
| 124 } | 119 } |
| 125 | 120 |
| 121 void SendBeginMainFrameNotExpectedSoon() override { |
| 122 ThreadProxy::SendBeginMainFrameNotExpectedSoon(); |
| 123 test_hooks_->SendBeginMainFrameNotExpectedSoon(); |
| 124 } |
| 125 |
| 126 ThreadProxyForTest( | 126 ThreadProxyForTest( |
| 127 TestHooks* test_hooks, | 127 TestHooks* test_hooks, |
| 128 LayerTreeHost* host, | 128 LayerTreeHost* host, |
| 129 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 129 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 130 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | 130 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 131 scoped_ptr<BeginFrameSource> external_begin_frame_source) | 131 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 132 : ThreadProxy(host, main_task_runner, | 132 : ThreadProxy(host, main_task_runner, |
| 133 impl_task_runner, | 133 impl_task_runner, |
| 134 external_begin_frame_source.Pass()), | 134 external_begin_frame_source.Pass()), |
| 135 test_hooks_(test_hooks) {} | 135 test_hooks_(test_hooks) {} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 147 return make_scoped_ptr(new SingleThreadProxyForTest( | 147 return make_scoped_ptr(new SingleThreadProxyForTest( |
| 148 test_hooks, host, client, main_task_runner, | 148 test_hooks, host, client, main_task_runner, |
| 149 external_begin_frame_source.Pass())); | 149 external_begin_frame_source.Pass())); |
| 150 } | 150 } |
| 151 | 151 |
| 152 ~SingleThreadProxyForTest() override {} | 152 ~SingleThreadProxyForTest() override {} |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 TestHooks* test_hooks_; | 155 TestHooks* test_hooks_; |
| 156 | 156 |
| 157 void WillBeginImplFrame(const BeginFrameArgs& args) override { | |
| 158 SingleThreadProxy::WillBeginImplFrame(args); | |
| 159 test_hooks_->WillBeginImplFrame(args); | |
| 160 } | |
| 161 | |
| 162 void ScheduledActionSendBeginMainFrame() override { | 157 void ScheduledActionSendBeginMainFrame() override { |
| 163 test_hooks_->ScheduledActionWillSendBeginMainFrame(); | 158 test_hooks_->ScheduledActionWillSendBeginMainFrame(); |
| 164 SingleThreadProxy::ScheduledActionSendBeginMainFrame(); | 159 SingleThreadProxy::ScheduledActionSendBeginMainFrame(); |
| 165 test_hooks_->ScheduledActionSendBeginMainFrame(); | 160 test_hooks_->ScheduledActionSendBeginMainFrame(); |
| 166 } | 161 } |
| 167 | 162 |
| 168 DrawResult ScheduledActionDrawAndSwapIfPossible() override { | 163 DrawResult ScheduledActionDrawAndSwapIfPossible() override { |
| 169 DrawResult result = | 164 DrawResult result = |
| 170 SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible(); | 165 SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible(); |
| 171 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); | 166 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 185 void ScheduledActionBeginOutputSurfaceCreation() override { | 180 void ScheduledActionBeginOutputSurfaceCreation() override { |
| 186 SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); | 181 SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation(); |
| 187 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); | 182 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); |
| 188 } | 183 } |
| 189 | 184 |
| 190 void ScheduledActionPrepareTiles() override { | 185 void ScheduledActionPrepareTiles() override { |
| 191 SingleThreadProxy::ScheduledActionPrepareTiles(); | 186 SingleThreadProxy::ScheduledActionPrepareTiles(); |
| 192 test_hooks_->ScheduledActionPrepareTiles(); | 187 test_hooks_->ScheduledActionPrepareTiles(); |
| 193 } | 188 } |
| 194 | 189 |
| 190 void ScheduledActionInvalidateOutputSurface() override { |
| 191 SingleThreadProxy::ScheduledActionInvalidateOutputSurface(); |
| 192 test_hooks_->ScheduledActionInvalidateOutputSurface(); |
| 193 } |
| 194 |
| 195 void SendBeginMainFrameNotExpectedSoon() override { |
| 196 SingleThreadProxy::SendBeginMainFrameNotExpectedSoon(); |
| 197 test_hooks_->SendBeginMainFrameNotExpectedSoon(); |
| 198 } |
| 199 |
| 195 SingleThreadProxyForTest( | 200 SingleThreadProxyForTest( |
| 196 TestHooks* test_hooks, | 201 TestHooks* test_hooks, |
| 197 LayerTreeHost* host, | 202 LayerTreeHost* host, |
| 198 LayerTreeHostSingleThreadClient* client, | 203 LayerTreeHostSingleThreadClient* client, |
| 199 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 204 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 200 scoped_ptr<BeginFrameSource> external_begin_frame_source) | 205 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 201 : SingleThreadProxy(host, client, main_task_runner, | 206 : SingleThreadProxy(host, client, main_task_runner, |
| 202 external_begin_frame_source.Pass()), | 207 external_begin_frame_source.Pass()), |
| 203 test_hooks_(test_hooks) {} | 208 test_hooks_(test_hooks) {} |
| 204 }; | 209 }; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 scoped_ptr<ResourcePool>* staging_resource_pool) override { | 253 scoped_ptr<ResourcePool>* staging_resource_pool) override { |
| 249 test_hooks_->CreateResourceAndTileTaskWorkerPool( | 254 test_hooks_->CreateResourceAndTileTaskWorkerPool( |
| 250 this, tile_task_worker_pool, resource_pool, staging_resource_pool); | 255 this, tile_task_worker_pool, resource_pool, staging_resource_pool); |
| 251 } | 256 } |
| 252 | 257 |
| 253 void WillBeginImplFrame(const BeginFrameArgs& args) override { | 258 void WillBeginImplFrame(const BeginFrameArgs& args) override { |
| 254 LayerTreeHostImpl::WillBeginImplFrame(args); | 259 LayerTreeHostImpl::WillBeginImplFrame(args); |
| 255 test_hooks_->WillBeginImplFrameOnThread(this, args); | 260 test_hooks_->WillBeginImplFrameOnThread(this, args); |
| 256 } | 261 } |
| 257 | 262 |
| 263 void DidBeginImplFrameDeadline() override { |
| 264 LayerTreeHostImpl::DidBeginImplFrameDeadline(); |
| 265 test_hooks_->DidBeginImplFrameDeadlineOnThread(this); |
| 266 } |
| 267 |
| 258 void BeginMainFrameAborted(CommitEarlyOutReason reason) override { | 268 void BeginMainFrameAborted(CommitEarlyOutReason reason) override { |
| 259 LayerTreeHostImpl::BeginMainFrameAborted(reason); | 269 LayerTreeHostImpl::BeginMainFrameAborted(reason); |
| 260 test_hooks_->BeginMainFrameAbortedOnThread(this, reason); | 270 test_hooks_->BeginMainFrameAbortedOnThread(this, reason); |
| 261 } | 271 } |
| 262 | 272 |
| 263 void BeginCommit() override { | 273 void BeginCommit() override { |
| 264 LayerTreeHostImpl::BeginCommit(); | 274 LayerTreeHostImpl::BeginCommit(); |
| 265 test_hooks_->BeginCommitOnThread(this); | 275 test_hooks_->BeginCommitOnThread(this); |
| 266 } | 276 } |
| 267 | 277 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 899 LayerTreeHost* LayerTreeTest::layer_tree_host() { |
| 890 // We check for a null proxy here as we sometimes ask for the layer tree host | 900 // We check for a null proxy here as we sometimes ask for the layer tree host |
| 891 // when the proxy does not exist, often for checking settings after a test has | 901 // when the proxy does not exist, often for checking settings after a test has |
| 892 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 902 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See |
| 893 // elsewhere in this file for other examples. | 903 // elsewhere in this file for other examples. |
| 894 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 904 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); |
| 895 return layer_tree_host_.get(); | 905 return layer_tree_host_.get(); |
| 896 } | 906 } |
| 897 | 907 |
| 898 } // namespace cc | 908 } // namespace cc |
| OLD | NEW |