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

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

Issue 1143433005: Remove gfx::FrameTime for a single clock source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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/location.h" 10 #include "base/location.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "cc/trees/layer_tree_host_impl.h" 54 #include "cc/trees/layer_tree_host_impl.h"
55 #include "cc/trees/layer_tree_impl.h" 55 #include "cc/trees/layer_tree_impl.h"
56 #include "cc/trees/single_thread_proxy.h" 56 #include "cc/trees/single_thread_proxy.h"
57 #include "cc/trees/thread_proxy.h" 57 #include "cc/trees/thread_proxy.h"
58 #include "gpu/GLES2/gl2extchromium.h" 58 #include "gpu/GLES2/gl2extchromium.h"
59 #include "skia/ext/refptr.h" 59 #include "skia/ext/refptr.h"
60 #include "testing/gmock/include/gmock/gmock.h" 60 #include "testing/gmock/include/gmock/gmock.h"
61 #include "third_party/khronos/GLES2/gl2.h" 61 #include "third_party/khronos/GLES2/gl2.h"
62 #include "third_party/khronos/GLES2/gl2ext.h" 62 #include "third_party/khronos/GLES2/gl2ext.h"
63 #include "third_party/skia/include/core/SkPicture.h" 63 #include "third_party/skia/include/core/SkPicture.h"
64 #include "ui/gfx/frame_time.h" 64
65 #include "ui/gfx/geometry/point_conversions.h" 65 #include "ui/gfx/geometry/point_conversions.h"
66 #include "ui/gfx/geometry/size_conversions.h" 66 #include "ui/gfx/geometry/size_conversions.h"
67 #include "ui/gfx/geometry/vector2d_conversions.h" 67 #include "ui/gfx/geometry/vector2d_conversions.h"
68 68
69 using testing::_; 69 using testing::_;
70 using testing::AnyNumber; 70 using testing::AnyNumber;
71 using testing::AtLeast; 71 using testing::AtLeast;
72 using testing::Mock; 72 using testing::Mock;
73 73
74 namespace cc { 74 namespace cc {
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 } 1227 }
1228 1228
1229 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1229 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1230 frame_++; 1230 frame_++;
1231 if (frame_ == 1) { 1231 if (frame_ == 1) {
1232 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; 1232 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
1233 impl->SetNeedsRedraw(); 1233 impl->SetNeedsRedraw();
1234 1234
1235 // Since we might use a low-resolution clock on Windows, we need to 1235 // Since we might use a low-resolution clock on Windows, we need to
1236 // make sure that the clock has incremented past first_frame_time_. 1236 // make sure that the clock has incremented past first_frame_time_.
1237 while (first_frame_time_ == gfx::FrameTime::Now()) { 1237 while (first_frame_time_ == base::TimeTicks::Now()) {
1238 } 1238 }
1239 1239
1240 return; 1240 return;
1241 } 1241 }
1242 1242
1243 EXPECT_NE(first_frame_time_, impl->CurrentBeginFrameArgs().frame_time); 1243 EXPECT_NE(first_frame_time_, impl->CurrentBeginFrameArgs().frame_time);
1244 EndTest(); 1244 EndTest();
1245 } 1245 }
1246 1246
1247 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1247 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 4535 matching lines...) Expand 10 before | Expand all | Expand 10 after
5783 5783
5784 void InitializeSettings(LayerTreeSettings* settings) override { 5784 void InitializeSettings(LayerTreeSettings* settings) override {
5785 settings->single_thread_proxy_scheduler = false; 5785 settings->single_thread_proxy_scheduler = false;
5786 } 5786 }
5787 5787
5788 void BeginTest() override { 5788 void BeginTest() override {
5789 // Successful composite. 5789 // Successful composite.
5790 scoped_ptr<SwapPromise> swap_promise0( 5790 scoped_ptr<SwapPromise> swap_promise0(
5791 new TestSwapPromise(&swap_promise_result_[0])); 5791 new TestSwapPromise(&swap_promise_result_[0]));
5792 layer_tree_host()->QueueSwapPromise(swap_promise0.Pass()); 5792 layer_tree_host()->QueueSwapPromise(swap_promise0.Pass());
5793 layer_tree_host()->Composite(gfx::FrameTime::Now()); 5793 layer_tree_host()->Composite(base::TimeTicks::Now());
5794 5794
5795 // Fail to swap (no damage). 5795 // Fail to swap (no damage).
5796 scoped_ptr<SwapPromise> swap_promise1( 5796 scoped_ptr<SwapPromise> swap_promise1(
5797 new TestSwapPromise(&swap_promise_result_[1])); 5797 new TestSwapPromise(&swap_promise_result_[1]));
5798 layer_tree_host()->QueueSwapPromise(swap_promise1.Pass()); 5798 layer_tree_host()->QueueSwapPromise(swap_promise1.Pass());
5799 layer_tree_host()->SetNeedsCommit(); 5799 layer_tree_host()->SetNeedsCommit();
5800 layer_tree_host()->Composite(gfx::FrameTime::Now()); 5800 layer_tree_host()->Composite(base::TimeTicks::Now());
5801 5801
5802 // Fail to draw (not visible). 5802 // Fail to draw (not visible).
5803 scoped_ptr<SwapPromise> swap_promise2( 5803 scoped_ptr<SwapPromise> swap_promise2(
5804 new TestSwapPromise(&swap_promise_result_[2])); 5804 new TestSwapPromise(&swap_promise_result_[2]));
5805 layer_tree_host()->QueueSwapPromise(swap_promise2.Pass()); 5805 layer_tree_host()->QueueSwapPromise(swap_promise2.Pass());
5806 layer_tree_host()->SetNeedsDisplayOnAllLayers(); 5806 layer_tree_host()->SetNeedsDisplayOnAllLayers();
5807 layer_tree_host()->SetVisible(false); 5807 layer_tree_host()->SetVisible(false);
5808 layer_tree_host()->Composite(gfx::FrameTime::Now()); 5808 layer_tree_host()->Composite(base::TimeTicks::Now());
5809 5809
5810 EndTest(); 5810 EndTest();
5811 } 5811 }
5812 5812
5813 void DidCommit() override { 5813 void DidCommit() override {
5814 commit_count_++; 5814 commit_count_++;
5815 ASSERT_LE(commit_count_, 3); 5815 ASSERT_LE(commit_count_, 3);
5816 } 5816 }
5817 5817
5818 void AfterTest() override { 5818 void AfterTest() override {
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
7186 void AfterTest() override {} 7186 void AfterTest() override {}
7187 7187
7188 scoped_refptr<FakePictureLayer> content_child_layer_; 7188 scoped_refptr<FakePictureLayer> content_child_layer_;
7189 FakeContentLayerClient client_; 7189 FakeContentLayerClient client_;
7190 }; 7190 };
7191 7191
7192 SINGLE_AND_MULTI_THREAD_TEST_F( 7192 SINGLE_AND_MULTI_THREAD_TEST_F(
7193 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); 7193 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild);
7194 7194
7195 } // namespace cc 7195 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698