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/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 4150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4161 void InitializeSettings(LayerTreeSettings* settings) override { | 4161 void InitializeSettings(LayerTreeSettings* settings) override { |
4162 settings->impl_side_painting = true; | 4162 settings->impl_side_painting = true; |
4163 settings->use_zero_copy = false; | 4163 settings->use_zero_copy = false; |
4164 settings->use_one_copy = false; | 4164 settings->use_one_copy = false; |
4165 } | 4165 } |
4166 | 4166 |
4167 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( | 4167 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface( |
4168 bool fallback) override { | 4168 bool fallback) override { |
4169 scoped_refptr<TestContextProvider> context_provider = | 4169 scoped_refptr<TestContextProvider> context_provider = |
4170 TestContextProvider::Create(); | 4170 TestContextProvider::Create(); |
4171 context_provider->SetMaxTransferBufferUsageBytes(1024 * 1024); | 4171 context_provider->SetMaxTransferBufferUsageBytes(512 * 512); |
4172 if (delegating_renderer()) | 4172 if (delegating_renderer()) |
4173 return FakeOutputSurface::CreateDelegating3d(context_provider); | 4173 return FakeOutputSurface::CreateDelegating3d(context_provider); |
4174 else | 4174 else |
4175 return FakeOutputSurface::Create3d(context_provider); | 4175 return FakeOutputSurface::Create3d(context_provider); |
4176 } | 4176 } |
4177 | 4177 |
4178 void SetupTree() override { | 4178 void SetupTree() override { |
4179 client_.set_fill_with_nonsolid_color(true); | 4179 client_.set_fill_with_nonsolid_color(true); |
4180 scoped_refptr<FakePictureLayer> root_layer = | 4180 scoped_refptr<FakePictureLayer> root_layer = |
4181 FakePictureLayer::Create(&client_); | 4181 FakePictureLayer::Create(&client_); |
4182 root_layer->SetBounds(gfx::Size(6000, 6000)); | 4182 root_layer->SetBounds(gfx::Size(1024, 1024)); |
4183 root_layer->SetIsDrawable(true); | 4183 root_layer->SetIsDrawable(true); |
4184 | 4184 |
4185 layer_tree_host()->SetRootLayer(root_layer); | 4185 layer_tree_host()->SetRootLayer(root_layer); |
4186 LayerTreeHostTest::SetupTree(); | 4186 LayerTreeHostTest::SetupTree(); |
4187 } | 4187 } |
4188 | 4188 |
4189 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4189 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4190 | 4190 |
4191 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 4191 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
4192 TestWebGraphicsContext3D* context = TestContext(); | 4192 TestWebGraphicsContext3D* context = TestContext(); |
4193 | 4193 |
4194 // Expect that the transfer buffer memory used is equal to the | 4194 // Expect that the transfer buffer memory used is equal to the |
4195 // MaxTransferBufferUsageBytes value set in CreateOutputSurface. | 4195 // MaxTransferBufferUsageBytes value set in CreateOutputSurface. |
4196 EXPECT_EQ(1024 * 1024u, context->max_used_transfer_buffer_usage_bytes()); | 4196 EXPECT_EQ(512 * 512u, context->max_used_transfer_buffer_usage_bytes()); |
4197 EndTest(); | 4197 EndTest(); |
4198 } | 4198 } |
4199 | 4199 |
4200 void AfterTest() override {} | 4200 void AfterTest() override {} |
4201 | 4201 |
4202 private: | 4202 private: |
4203 FakeContentLayerClient client_; | 4203 FakeContentLayerClient client_; |
4204 }; | 4204 }; |
4205 | 4205 |
4206 // Impl-side painting is a multi-threaded compositor feature. | 4206 // Impl-side painting is a multi-threaded compositor feature. |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5175 void AfterTest() override { | 5175 void AfterTest() override { |
5176 EXPECT_TRUE(deltas_sent_to_client_); | 5176 EXPECT_TRUE(deltas_sent_to_client_); |
5177 } | 5177 } |
5178 | 5178 |
5179 ScrollAndScaleSet info_; | 5179 ScrollAndScaleSet info_; |
5180 bool deltas_sent_to_client_; | 5180 bool deltas_sent_to_client_; |
5181 }; | 5181 }; |
5182 | 5182 |
5183 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); | 5183 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); |
5184 } // namespace cc | 5184 } // namespace cc |
OLD | NEW |