OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
8 #include "cc/animation/layer_animation_controller.h" | 8 #include "cc/animation/layer_animation_controller.h" |
9 #include "cc/animation/scroll_offset_animation_curve.h" | 9 #include "cc/animation/scroll_offset_animation_curve.h" |
10 #include "cc/animation/timing_function.h" | 10 #include "cc/animation/timing_function.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 base::TimeTicks monotonic_time) override { | 161 base::TimeTicks monotonic_time) override { |
162 started_animating_ = true; | 162 started_animating_ = true; |
163 } | 163 } |
164 | 164 |
165 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 165 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
166 if (started_animating_) | 166 if (started_animating_) |
167 EndTest(); | 167 EndTest(); |
168 } | 168 } |
169 | 169 |
170 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 170 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
171 LayerTreeHostImpl::FrameData* frame, | 171 FrameData* frame, |
172 DrawResult draw_result) override { | 172 DrawResult draw_result) override { |
173 return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; | 173 return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
174 } | 174 } |
175 | 175 |
176 void AfterTest() override {} | 176 void AfterTest() override {} |
177 | 177 |
178 private: | 178 private: |
179 bool started_animating_; | 179 bool started_animating_; |
180 }; | 180 }; |
181 | 181 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 PostSetVisibleToMainThread(false); | 291 PostSetVisibleToMainThread(false); |
292 else if (has_background_ticked_) | 292 else if (has_background_ticked_) |
293 EndTest(); | 293 EndTest(); |
294 } else { | 294 } else { |
295 has_background_ticked_ = true; | 295 has_background_ticked_ = true; |
296 PostSetVisibleToMainThread(true); | 296 PostSetVisibleToMainThread(true); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 300 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
301 LayerTreeHostImpl::FrameData* frame, | 301 FrameData* frame, |
302 DrawResult draw_result) override { | 302 DrawResult draw_result) override { |
303 if (TestEnded()) | 303 if (TestEnded()) |
304 return draw_result; | 304 return draw_result; |
305 return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; | 305 return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
306 } | 306 } |
307 | 307 |
308 void AfterTest() override {} | 308 void AfterTest() override {} |
309 | 309 |
310 private: | 310 private: |
311 bool has_background_ticked_; | 311 bool has_background_ticked_; |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 | 893 |
894 void BeginTest() override { | 894 void BeginTest() override { |
895 prevented_draw_ = 0; | 895 prevented_draw_ = 0; |
896 added_animations_ = 0; | 896 added_animations_ = 0; |
897 started_times_ = 0; | 897 started_times_ = 0; |
898 | 898 |
899 PostSetNeedsCommitToMainThread(); | 899 PostSetNeedsCommitToMainThread(); |
900 } | 900 } |
901 | 901 |
902 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 902 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
903 LayerTreeHostImpl::FrameData* frame_data, | 903 FrameData* frame_data, |
904 DrawResult draw_result) override { | 904 DrawResult draw_result) override { |
905 if (added_animations_ < 2) | 905 if (added_animations_ < 2) |
906 return draw_result; | 906 return draw_result; |
907 if (TestEnded()) | 907 if (TestEnded()) |
908 return draw_result; | 908 return draw_result; |
909 // Act like there is checkerboard when the second animation wants to draw. | 909 // Act like there is checkerboard when the second animation wants to draw. |
910 ++prevented_draw_; | 910 ++prevented_draw_; |
911 if (prevented_draw_ > 2) | 911 if (prevented_draw_ > 2) |
912 EndTest(); | 912 EndTest(); |
913 return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; | 913 return DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 private: | 1266 private: |
1267 scoped_refptr<Layer> content_; | 1267 scoped_refptr<Layer> content_; |
1268 int num_swap_buffers_; | 1268 int num_swap_buffers_; |
1269 }; | 1269 }; |
1270 | 1270 |
1271 SINGLE_AND_MULTI_THREAD_TEST_F( | 1271 SINGLE_AND_MULTI_THREAD_TEST_F( |
1272 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1272 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1273 | 1273 |
1274 } // namespace | 1274 } // namespace |
1275 } // namespace cc | 1275 } // namespace cc |
OLD | NEW |