OLD | NEW |
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 Loading... |
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" | |
65 #include "ui/gfx/geometry/point_conversions.h" | 64 #include "ui/gfx/geometry/point_conversions.h" |
66 #include "ui/gfx/geometry/size_conversions.h" | 65 #include "ui/gfx/geometry/size_conversions.h" |
67 #include "ui/gfx/geometry/vector2d_conversions.h" | 66 #include "ui/gfx/geometry/vector2d_conversions.h" |
68 | 67 |
69 using testing::_; | 68 using testing::_; |
70 using testing::AnyNumber; | 69 using testing::AnyNumber; |
71 using testing::AtLeast; | 70 using testing::AtLeast; |
72 using testing::Mock; | 71 using testing::Mock; |
73 | 72 |
74 namespace cc { | 73 namespace cc { |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 } | 1226 } |
1228 | 1227 |
1229 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 1228 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
1230 frame_++; | 1229 frame_++; |
1231 if (frame_ == 1) { | 1230 if (frame_ == 1) { |
1232 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; | 1231 first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time; |
1233 impl->SetNeedsRedraw(); | 1232 impl->SetNeedsRedraw(); |
1234 | 1233 |
1235 // Since we might use a low-resolution clock on Windows, we need to | 1234 // 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_. | 1235 // make sure that the clock has incremented past first_frame_time_. |
1237 while (first_frame_time_ == gfx::FrameTime::Now()) { | 1236 while (first_frame_time_ == base::TimeTicks::Now()) { |
1238 } | 1237 } |
1239 | 1238 |
1240 return; | 1239 return; |
1241 } | 1240 } |
1242 | 1241 |
1243 EXPECT_NE(first_frame_time_, impl->CurrentBeginFrameArgs().frame_time); | 1242 EXPECT_NE(first_frame_time_, impl->CurrentBeginFrameArgs().frame_time); |
1244 EndTest(); | 1243 EndTest(); |
1245 } | 1244 } |
1246 | 1245 |
1247 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1246 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
(...skipping 4605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5853 void InitializeSettings(LayerTreeSettings* settings) override { | 5852 void InitializeSettings(LayerTreeSettings* settings) override { |
5854 settings->single_thread_proxy_scheduler = false; | 5853 settings->single_thread_proxy_scheduler = false; |
5855 settings->use_zero_copy = true; | 5854 settings->use_zero_copy = true; |
5856 } | 5855 } |
5857 | 5856 |
5858 void BeginTest() override { | 5857 void BeginTest() override { |
5859 // Successful composite. | 5858 // Successful composite. |
5860 scoped_ptr<SwapPromise> swap_promise0( | 5859 scoped_ptr<SwapPromise> swap_promise0( |
5861 new TestSwapPromise(&swap_promise_result_[0])); | 5860 new TestSwapPromise(&swap_promise_result_[0])); |
5862 layer_tree_host()->QueueSwapPromise(swap_promise0.Pass()); | 5861 layer_tree_host()->QueueSwapPromise(swap_promise0.Pass()); |
5863 layer_tree_host()->Composite(gfx::FrameTime::Now()); | 5862 layer_tree_host()->Composite(base::TimeTicks::Now()); |
5864 | 5863 |
5865 // Fail to swap (no damage). | 5864 // Fail to swap (no damage). |
5866 scoped_ptr<SwapPromise> swap_promise1( | 5865 scoped_ptr<SwapPromise> swap_promise1( |
5867 new TestSwapPromise(&swap_promise_result_[1])); | 5866 new TestSwapPromise(&swap_promise_result_[1])); |
5868 layer_tree_host()->QueueSwapPromise(swap_promise1.Pass()); | 5867 layer_tree_host()->QueueSwapPromise(swap_promise1.Pass()); |
5869 layer_tree_host()->SetNeedsCommit(); | 5868 layer_tree_host()->SetNeedsCommit(); |
5870 layer_tree_host()->Composite(gfx::FrameTime::Now()); | 5869 layer_tree_host()->Composite(base::TimeTicks::Now()); |
5871 | 5870 |
5872 // Fail to draw (not visible). | 5871 // Fail to draw (not visible). |
5873 scoped_ptr<SwapPromise> swap_promise2( | 5872 scoped_ptr<SwapPromise> swap_promise2( |
5874 new TestSwapPromise(&swap_promise_result_[2])); | 5873 new TestSwapPromise(&swap_promise_result_[2])); |
5875 layer_tree_host()->QueueSwapPromise(swap_promise2.Pass()); | 5874 layer_tree_host()->QueueSwapPromise(swap_promise2.Pass()); |
5876 layer_tree_host()->SetNeedsDisplayOnAllLayers(); | 5875 layer_tree_host()->SetNeedsDisplayOnAllLayers(); |
5877 layer_tree_host()->SetVisible(false); | 5876 layer_tree_host()->SetVisible(false); |
5878 layer_tree_host()->Composite(gfx::FrameTime::Now()); | 5877 layer_tree_host()->Composite(base::TimeTicks::Now()); |
5879 | 5878 |
5880 EndTest(); | 5879 EndTest(); |
5881 } | 5880 } |
5882 | 5881 |
5883 void DidCommit() override { | 5882 void DidCommit() override { |
5884 commit_count_++; | 5883 commit_count_++; |
5885 ASSERT_LE(commit_count_, 3); | 5884 ASSERT_LE(commit_count_, 3); |
5886 } | 5885 } |
5887 | 5886 |
5888 void AfterTest() override { | 5887 void AfterTest() override { |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7258 void AfterTest() override {} | 7257 void AfterTest() override {} |
7259 | 7258 |
7260 scoped_refptr<FakePictureLayer> content_child_layer_; | 7259 scoped_refptr<FakePictureLayer> content_child_layer_; |
7261 FakeContentLayerClient client_; | 7260 FakeContentLayerClient client_; |
7262 }; | 7261 }; |
7263 | 7262 |
7264 SINGLE_AND_MULTI_THREAD_TEST_F( | 7263 SINGLE_AND_MULTI_THREAD_TEST_F( |
7265 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); | 7264 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); |
7266 | 7265 |
7267 } // namespace cc | 7266 } // namespace cc |
OLD | NEW |