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

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

Issue 1452353002: Turn off computation of the interest rect in cc in synchronized paint mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted); 226 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimationsGetDeleted);
227 227
228 // Ensure that an animation's timing function is respected. 228 // Ensure that an animation's timing function is respected.
229 class LayerTreeHostAnimationTestAddAnimationWithTimingFunction 229 class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
230 : public LayerTreeHostAnimationTest { 230 : public LayerTreeHostAnimationTest {
231 public: 231 public:
232 void SetupTree() override { 232 void SetupTree() override {
233 LayerTreeHostAnimationTest::SetupTree(); 233 LayerTreeHostAnimationTest::SetupTree();
234 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 234 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
235 picture_->SetBounds(gfx::Size(4, 4)); 235 picture_->SetBounds(gfx::Size(4, 4));
236 client_.set_bounds(picture_->bounds());
236 layer_tree_host()->root_layer()->AddChild(picture_); 237 layer_tree_host()->root_layer()->AddChild(picture_);
237 } 238 }
238 239
239 void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); } 240 void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); }
240 241
241 void AnimateLayers(LayerTreeHostImpl* host_impl, 242 void AnimateLayers(LayerTreeHostImpl* host_impl,
242 base::TimeTicks monotonic_time) override { 243 base::TimeTicks monotonic_time) override {
243 // TODO(ajuma): This test only checks the active tree. Add checks for 244 // TODO(ajuma): This test only checks the active tree. Add checks for
244 // pending tree too. 245 // pending tree too.
245 if (!host_impl->active_tree()->root_layer()) 246 if (!host_impl->active_tree()->root_layer())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 278
278 // Ensures that main thread animations have their start times synchronized with 279 // Ensures that main thread animations have their start times synchronized with
279 // impl thread animations. 280 // impl thread animations.
280 class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes 281 class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
281 : public LayerTreeHostAnimationTest { 282 : public LayerTreeHostAnimationTest {
282 public: 283 public:
283 void SetupTree() override { 284 void SetupTree() override {
284 LayerTreeHostAnimationTest::SetupTree(); 285 LayerTreeHostAnimationTest::SetupTree();
285 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 286 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
286 picture_->SetBounds(gfx::Size(4, 4)); 287 picture_->SetBounds(gfx::Size(4, 4));
288 client_.set_bounds(picture_->bounds());
287 picture_->set_layer_animation_delegate(this); 289 picture_->set_layer_animation_delegate(this);
288 layer_tree_host()->root_layer()->AddChild(picture_); 290 layer_tree_host()->root_layer()->AddChild(picture_);
289 } 291 }
290 292
291 void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); } 293 void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); }
292 294
293 void NotifyAnimationStarted(base::TimeTicks monotonic_time, 295 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
294 Animation::TargetProperty target_property, 296 Animation::TargetProperty target_property,
295 int group) override { 297 int group) override {
296 LayerAnimationController* controller = 298 LayerAnimationController* controller =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity 361 class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
360 : public LayerTreeHostAnimationTest { 362 : public LayerTreeHostAnimationTest {
361 public: 363 public:
362 LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity() 364 LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity()
363 : update_check_layer_( 365 : update_check_layer_(
364 FakePictureLayer::Create(layer_settings(), &client_)) {} 366 FakePictureLayer::Create(layer_settings(), &client_)) {}
365 367
366 void SetupTree() override { 368 void SetupTree() override {
367 update_check_layer_->SetOpacity(0.f); 369 update_check_layer_->SetOpacity(0.f);
368 layer_tree_host()->SetRootLayer(update_check_layer_); 370 layer_tree_host()->SetRootLayer(update_check_layer_);
371 client_.set_bounds(update_check_layer_->bounds());
369 LayerTreeHostAnimationTest::SetupTree(); 372 LayerTreeHostAnimationTest::SetupTree();
370 } 373 }
371 374
372 void BeginTest() override { 375 void BeginTest() override {
373 PostAddAnimationToMainThread(update_check_layer_.get()); 376 PostAddAnimationToMainThread(update_check_layer_.get());
374 } 377 }
375 378
376 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 379 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
377 LayerAnimationController* controller_impl = 380 LayerAnimationController* controller_impl =
378 host_impl->active_tree()->root_layer()->layer_animation_controller(); 381 host_impl->active_tree()->root_layer()->layer_animation_controller();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit); 551 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit);
549 552
550 // Animations should not be started when frames are being skipped due to 553 // Animations should not be started when frames are being skipped due to
551 // checkerboard. 554 // checkerboard.
552 class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations 555 class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
553 : public LayerTreeHostAnimationTest { 556 : public LayerTreeHostAnimationTest {
554 void SetupTree() override { 557 void SetupTree() override {
555 LayerTreeHostAnimationTest::SetupTree(); 558 LayerTreeHostAnimationTest::SetupTree();
556 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 559 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
557 picture_->SetBounds(gfx::Size(4, 4)); 560 picture_->SetBounds(gfx::Size(4, 4));
561 client_.set_bounds(picture_->bounds());
558 picture_->set_layer_animation_delegate(this); 562 picture_->set_layer_animation_delegate(this);
559 layer_tree_host()->root_layer()->AddChild(picture_); 563 layer_tree_host()->root_layer()->AddChild(picture_);
560 } 564 }
561 565
562 void InitializeSettings(LayerTreeSettings* settings) override { 566 void InitializeSettings(LayerTreeSettings* settings) override {
563 // Make sure that drawing many times doesn't cause a checkerboarded 567 // Make sure that drawing many times doesn't cause a checkerboarded
564 // animation to start so we avoid flake in this test. 568 // animation to start so we avoid flake in this test.
565 settings->timeout_and_draw_when_animation_checkerboards = false; 569 settings->timeout_and_draw_when_animation_checkerboards = false;
566 } 570 }
567 571
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // scroll offset updates are sent back to the main thread. 634 // scroll offset updates are sent back to the main thread.
631 class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated 635 class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
632 : public LayerTreeHostAnimationTest { 636 : public LayerTreeHostAnimationTest {
633 public: 637 public:
634 void SetupTree() override { 638 void SetupTree() override {
635 LayerTreeHostAnimationTest::SetupTree(); 639 LayerTreeHostAnimationTest::SetupTree();
636 640
637 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 641 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
638 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); 642 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id());
639 scroll_layer_->SetBounds(gfx::Size(1000, 1000)); 643 scroll_layer_->SetBounds(gfx::Size(1000, 1000));
644 client_.set_bounds(scroll_layer_->bounds());
640 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20)); 645 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20));
641 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 646 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
642 } 647 }
643 648
644 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 649 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
645 650
646 void DidCommit() override { 651 void DidCommit() override {
647 switch (layer_tree_host()->source_frame_number()) { 652 switch (layer_tree_host()->source_frame_number()) {
648 case 1: { 653 case 1: {
649 scoped_ptr<ScrollOffsetAnimationCurve> curve( 654 scoped_ptr<ScrollOffsetAnimationCurve> curve(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 public: 692 public:
688 LayerTreeHostAnimationTestScrollOffsetAnimationRemoval() 693 LayerTreeHostAnimationTestScrollOffsetAnimationRemoval()
689 : final_postion_(50.0, 100.0) {} 694 : final_postion_(50.0, 100.0) {}
690 695
691 void SetupTree() override { 696 void SetupTree() override {
692 LayerTreeHostAnimationTest::SetupTree(); 697 LayerTreeHostAnimationTest::SetupTree();
693 698
694 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 699 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
695 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); 700 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id());
696 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); 701 scroll_layer_->SetBounds(gfx::Size(10000, 10000));
702 client_.set_bounds(scroll_layer_->bounds());
697 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); 703 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0));
698 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 704 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
699 705
700 scoped_ptr<ScrollOffsetAnimationCurve> curve( 706 scoped_ptr<ScrollOffsetAnimationCurve> curve(
701 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), 707 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
702 EaseInOutTimingFunction::Create())); 708 EaseInOutTimingFunction::Create()));
703 scoped_ptr<Animation> animation( 709 scoped_ptr<Animation> animation(
704 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); 710 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET));
705 animation->set_needs_synchronized_start_time(true); 711 animation->set_needs_synchronized_start_time(true);
706 scroll_layer_->AddAnimation(animation.Pass()); 712 scroll_layer_->AddAnimation(animation.Pass());
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers); 880 LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers);
875 881
876 class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit 882 class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit
877 : public LayerTreeHostAnimationTest { 883 : public LayerTreeHostAnimationTest {
878 public: 884 public:
879 void SetupTree() override { 885 void SetupTree() override {
880 LayerTreeHostAnimationTest::SetupTree(); 886 LayerTreeHostAnimationTest::SetupTree();
881 887
882 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 888 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
883 layer_->SetBounds(gfx::Size(2, 2)); 889 layer_->SetBounds(gfx::Size(2, 2));
890 client_.set_bounds(layer_->bounds());
884 // Transform the layer to 4,4 to start. 891 // Transform the layer to 4,4 to start.
885 gfx::Transform start_transform; 892 gfx::Transform start_transform;
886 start_transform.Translate(4.0, 4.0); 893 start_transform.Translate(4.0, 4.0);
887 layer_->SetTransform(start_transform); 894 layer_->SetTransform(start_transform);
888 895
889 layer_tree_host()->root_layer()->AddChild(layer_); 896 layer_tree_host()->root_layer()->AddChild(layer_);
890 } 897 }
891 898
892 void BeginTest() override { 899 void BeginTest() override {
893 // Add a translate from 6,7 to 8,9. 900 // Add a translate from 6,7 to 8,9.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 SINGLE_AND_MULTI_THREAD_TEST_F( 1053 SINGLE_AND_MULTI_THREAD_TEST_F(
1047 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1054 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1048 1055
1049 class LayerTreeHostAnimationTestRemoveAnimation 1056 class LayerTreeHostAnimationTestRemoveAnimation
1050 : public LayerTreeHostAnimationTest { 1057 : public LayerTreeHostAnimationTest {
1051 public: 1058 public:
1052 void SetupTree() override { 1059 void SetupTree() override {
1053 LayerTreeHostAnimationTest::SetupTree(); 1060 LayerTreeHostAnimationTest::SetupTree();
1054 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1061 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1055 layer_->SetBounds(gfx::Size(4, 4)); 1062 layer_->SetBounds(gfx::Size(4, 4));
1063 client_.set_bounds(layer_->bounds());
1056 layer_tree_host()->root_layer()->AddChild(layer_); 1064 layer_tree_host()->root_layer()->AddChild(layer_);
1057 } 1065 }
1058 1066
1059 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1067 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1060 1068
1061 void DidCommit() override { 1069 void DidCommit() override {
1062 switch (layer_tree_host()->source_frame_number()) { 1070 switch (layer_tree_host()->source_frame_number()) {
1063 case 1: 1071 case 1:
1064 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5); 1072 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5);
1065 break; 1073 break;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1129
1122 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestRemoveAnimation); 1130 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestRemoveAnimation);
1123 1131
1124 class LayerTreeHostAnimationTestIsAnimating 1132 class LayerTreeHostAnimationTestIsAnimating
1125 : public LayerTreeHostAnimationTest { 1133 : public LayerTreeHostAnimationTest {
1126 public: 1134 public:
1127 void SetupTree() override { 1135 void SetupTree() override {
1128 LayerTreeHostAnimationTest::SetupTree(); 1136 LayerTreeHostAnimationTest::SetupTree();
1129 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1137 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1130 layer_->SetBounds(gfx::Size(4, 4)); 1138 layer_->SetBounds(gfx::Size(4, 4));
1139 client_.set_bounds(layer_->bounds());
1131 layer_tree_host()->root_layer()->AddChild(layer_); 1140 layer_tree_host()->root_layer()->AddChild(layer_);
1132 } 1141 }
1133 1142
1134 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1143 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1135 1144
1136 void DidCommit() override { 1145 void DidCommit() override {
1137 switch (layer_tree_host()->source_frame_number()) { 1146 switch (layer_tree_host()->source_frame_number()) {
1138 case 1: 1147 case 1:
1139 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5); 1148 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5);
1140 break; 1149 break;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 class LayerTreeHostAnimationTestAnimationFinishesDuringCommit 1210 class LayerTreeHostAnimationTestAnimationFinishesDuringCommit
1202 : public LayerTreeHostAnimationTest { 1211 : public LayerTreeHostAnimationTest {
1203 public: 1212 public:
1204 LayerTreeHostAnimationTestAnimationFinishesDuringCommit() 1213 LayerTreeHostAnimationTestAnimationFinishesDuringCommit()
1205 : signalled_(false) {} 1214 : signalled_(false) {}
1206 1215
1207 void SetupTree() override { 1216 void SetupTree() override {
1208 LayerTreeHostAnimationTest::SetupTree(); 1217 LayerTreeHostAnimationTest::SetupTree();
1209 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1218 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1210 layer_->SetBounds(gfx::Size(4, 4)); 1219 layer_->SetBounds(gfx::Size(4, 4));
1220 client_.set_bounds(layer_->bounds());
1211 layer_tree_host()->root_layer()->AddChild(layer_); 1221 layer_tree_host()->root_layer()->AddChild(layer_);
1212 } 1222 }
1213 1223
1214 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1224 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1215 1225
1216 void DidCommit() override { 1226 void DidCommit() override {
1217 if (layer_tree_host()->source_frame_number() == 1) 1227 if (layer_tree_host()->source_frame_number() == 1)
1218 AddAnimatedTransformToLayer(layer_.get(), 0.04, 5, 5); 1228 AddAnimatedTransformToLayer(layer_.get(), 0.04, 5, 5);
1219 } 1229 }
1220 1230
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 class LayerTreeHostAnimationTestNotifyAnimationFinished 1281 class LayerTreeHostAnimationTestNotifyAnimationFinished
1272 : public LayerTreeHostAnimationTest { 1282 : public LayerTreeHostAnimationTest {
1273 public: 1283 public:
1274 LayerTreeHostAnimationTestNotifyAnimationFinished() 1284 LayerTreeHostAnimationTestNotifyAnimationFinished()
1275 : called_animation_started_(false), called_animation_finished_(false) {} 1285 : called_animation_started_(false), called_animation_finished_(false) {}
1276 1286
1277 void SetupTree() override { 1287 void SetupTree() override {
1278 LayerTreeHostAnimationTest::SetupTree(); 1288 LayerTreeHostAnimationTest::SetupTree();
1279 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 1289 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
1280 picture_->SetBounds(gfx::Size(4, 4)); 1290 picture_->SetBounds(gfx::Size(4, 4));
1291 client_.set_bounds(picture_->bounds());
1281 picture_->set_layer_animation_delegate(this); 1292 picture_->set_layer_animation_delegate(this);
1282 layer_tree_host()->root_layer()->AddChild(picture_); 1293 layer_tree_host()->root_layer()->AddChild(picture_);
1283 } 1294 }
1284 1295
1285 void BeginTest() override { 1296 void BeginTest() override {
1286 PostAddLongAnimationToMainThread(picture_.get()); 1297 PostAddLongAnimationToMainThread(picture_.get());
1287 } 1298 }
1288 1299
1289 void NotifyAnimationStarted(base::TimeTicks monotonic_time, 1300 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
1290 Animation::TargetProperty target_property, 1301 Animation::TargetProperty target_property,
(...skipping 21 matching lines...) Expand all
1312 bool called_animation_finished_; 1323 bool called_animation_finished_;
1313 FakeContentLayerClient client_; 1324 FakeContentLayerClient client_;
1314 scoped_refptr<FakePictureLayer> picture_; 1325 scoped_refptr<FakePictureLayer> picture_;
1315 }; 1326 };
1316 1327
1317 SINGLE_AND_MULTI_THREAD_TEST_F( 1328 SINGLE_AND_MULTI_THREAD_TEST_F(
1318 LayerTreeHostAnimationTestNotifyAnimationFinished); 1329 LayerTreeHostAnimationTestNotifyAnimationFinished);
1319 1330
1320 } // namespace 1331 } // namespace
1321 } // namespace cc 1332 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698