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

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

Issue 429743003: Rename Animate as Begin(Main)Frame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Created 6 years, 4 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_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_animation.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 impl->BlockNotifyReadyToActivateForTesting(true); 740 impl->BlockNotifyReadyToActivateForTesting(true);
741 } 741 }
742 742
743 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl, 743 virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl,
744 const BeginFrameArgs& args) OVERRIDE { 744 const BeginFrameArgs& args) OVERRIDE {
745 if (impl->pending_tree()) 745 if (impl->pending_tree())
746 frame_count_with_pending_tree_++; 746 frame_count_with_pending_tree_++;
747 747
748 if (frame_count_with_pending_tree_ == 1) { 748 if (frame_count_with_pending_tree_ == 1) {
749 EXPECT_EQ(first_frame_time_.ToInternalValue(), 0); 749 EXPECT_EQ(first_frame_time_.ToInternalValue(), 0);
750 first_frame_time_ = impl->CurrentFrameTimeTicks(); 750 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
751 } else if (frame_count_with_pending_tree_ == 2) { 751 } else if (frame_count_with_pending_tree_ == 2) {
752 impl->BlockNotifyReadyToActivateForTesting(false); 752 impl->BlockNotifyReadyToActivateForTesting(false);
753 } 753 }
754 } 754 }
755 755
756 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 756 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
757 if (frame_count_with_pending_tree_ > 1) { 757 if (frame_count_with_pending_tree_ > 1) {
758 EXPECT_NE(first_frame_time_.ToInternalValue(), 0); 758 EXPECT_NE(first_frame_time_.ToInternalValue(), 0);
759 EXPECT_NE(first_frame_time_.ToInternalValue(), 759 EXPECT_NE(first_frame_time_.ToInternalValue(),
760 impl->CurrentFrameTimeTicks().ToInternalValue()); 760 impl->CurrentBeginFrameArgs().frame_time.ToInternalValue());
761 EndTest(); 761 EndTest();
762 return; 762 return;
763 } 763 }
764 764
765 EXPECT_FALSE(impl->settings().impl_side_painting); 765 EXPECT_FALSE(impl->settings().impl_side_painting);
766 EndTest(); 766 EndTest();
767 } 767 }
768 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { 768 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
769 if (impl->settings().impl_side_painting) 769 if (impl->settings().impl_side_painting)
770 EXPECT_NE(frame_count_with_pending_tree_, 1); 770 EXPECT_NE(frame_count_with_pending_tree_, 1);
(...skipping 18 matching lines...) Expand all
789 virtual void BeginTest() OVERRIDE { 789 virtual void BeginTest() OVERRIDE {
790 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); 790 layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
791 layer_tree_host()->set_background_color(SK_ColorGRAY); 791 layer_tree_host()->set_background_color(SK_ColorGRAY);
792 792
793 PostSetNeedsCommitToMainThread(); 793 PostSetNeedsCommitToMainThread();
794 } 794 }
795 795
796 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 796 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
797 frame_++; 797 frame_++;
798 if (frame_ == 1) { 798 if (frame_ == 1) {
799 first_frame_time_ = impl->CurrentFrameTimeTicks(); 799 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
800 impl->SetNeedsRedraw(); 800 impl->SetNeedsRedraw();
801 801
802 // Since we might use a low-resolution clock on Windows, we need to 802 // Since we might use a low-resolution clock on Windows, we need to
803 // make sure that the clock has incremented past first_frame_time_. 803 // make sure that the clock has incremented past first_frame_time_.
804 while (first_frame_time_ == gfx::FrameTime::Now()) { 804 while (first_frame_time_ == gfx::FrameTime::Now()) {
805 } 805 }
806 806
807 return; 807 return;
808 } 808 }
809 809
810 EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks()); 810 EXPECT_NE(first_frame_time_, impl->CurrentBeginFrameArgs().frame_time);
811 EndTest(); 811 EndTest();
812 } 812 }
813 813
814 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 814 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
815 // Ensure there isn't a commit between the two draws, to ensure that a 815 // Ensure there isn't a commit between the two draws, to ensure that a
816 // commit isn't required for updating the current frame time. We can 816 // commit isn't required for updating the current frame time. We can
817 // only check for this in the multi-threaded case, since in the single- 817 // only check for this in the multi-threaded case, since in the single-
818 // threaded case there will always be a commit between consecutive draws. 818 // threaded case there will always be a commit between consecutive draws.
819 if (HasImplThread()) 819 if (HasImplThread())
820 EXPECT_EQ(0, frame_); 820 EXPECT_EQ(0, frame_);
(...skipping 4159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4980 1000.0 / layer_tree_host()->settings().refresh_rate; 4980 1000.0 / layer_tree_host()->settings().refresh_rate;
4981 MainThreadTaskRunner()->PostDelayedTask( 4981 MainThreadTaskRunner()->PostDelayedTask(
4982 FROM_HERE, 4982 FROM_HERE,
4983 base::Bind( 4983 base::Bind(
4984 &LayerTreeHostTestContinuousPainting::DisableContinuousPainting, 4984 &LayerTreeHostTestContinuousPainting::DisableContinuousPainting,
4985 base::Unretained(this)), 4985 base::Unretained(this)),
4986 base::TimeDelta::FromMilliseconds(50 * kExpectedNumCommits * 4986 base::TimeDelta::FromMilliseconds(50 * kExpectedNumCommits *
4987 milliseconds_per_frame)); 4987 milliseconds_per_frame));
4988 } 4988 }
4989 4989
4990 virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE { 4990 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
4991 child_layer_->SetNeedsDisplay(); 4991 child_layer_->SetNeedsDisplay();
4992 } 4992 }
4993 4993
4994 virtual void AfterTest() OVERRIDE { 4994 virtual void AfterTest() OVERRIDE {
4995 EXPECT_LE(kExpectedNumCommits, num_commits_); 4995 EXPECT_LE(kExpectedNumCommits, num_commits_);
4996 EXPECT_LE(kExpectedNumCommits, num_draws_); 4996 EXPECT_LE(kExpectedNumCommits, num_draws_);
4997 int update_count = content_layer_ ? content_layer_->PaintContentsCount() 4997 int update_count = content_layer_ ? content_layer_->PaintContentsCount()
4998 : picture_layer_->update_count(); 4998 : picture_layer_->update_count();
4999 EXPECT_LE(kExpectedNumCommits, update_count); 4999 EXPECT_LE(kExpectedNumCommits, update_count);
5000 } 5000 }
(...skipping 26 matching lines...) Expand all
5027 const gfx::Size bounds_; 5027 const gfx::Size bounds_;
5028 FakeContentLayerClient client_; 5028 FakeContentLayerClient client_;
5029 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; 5029 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_;
5030 scoped_refptr<FakePictureLayer> picture_layer_; 5030 scoped_refptr<FakePictureLayer> picture_layer_;
5031 Layer* child_layer_; 5031 Layer* child_layer_;
5032 }; 5032 };
5033 5033
5034 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); 5034 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting);
5035 5035
5036 } // namespace cc 5036 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_perftest.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698