| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2217 private: | 2217 private: |
| 2218 NotificationClient client_; | 2218 NotificationClient client_; |
| 2219 }; | 2219 }; |
| 2220 | 2220 |
| 2221 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); | 2221 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); |
| 2222 | 2222 |
| 2223 // Verify that the BeginFrame notification is used to initiate rendering. | 2223 // Verify that the BeginFrame notification is used to initiate rendering. |
| 2224 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { | 2224 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { |
| 2225 public: | 2225 public: |
| 2226 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 2226 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 2227 settings->begin_frame_scheduling_enabled = true; | 2227 // settings->begin_frame_scheduling_enabled = true; |
| 2228 } | 2228 } |
| 2229 | 2229 |
| 2230 virtual void BeginTest() OVERRIDE { | 2230 virtual void BeginTest() OVERRIDE { |
| 2231 // This will trigger a SetNeedsBeginFrame which will trigger a | 2231 // This will trigger a SetNeedsBeginFrame which will trigger a |
| 2232 // BeginFrame. | 2232 // BeginFrame. |
| 2233 PostSetNeedsCommitToMainThread(); | 2233 PostSetNeedsCommitToMainThread(); |
| 2234 } | 2234 } |
| 2235 | 2235 |
| 2236 virtual DrawResult PrepareToDrawOnThread( | 2236 virtual DrawResult PrepareToDrawOnThread( |
| 2237 LayerTreeHostImpl* host_impl, | 2237 LayerTreeHostImpl* host_impl, |
| 2238 LayerTreeHostImpl::FrameData* frame, | 2238 LayerTreeHostImpl::FrameData* frame, |
| 2239 DrawResult draw_result) OVERRIDE { | 2239 DrawResult draw_result) OVERRIDE { |
| 2240 EndTest(); | 2240 EndTest(); |
| 2241 return DRAW_SUCCESS; | 2241 return DRAW_SUCCESS; |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 virtual void AfterTest() OVERRIDE {} | 2244 virtual void AfterTest() OVERRIDE {} |
| 2245 | 2245 |
| 2246 private: | 2246 private: |
| 2247 base::TimeTicks frame_time_; | 2247 base::TimeTicks frame_time_; |
| 2248 }; | 2248 }; |
| 2249 | 2249 |
| 2250 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); | 2250 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); |
| 2251 | 2251 |
| 2252 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled | 2252 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled |
| 2253 : public LayerTreeHostTest { | 2253 : public LayerTreeHostTest { |
| 2254 public: | 2254 public: |
| 2255 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 2255 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 2256 settings->begin_frame_scheduling_enabled = true; | 2256 // settings->begin_frame_scheduling_enabled = true; |
| 2257 settings->using_synchronous_renderer_compositor = true; | 2257 settings->using_synchronous_renderer_compositor = true; |
| 2258 } | 2258 } |
| 2259 | 2259 |
| 2260 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 2260 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 2261 | 2261 |
| 2262 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 2262 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 2263 // The BeginFrame notification is turned off now but will get enabled | 2263 // The BeginFrame notification is turned off now but will get enabled |
| 2264 // once we return. End test while it's enabled. | 2264 // once we return. End test while it's enabled. |
| 2265 ImplThreadTaskRunner()->PostTask( | 2265 ImplThreadTaskRunner()->PostTask( |
| 2266 FROM_HERE, | 2266 FROM_HERE, |
| 2267 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, | 2267 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, |
| 2268 base::Unretained(this))); | 2268 base::Unretained(this))); |
| 2269 } | 2269 } |
| 2270 | 2270 |
| 2271 virtual void AfterTest() OVERRIDE {} | 2271 virtual void AfterTest() OVERRIDE {} |
| 2272 }; | 2272 }; |
| 2273 | 2273 |
| 2274 MULTI_THREAD_TEST_F( | 2274 MULTI_THREAD_TEST_F( |
| 2275 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); | 2275 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); |
| 2276 | 2276 |
| 2277 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { | 2277 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { |
| 2278 protected: | 2278 protected: |
| 2279 LayerTreeHostTestAbortedCommitDoesntStall() | 2279 LayerTreeHostTestAbortedCommitDoesntStall() |
| 2280 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} | 2280 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} |
| 2281 | 2281 |
| 2282 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 2282 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
| 2283 settings->begin_frame_scheduling_enabled = true; | 2283 // settings->begin_frame_scheduling_enabled = true; |
| 2284 } | 2284 } |
| 2285 | 2285 |
| 2286 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 2286 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 2287 | 2287 |
| 2288 virtual void DidCommit() OVERRIDE { | 2288 virtual void DidCommit() OVERRIDE { |
| 2289 commit_count_++; | 2289 commit_count_++; |
| 2290 if (commit_count_ == 4) { | 2290 if (commit_count_ == 4) { |
| 2291 // After two aborted commits, request a real commit now to make sure a | 2291 // After two aborted commits, request a real commit now to make sure a |
| 2292 // real commit following an aborted commit will still complete and | 2292 // real commit following an aborted commit will still complete and |
| 2293 // end the test even when the Impl thread is idle. | 2293 // end the test even when the Impl thread is idle. |
| (...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5017 const gfx::Size bounds_; | 5017 const gfx::Size bounds_; |
| 5018 FakeContentLayerClient client_; | 5018 FakeContentLayerClient client_; |
| 5019 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5019 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
| 5020 scoped_refptr<FakePictureLayer> picture_layer_; | 5020 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5021 Layer* child_layer_; | 5021 Layer* child_layer_; |
| 5022 }; | 5022 }; |
| 5023 | 5023 |
| 5024 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5024 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
| 5025 | 5025 |
| 5026 } // namespace cc | 5026 } // namespace cc |
| OLD | NEW |