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