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

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 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 public: 693 public:
689 LayerTreeHostAnimationTestScrollOffsetAnimationRemoval() 694 LayerTreeHostAnimationTestScrollOffsetAnimationRemoval()
690 : final_postion_(50.0, 100.0) {} 695 : final_postion_(50.0, 100.0) {}
691 696
692 void SetupTree() override { 697 void SetupTree() override {
693 LayerTreeHostAnimationTest::SetupTree(); 698 LayerTreeHostAnimationTest::SetupTree();
694 699
695 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 700 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
696 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); 701 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id());
697 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); 702 scroll_layer_->SetBounds(gfx::Size(10000, 10000));
703 client_.set_bounds(scroll_layer_->bounds());
698 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); 704 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0));
699 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 705 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
700 706
701 scoped_ptr<ScrollOffsetAnimationCurve> curve( 707 scoped_ptr<ScrollOffsetAnimationCurve> curve(
702 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), 708 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
703 EaseInOutTimingFunction::Create())); 709 EaseInOutTimingFunction::Create()));
704 scoped_ptr<Animation> animation( 710 scoped_ptr<Animation> animation(
705 Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET)); 711 Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
706 animation->set_needs_synchronized_start_time(true); 712 animation->set_needs_synchronized_start_time(true);
707 scroll_layer_->AddAnimation(std::move(animation)); 713 scroll_layer_->AddAnimation(std::move(animation));
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers); 881 LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers);
876 882
877 class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit 883 class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit
878 : public LayerTreeHostAnimationTest { 884 : public LayerTreeHostAnimationTest {
879 public: 885 public:
880 void SetupTree() override { 886 void SetupTree() override {
881 LayerTreeHostAnimationTest::SetupTree(); 887 LayerTreeHostAnimationTest::SetupTree();
882 888
883 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 889 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
884 layer_->SetBounds(gfx::Size(2, 2)); 890 layer_->SetBounds(gfx::Size(2, 2));
891 client_.set_bounds(layer_->bounds());
885 // Transform the layer to 4,4 to start. 892 // Transform the layer to 4,4 to start.
886 gfx::Transform start_transform; 893 gfx::Transform start_transform;
887 start_transform.Translate(4.0, 4.0); 894 start_transform.Translate(4.0, 4.0);
888 layer_->SetTransform(start_transform); 895 layer_->SetTransform(start_transform);
889 896
890 layer_tree_host()->root_layer()->AddChild(layer_); 897 layer_tree_host()->root_layer()->AddChild(layer_);
891 } 898 }
892 899
893 void BeginTest() override { 900 void BeginTest() override {
894 // Add a translate from 6,7 to 8,9. 901 // Add a translate from 6,7 to 8,9.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 SINGLE_AND_MULTI_THREAD_TEST_F( 1054 SINGLE_AND_MULTI_THREAD_TEST_F(
1048 LayerTreeHostAnimationTestAddAnimationAfterAnimating); 1055 LayerTreeHostAnimationTestAddAnimationAfterAnimating);
1049 1056
1050 class LayerTreeHostAnimationTestRemoveAnimation 1057 class LayerTreeHostAnimationTestRemoveAnimation
1051 : public LayerTreeHostAnimationTest { 1058 : public LayerTreeHostAnimationTest {
1052 public: 1059 public:
1053 void SetupTree() override { 1060 void SetupTree() override {
1054 LayerTreeHostAnimationTest::SetupTree(); 1061 LayerTreeHostAnimationTest::SetupTree();
1055 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1062 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1056 layer_->SetBounds(gfx::Size(4, 4)); 1063 layer_->SetBounds(gfx::Size(4, 4));
1064 client_.set_bounds(layer_->bounds());
1057 layer_tree_host()->root_layer()->AddChild(layer_); 1065 layer_tree_host()->root_layer()->AddChild(layer_);
1058 } 1066 }
1059 1067
1060 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1068 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1061 1069
1062 void DidCommit() override { 1070 void DidCommit() override {
1063 switch (layer_tree_host()->source_frame_number()) { 1071 switch (layer_tree_host()->source_frame_number()) {
1064 case 1: 1072 case 1:
1065 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5); 1073 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5);
1066 break; 1074 break;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 1130
1123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestRemoveAnimation); 1131 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestRemoveAnimation);
1124 1132
1125 class LayerTreeHostAnimationTestIsAnimating 1133 class LayerTreeHostAnimationTestIsAnimating
1126 : public LayerTreeHostAnimationTest { 1134 : public LayerTreeHostAnimationTest {
1127 public: 1135 public:
1128 void SetupTree() override { 1136 void SetupTree() override {
1129 LayerTreeHostAnimationTest::SetupTree(); 1137 LayerTreeHostAnimationTest::SetupTree();
1130 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1138 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1131 layer_->SetBounds(gfx::Size(4, 4)); 1139 layer_->SetBounds(gfx::Size(4, 4));
1140 client_.set_bounds(layer_->bounds());
1132 layer_tree_host()->root_layer()->AddChild(layer_); 1141 layer_tree_host()->root_layer()->AddChild(layer_);
1133 } 1142 }
1134 1143
1135 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1144 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1136 1145
1137 void DidCommit() override { 1146 void DidCommit() override {
1138 switch (layer_tree_host()->source_frame_number()) { 1147 switch (layer_tree_host()->source_frame_number()) {
1139 case 1: 1148 case 1:
1140 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5); 1149 AddAnimatedTransformToLayer(layer_.get(), 1.0, 5, 5);
1141 break; 1150 break;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 class LayerTreeHostAnimationTestAnimationFinishesDuringCommit 1211 class LayerTreeHostAnimationTestAnimationFinishesDuringCommit
1203 : public LayerTreeHostAnimationTest { 1212 : public LayerTreeHostAnimationTest {
1204 public: 1213 public:
1205 LayerTreeHostAnimationTestAnimationFinishesDuringCommit() 1214 LayerTreeHostAnimationTestAnimationFinishesDuringCommit()
1206 : signalled_(false) {} 1215 : signalled_(false) {}
1207 1216
1208 void SetupTree() override { 1217 void SetupTree() override {
1209 LayerTreeHostAnimationTest::SetupTree(); 1218 LayerTreeHostAnimationTest::SetupTree();
1210 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1219 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1211 layer_->SetBounds(gfx::Size(4, 4)); 1220 layer_->SetBounds(gfx::Size(4, 4));
1221 client_.set_bounds(layer_->bounds());
1212 layer_tree_host()->root_layer()->AddChild(layer_); 1222 layer_tree_host()->root_layer()->AddChild(layer_);
1213 } 1223 }
1214 1224
1215 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1225 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1216 1226
1217 void DidCommit() override { 1227 void DidCommit() override {
1218 if (layer_tree_host()->source_frame_number() == 1) 1228 if (layer_tree_host()->source_frame_number() == 1)
1219 AddAnimatedTransformToLayer(layer_.get(), 0.04, 5, 5); 1229 AddAnimatedTransformToLayer(layer_.get(), 0.04, 5, 5);
1220 } 1230 }
1221 1231
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 class LayerTreeHostAnimationTestNotifyAnimationFinished 1282 class LayerTreeHostAnimationTestNotifyAnimationFinished
1273 : public LayerTreeHostAnimationTest { 1283 : public LayerTreeHostAnimationTest {
1274 public: 1284 public:
1275 LayerTreeHostAnimationTestNotifyAnimationFinished() 1285 LayerTreeHostAnimationTestNotifyAnimationFinished()
1276 : called_animation_started_(false), called_animation_finished_(false) {} 1286 : called_animation_started_(false), called_animation_finished_(false) {}
1277 1287
1278 void SetupTree() override { 1288 void SetupTree() override {
1279 LayerTreeHostAnimationTest::SetupTree(); 1289 LayerTreeHostAnimationTest::SetupTree();
1280 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 1290 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
1281 picture_->SetBounds(gfx::Size(4, 4)); 1291 picture_->SetBounds(gfx::Size(4, 4));
1292 client_.set_bounds(picture_->bounds());
1282 picture_->set_layer_animation_delegate(this); 1293 picture_->set_layer_animation_delegate(this);
1283 layer_tree_host()->root_layer()->AddChild(picture_); 1294 layer_tree_host()->root_layer()->AddChild(picture_);
1284 } 1295 }
1285 1296
1286 void BeginTest() override { 1297 void BeginTest() override {
1287 PostAddLongAnimationToMainThread(picture_.get()); 1298 PostAddLongAnimationToMainThread(picture_.get());
1288 } 1299 }
1289 1300
1290 void NotifyAnimationStarted(base::TimeTicks monotonic_time, 1301 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
1291 Animation::TargetProperty target_property, 1302 Animation::TargetProperty target_property,
(...skipping 21 matching lines...) Expand all
1313 bool called_animation_finished_; 1324 bool called_animation_finished_;
1314 FakeContentLayerClient client_; 1325 FakeContentLayerClient client_;
1315 scoped_refptr<FakePictureLayer> picture_; 1326 scoped_refptr<FakePictureLayer> picture_;
1316 }; 1327 };
1317 1328
1318 SINGLE_AND_MULTI_THREAD_TEST_F( 1329 SINGLE_AND_MULTI_THREAD_TEST_F(
1319 LayerTreeHostAnimationTestNotifyAnimationFinished); 1330 LayerTreeHostAnimationTestNotifyAnimationFinished);
1320 1331
1321 } // namespace 1332 } // namespace
1322 } // namespace cc 1333 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_animation_timelines.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698