Chromium Code Reviews| 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 | 165 |
| 166 virtual bool CreateHostImpl(const LayerTreeSettings& settings, | 166 virtual bool CreateHostImpl(const LayerTreeSettings& settings, |
| 167 scoped_ptr<OutputSurface> output_surface) { | 167 scoped_ptr<OutputSurface> output_surface) { |
| 168 host_impl_ = LayerTreeHostImpl::Create( | 168 host_impl_ = LayerTreeHostImpl::Create( |
| 169 settings, this, &proxy_, &stats_instrumentation_, | 169 settings, this, &proxy_, &stats_instrumentation_, |
| 170 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, | 170 &shared_bitmap_manager_, &gpu_memory_buffer_manager_, |
| 171 &task_graph_runner_, 0); | 171 &task_graph_runner_, 0); |
| 172 output_surface_ = output_surface.Pass(); | 172 output_surface_ = output_surface.Pass(); |
| 173 bool init = host_impl_->InitializeRenderer(output_surface_.get()); | 173 bool init = host_impl_->InitializeRenderer(output_surface_.get()); |
| 174 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 174 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
| 175 host_impl_->SetVisible(true); | |
| 175 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); | 176 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); |
| 176 // Set the BeginFrameArgs so that methods which use it are able to. | 177 // Set the BeginFrameArgs so that methods which use it are able to. |
| 177 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( | 178 host_impl_->WillBeginImplFrame(CreateBeginFrameArgsForTesting( |
| 178 BEGINFRAME_FROM_HERE, | 179 BEGINFRAME_FROM_HERE, |
| 179 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); | 180 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1))); |
| 180 host_impl_->DidFinishImplFrame(); | 181 host_impl_->DidFinishImplFrame(); |
| 181 return init; | 182 return init; |
| 182 } | 183 } |
| 183 | 184 |
| 184 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { | 185 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { |
| (...skipping 6367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6552 } | 6553 } |
| 6553 | 6554 |
| 6554 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { | 6555 class LayerTreeHostImplTestPrepareTiles : public LayerTreeHostImplTest { |
| 6555 public: | 6556 public: |
| 6556 void SetUp() override { | 6557 void SetUp() override { |
| 6557 fake_host_impl_ = | 6558 fake_host_impl_ = |
| 6558 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, | 6559 new FakeLayerTreeHostImpl(LayerTreeSettings(), &proxy_, |
| 6559 &shared_bitmap_manager_, &task_graph_runner_); | 6560 &shared_bitmap_manager_, &task_graph_runner_); |
| 6560 host_impl_.reset(fake_host_impl_); | 6561 host_impl_.reset(fake_host_impl_); |
| 6561 output_surface_ = CreateOutputSurface(); | 6562 output_surface_ = CreateOutputSurface(); |
| 6563 host_impl_->SetVisible(true); | |
| 6562 host_impl_->InitializeRenderer(output_surface_.get()); | 6564 host_impl_->InitializeRenderer(output_surface_.get()); |
| 6563 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 6565 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
| 6564 } | 6566 } |
| 6565 | 6567 |
| 6566 FakeLayerTreeHostImpl* fake_host_impl_; | 6568 FakeLayerTreeHostImpl* fake_host_impl_; |
| 6567 }; | 6569 }; |
| 6568 | 6570 |
| 6569 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { | 6571 TEST_F(LayerTreeHostImplTestPrepareTiles, PrepareTilesWhenInvisible) { |
| 6572 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); | |
| 6573 // TODO: This is not really testing anything, since initializing the renderer | |
| 6574 // dirties tile priorities. | |
|
no sievers
2015/10/05 19:51:10
@reveman: thoughts on this?
reveman
2015/10/06 00:46:05
we can fix this in a follow up if needed. maybe ju
no sievers
2015/10/06 19:39:47
Done.
| |
| 6570 fake_host_impl_->DidModifyTilePriorities(); | 6575 fake_host_impl_->DidModifyTilePriorities(); |
| 6571 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); | 6576 EXPECT_TRUE(fake_host_impl_->prepare_tiles_needed()); |
| 6572 fake_host_impl_->SetVisible(false); | 6577 fake_host_impl_->SetVisible(false); |
| 6573 EXPECT_FALSE(fake_host_impl_->prepare_tiles_needed()); | 6578 EXPECT_FALSE(fake_host_impl_->prepare_tiles_needed()); |
| 6574 } | 6579 } |
| 6575 | 6580 |
| 6576 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { | 6581 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { |
| 6577 scoped_ptr<TestWebGraphicsContext3D> context = | 6582 scoped_ptr<TestWebGraphicsContext3D> context = |
| 6578 TestWebGraphicsContext3D::Create(); | 6583 TestWebGraphicsContext3D::Create(); |
| 6579 TestWebGraphicsContext3D* context3d = context.get(); | 6584 TestWebGraphicsContext3D* context3d = context.get(); |
| (...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8572 // Hold an unowned pointer to the output surface to use for mock expectations. | 8577 // Hold an unowned pointer to the output surface to use for mock expectations. |
| 8573 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 8578 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
| 8574 | 8579 |
| 8575 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 8580 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
| 8576 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 8581 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
| 8577 host_impl_->BeginCommit(); | 8582 host_impl_->BeginCommit(); |
| 8578 } | 8583 } |
| 8579 | 8584 |
| 8580 } // namespace | 8585 } // namespace |
| 8581 } // namespace cc | 8586 } // namespace cc |
| OLD | NEW |