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

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

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 407 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
408 408
409 void DidCommit() override { 409 void DidCommit() override {
410 if (layer_tree_host()->source_frame_number() == 1) { 410 if (layer_tree_host()->source_frame_number() == 1) {
411 scoped_refptr<Layer> layer = Layer::Create(layer_settings()); 411 scoped_refptr<Layer> layer = Layer::Create(layer_settings());
412 layer->set_layer_animation_delegate(this); 412 layer->set_layer_animation_delegate(this);
413 413
414 // Any valid AnimationCurve will do here. 414 // Any valid AnimationCurve will do here.
415 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve()); 415 scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve());
416 scoped_ptr<Animation> animation( 416 scoped_ptr<Animation> animation(
417 Animation::Create(curve.Pass(), 1, 1, Animation::OPACITY)); 417 Animation::Create(std::move(curve), 1, 1, Animation::OPACITY));
418 layer->layer_animation_controller()->AddAnimation(animation.Pass()); 418 layer->layer_animation_controller()->AddAnimation(std::move(animation));
419 419
420 // We add the animation *before* attaching the layer to the tree. 420 // We add the animation *before* attaching the layer to the tree.
421 layer_tree_host()->root_layer()->AddChild(layer); 421 layer_tree_host()->root_layer()->AddChild(layer);
422 } 422 }
423 } 423 }
424 424
425 void AnimateLayers(LayerTreeHostImpl* impl_host, 425 void AnimateLayers(LayerTreeHostImpl* impl_host,
426 base::TimeTicks monotonic_time) override { 426 base::TimeTicks monotonic_time) override {
427 EndTest(); 427 EndTest();
428 } 428 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 643
644 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 644 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
645 645
646 void DidCommit() override { 646 void DidCommit() override {
647 switch (layer_tree_host()->source_frame_number()) { 647 switch (layer_tree_host()->source_frame_number()) {
648 case 1: { 648 case 1: {
649 scoped_ptr<ScrollOffsetAnimationCurve> curve( 649 scoped_ptr<ScrollOffsetAnimationCurve> curve(
650 ScrollOffsetAnimationCurve::Create( 650 ScrollOffsetAnimationCurve::Create(
651 gfx::ScrollOffset(500.f, 550.f), 651 gfx::ScrollOffset(500.f, 550.f),
652 EaseInOutTimingFunction::Create())); 652 EaseInOutTimingFunction::Create()));
653 scoped_ptr<Animation> animation( 653 scoped_ptr<Animation> animation(Animation::Create(
654 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); 654 std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
655 animation->set_needs_synchronized_start_time(true); 655 animation->set_needs_synchronized_start_time(true);
656 bool animation_added = scroll_layer_->AddAnimation(animation.Pass()); 656 bool animation_added =
657 scroll_layer_->AddAnimation(std::move(animation));
657 bool impl_scrolling_supported = 658 bool impl_scrolling_supported =
658 layer_tree_host()->proxy()->SupportsImplScrolling(); 659 layer_tree_host()->proxy()->SupportsImplScrolling();
659 EXPECT_EQ(impl_scrolling_supported, animation_added); 660 EXPECT_EQ(impl_scrolling_supported, animation_added);
660 if (!impl_scrolling_supported) 661 if (!impl_scrolling_supported)
661 EndTest(); 662 EndTest();
662 break; 663 break;
663 } 664 }
664 default: 665 default:
665 if (scroll_layer_->scroll_offset().x() > 10 && 666 if (scroll_layer_->scroll_offset().x() > 10 &&
666 scroll_layer_->scroll_offset().y() > 20) 667 scroll_layer_->scroll_offset().y() > 20)
(...skipping 27 matching lines...) Expand all
694 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 695 scroll_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
695 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); 696 scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id());
696 scroll_layer_->SetBounds(gfx::Size(10000, 10000)); 697 scroll_layer_->SetBounds(gfx::Size(10000, 10000));
697 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); 698 scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0));
698 layer_tree_host()->root_layer()->AddChild(scroll_layer_); 699 layer_tree_host()->root_layer()->AddChild(scroll_layer_);
699 700
700 scoped_ptr<ScrollOffsetAnimationCurve> curve( 701 scoped_ptr<ScrollOffsetAnimationCurve> curve(
701 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f), 702 ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
702 EaseInOutTimingFunction::Create())); 703 EaseInOutTimingFunction::Create()));
703 scoped_ptr<Animation> animation( 704 scoped_ptr<Animation> animation(
704 Animation::Create(curve.Pass(), 1, 0, Animation::SCROLL_OFFSET)); 705 Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
705 animation->set_needs_synchronized_start_time(true); 706 animation->set_needs_synchronized_start_time(true);
706 scroll_layer_->AddAnimation(animation.Pass()); 707 scroll_layer_->AddAnimation(std::move(animation));
707 } 708 }
708 709
709 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 710 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
710 711
711 void BeginMainFrame(const BeginFrameArgs& args) override { 712 void BeginMainFrame(const BeginFrameArgs& args) override {
712 switch (layer_tree_host()->source_frame_number()) { 713 switch (layer_tree_host()->source_frame_number()) {
713 case 0: 714 case 0:
714 break; 715 break;
715 case 1: { 716 case 1: {
716 Animation* animation = 717 Animation* animation =
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 bool called_animation_finished_; 1313 bool called_animation_finished_;
1313 FakeContentLayerClient client_; 1314 FakeContentLayerClient client_;
1314 scoped_refptr<FakePictureLayer> picture_; 1315 scoped_refptr<FakePictureLayer> picture_;
1315 }; 1316 };
1316 1317
1317 SINGLE_AND_MULTI_THREAD_TEST_F( 1318 SINGLE_AND_MULTI_THREAD_TEST_F(
1318 LayerTreeHostAnimationTestNotifyAnimationFinished); 1319 LayerTreeHostAnimationTestNotifyAnimationFinished);
1319 1320
1320 } // namespace 1321 } // namespace
1321 } // namespace cc 1322 } // 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