Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: cc/trees/layer_tree_host_unittest_animation.cc

Issue 131683005: cc: Make PrepareToDraw return an enum for why it aborts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wrapping... Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 LayerTreeHostImpl* host_impl, 194 LayerTreeHostImpl* host_impl,
195 base::TimeTicks monotonic_time) OVERRIDE { 195 base::TimeTicks monotonic_time) OVERRIDE {
196 started_animating_ = true; 196 started_animating_ = true;
197 } 197 }
198 198
199 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 199 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
200 if (started_animating_) 200 if (started_animating_)
201 EndTest(); 201 EndTest();
202 } 202 }
203 203
204 virtual bool PrepareToDrawOnThread( 204 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
205 LayerTreeHostImpl* host_impl, 205 LayerTreeHostImpl* host_impl,
206 LayerTreeHostImpl::FrameData* frame, 206 LayerTreeHostImpl::FrameData* frame,
207 bool result) OVERRIDE { 207 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
208 return false; 208 return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
209 } 209 }
210 210
211 virtual void AfterTest() OVERRIDE { } 211 virtual void AfterTest() OVERRIDE { }
212 212
213 private: 213 private:
214 bool started_animating_; 214 bool started_animating_;
215 }; 215 };
216 216
217 // Starvation can only be an issue with the MT compositor. 217 // Starvation can only be an issue with the MT compositor.
218 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws); 218 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws);
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 886
887 virtual void BeginTest() OVERRIDE { 887 virtual void BeginTest() OVERRIDE {
888 prevented_draw_ = 0; 888 prevented_draw_ = 0;
889 added_animations_ = 0; 889 added_animations_ = 0;
890 started_times_ = 0; 890 started_times_ = 0;
891 finished_times_ = 0; 891 finished_times_ = 0;
892 892
893 PostSetNeedsCommitToMainThread(); 893 PostSetNeedsCommitToMainThread();
894 } 894 }
895 895
896 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 896 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread(
897 LayerTreeHostImpl::FrameData* frame_data, 897 LayerTreeHostImpl* host_impl,
898 bool result) OVERRIDE { 898 LayerTreeHostImpl::FrameData* frame_data,
899 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE {
899 if (added_animations_ < 2) 900 if (added_animations_ < 2)
900 return result; 901 return draw_result;
901 if (TestEnded()) 902 if (TestEnded())
902 return result; 903 return draw_result;
903 // Act like there is checkerboard when the second animation wants to draw. 904 // Act like there is checkerboard when the second animation wants to draw.
904 ++prevented_draw_; 905 ++prevented_draw_;
905 return false; 906 return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
906 } 907 }
907 908
908 virtual void DidCommitAndDrawFrame() OVERRIDE { 909 virtual void DidCommitAndDrawFrame() OVERRIDE {
909 switch (layer_tree_host()->source_frame_number()) { 910 switch (layer_tree_host()->source_frame_number()) {
910 case 1: 911 case 1:
911 // The animation is longer than 1 BeginFrame interval. 912 // The animation is longer than 1 BeginFrame interval.
912 AddOpacityTransitionToLayer(content_.get(), 0.1, 0.2f, 0.8f, false); 913 AddOpacityTransitionToLayer(content_.get(), 0.1, 0.2f, 0.8f, false);
913 added_animations_++; 914 added_animations_++;
914 break; 915 break;
915 case 2: 916 case 2:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 FakeContentLayerClient client_; 1009 FakeContentLayerClient client_;
1009 scoped_refptr<FakeContentLayer> scroll_layer_; 1010 scoped_refptr<FakeContentLayer> scroll_layer_;
1010 }; 1011 };
1011 1012
1012 // SingleThreadProxy doesn't send scroll updates from LayerTreeHostImpl to 1013 // SingleThreadProxy doesn't send scroll updates from LayerTreeHostImpl to
1013 // LayerTreeHost. 1014 // LayerTreeHost.
1014 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestScrollOffsetChangesArePropagated); 1015 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestScrollOffsetChangesArePropagated);
1015 1016
1016 } // namespace 1017 } // namespace
1017 } // namespace cc 1018 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698