summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 19:06:27 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 19:06:27 +0000
commitc1bb5af2c3312280b17ac23a36dff4d366da3cea (patch)
tree37994afcc86b6de725429a2670e433a590032908 /cc
parent105b8cdd6bceee8ee86499ae377186ff1ec7df7b (diff)
downloadchromium_src-c1bb5af2c3312280b17ac23a36dff4d366da3cea.zip
chromium_src-c1bb5af2c3312280b17ac23a36dff4d366da3cea.tar.gz
chromium_src-c1bb5af2c3312280b17ac23a36dff4d366da3cea.tar.bz2
cc: Chromify the LayerTreeHostImpl class.
Style-only change. Make the LayerTreeHostImpl and InputHandlerClient classes follow chromium style. Review URL: https://codereview.chromium.org/12648005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/damage_tracker_unittest.cc38
-rw-r--r--cc/delegated_renderer_layer_impl.cc2
-rw-r--r--cc/delegated_renderer_layer_impl_unittest.cc396
-rw-r--r--cc/delegating_renderer_unittest.cc18
-rw-r--r--cc/gl_renderer_unittest.cc2
-rw-r--r--cc/input_handler.h116
-rw-r--r--cc/layer_impl_unittest.cc48
-rw-r--r--cc/layer_sorter_unittest.cc14
-rw-r--r--cc/layer_tree_host.cc32
-rw-r--r--cc/layer_tree_host_common_unittest.cc92
-rw-r--r--cc/layer_tree_host_impl.cc3079
-rw-r--r--cc/layer_tree_host_impl.h662
-rw-r--r--cc/layer_tree_host_impl_unittest.cc1890
-rw-r--r--cc/layer_tree_host_unittest.cc76
-rw-r--r--cc/layer_tree_host_unittest_animation.cc6
-rw-r--r--cc/layer_tree_host_unittest_context.cc51
-rw-r--r--cc/layer_tree_host_unittest_delegated.cc72
-rw-r--r--cc/layer_tree_host_unittest_scroll.cc56
-rw-r--r--cc/layer_tree_impl.cc83
-rw-r--r--cc/layer_tree_impl.h4
-rw-r--r--cc/layer_unittest.cc10
-rw-r--r--cc/nine_patch_layer_impl_unittest.cc4
-rw-r--r--cc/occlusion_tracker_unittest.cc4
-rw-r--r--cc/overdraw_metrics.cc2
-rw-r--r--cc/picture_layer_impl_unittest.cc48
-rw-r--r--cc/quad_culler_unittest.cc2
-rw-r--r--cc/render_pass_sink.h8
-rw-r--r--cc/render_surface_impl.cc2
-rw-r--r--cc/render_surface_unittest.cc14
-rw-r--r--cc/scrollbar_animation_controller_linear_fade_unittest.cc4
-rw-r--r--cc/scrollbar_layer_unittest.cc8
-rw-r--r--cc/single_thread_proxy.cc90
-rw-r--r--cc/single_thread_proxy.h30
-rw-r--r--cc/solid_color_layer_impl_unittest.cc10
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc14
-rw-r--r--cc/test/fake_layer_tree_host_impl.h10
-rw-r--r--cc/test/fake_layer_tree_host_impl_client.cc8
-rw-r--r--cc/test/fake_layer_tree_host_impl_client.h38
-rw-r--r--cc/test/layer_tree_test_common.cc48
-rw-r--r--cc/test/layer_tree_test_common.h22
-rw-r--r--cc/texture_layer_unittest.cc18
-rw-r--r--cc/thread_proxy.cc148
-rw-r--r--cc/thread_proxy.h30
-rw-r--r--cc/tiled_layer_impl_unittest.cc2
-rw-r--r--cc/tiled_layer_unittest.cc68
-rw-r--r--cc/tree_synchronizer_unittest.cc64
46 files changed, 3858 insertions, 3585 deletions
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc
index e15a22c..abf8da4 100644
--- a/cc/damage_tracker_unittest.cc
+++ b/cc/damage_tracker_unittest.cc
@@ -73,8 +73,8 @@ public:
scoped_ptr<LayerImpl> createTestTreeWithOneSurface()
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.activeTree(), 1);
- scoped_ptr<LayerImpl> child = LayerImpl::Create(m_hostImpl.activeTree(), 2);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.active_tree(), 1);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(m_hostImpl.active_tree(), 2);
root->SetPosition(gfx::PointF());
root->SetAnchorPoint(gfx::PointF());
@@ -100,11 +100,11 @@ public:
// child1. Additionally, the root has a second child layer, and child1 has two
// children of its own.
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.activeTree(), 1);
- scoped_ptr<LayerImpl> child1 = LayerImpl::Create(m_hostImpl.activeTree(), 2);
- scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
- scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(m_hostImpl.activeTree(), 4);
- scoped_ptr<LayerImpl> grandChild2 = LayerImpl::Create(m_hostImpl.activeTree(), 5);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.active_tree(), 1);
+ scoped_ptr<LayerImpl> child1 = LayerImpl::Create(m_hostImpl.active_tree(), 2);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.active_tree(), 3);
+ scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(m_hostImpl.active_tree(), 4);
+ scoped_ptr<LayerImpl> grandChild2 = LayerImpl::Create(m_hostImpl.active_tree(), 5);
root->SetPosition(gfx::PointF());
root->SetAnchorPoint(gfx::PointF());
@@ -535,7 +535,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
//
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.active_tree(), 3);
child2->SetPosition(gfx::PointF(400, 380));
child2->SetAnchorPoint(gfx::PointF());
child2->SetBounds(gfx::Size(6, 8));
@@ -576,7 +576,7 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.active_tree(), 3);
child2->SetPosition(gfx::PointF(400, 380));
child2->SetAnchorPoint(gfx::PointF());
child2->SetBounds(gfx::Size(6, 8));
@@ -606,7 +606,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
// In this test we don't want the above tree manipulation to be considered part of the same frame.
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(m_hostImpl.active_tree(), 3);
child2->SetPosition(gfx::PointF(400, 380));
child2->SetAnchorPoint(gfx::PointF());
child2->SetBounds(gfx::Size(6, 8));
@@ -827,7 +827,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
// contentBounds of the surface.
grandChild2->SetPosition(gfx::PointF(180, 180));
{
- scoped_ptr<LayerImpl> grandChild3 = LayerImpl::Create(m_hostImpl.activeTree(), 6);
+ scoped_ptr<LayerImpl> grandChild3 = LayerImpl::Create(m_hostImpl.active_tree(), 6);
grandChild3->SetPosition(gfx::PointF(240, 240));
grandChild3->SetAnchorPoint(gfx::PointF());
grandChild3->SetBounds(gfx::Size(10, 10));
@@ -842,7 +842,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
//
clearDamageForAllSurfaces(root.get());
{
- scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.activeTree(), 7);
+ scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.active_tree(), 7);
grandChild1Replica->SetPosition(gfx::PointF());
grandChild1Replica->SetAnchorPoint(gfx::PointF());
gfx::Transform reflection;
@@ -910,7 +910,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
// Set up the mask layer.
{
- scoped_ptr<LayerImpl> maskLayer = LayerImpl::Create(m_hostImpl.activeTree(), 3);
+ scoped_ptr<LayerImpl> maskLayer = LayerImpl::Create(m_hostImpl.active_tree(), 3);
maskLayer->SetPosition(child->position());
maskLayer->SetAnchorPoint(gfx::PointF());
maskLayer->SetBounds(child->bounds());
@@ -922,7 +922,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
// Add opacity and a grandChild so that the render surface persists even after we remove the mask.
child->SetOpacity(0.5);
{
- scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(m_hostImpl.activeTree(), 4);
+ scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(m_hostImpl.active_tree(), 4);
grandChild->SetPosition(gfx::PointF(2, 2));
grandChild->SetAnchorPoint(gfx::PointF());
grandChild->SetBounds(gfx::Size(2, 2));
@@ -995,7 +995,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
// Create a reflection about the left edge of grandChild1.
{
- scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.activeTree(), 6);
+ scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.active_tree(), 6);
grandChild1Replica->SetPosition(gfx::PointF());
grandChild1Replica->SetAnchorPoint(gfx::PointF());
gfx::Transform reflection;
@@ -1007,7 +1007,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
// Set up the mask layer on the replica layer
{
- scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::Create(m_hostImpl.activeTree(), 7);
+ scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::Create(m_hostImpl.active_tree(), 7);
replicaMaskLayer->SetPosition(gfx::PointF());
replicaMaskLayer->SetAnchorPoint(gfx::PointF());
replicaMaskLayer->SetBounds(grandChild1->bounds());
@@ -1057,7 +1057,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
grandChild1->SetAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
{
- scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.activeTree(), 6);
+ scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::Create(m_hostImpl.active_tree(), 6);
grandChild1Replica->SetPosition(gfx::PointF());
grandChild1Replica->SetAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested.
gfx::Transform reflection;
@@ -1069,7 +1069,7 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
// Set up the mask layer on the replica layer
{
- scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::Create(m_hostImpl.activeTree(), 7);
+ scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::Create(m_hostImpl.active_tree(), 7);
replicaMaskLayer->SetPosition(gfx::PointF());
replicaMaskLayer->SetAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested.
replicaMaskLayer->SetBounds(grandChild1->bounds());
@@ -1123,7 +1123,7 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
// Though it should never happen, its a good idea to verify that the damage tracker
// does not crash when it receives an empty layerList.
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl.active_tree(), 1);
root->CreateRenderSurface();
ASSERT_TRUE(root == root->render_target());
diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc
index dc9b720..f77a417 100644
--- a/cc/delegated_renderer_layer_impl.cc
+++ b/cc/delegated_renderer_layer_impl.cc
@@ -211,7 +211,7 @@ void DelegatedRendererLayerImpl::AppendContributingRenderPasses(
// Don't clash with the RenderPass we generate if we own a RenderSurface.
DCHECK(output_render_pass_id.index > 0);
- render_pass_sink->appendRenderPass(
+ render_pass_sink->AppendRenderPass(
render_passes_in_draw_order_[i]->Copy(output_render_pass_id));
}
}
diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc
index 7ab8b5a..def29c1 100644
--- a/cc/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/delegated_renderer_layer_impl_unittest.cc
@@ -37,9 +37,9 @@ class DelegatedRendererLayerImplTest : public testing::Test {
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
- host_impl_ = LayerTreeHostImpl::create(settings, &client_, &proxy_);
- host_impl_->initializeRenderer(createFakeOutputSurface());
- host_impl_->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
+ host_impl_ = LayerTreeHostImpl::Create(settings, &client_, &proxy_);
+ host_impl_->InitializeRenderer(createFakeOutputSurface());
+ host_impl_->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
}
protected:
@@ -56,15 +56,15 @@ class DelegatedRendererLayerImplTestSimple
DelegatedRendererLayerImplTestSimple()
: DelegatedRendererLayerImplTest() {
scoped_ptr<LayerImpl> root_layer = SolidColorLayerImpl::Create(
- host_impl_->activeTree(), 1).PassAs<LayerImpl>();
+ host_impl_->active_tree(), 1).PassAs<LayerImpl>();
scoped_ptr<LayerImpl> layer_before = SolidColorLayerImpl::Create(
- host_impl_->activeTree(), 2).PassAs<LayerImpl>();
+ host_impl_->active_tree(), 2).PassAs<LayerImpl>();
scoped_ptr<LayerImpl> layer_after = SolidColorLayerImpl::Create(
- host_impl_->activeTree(), 3).PassAs<LayerImpl>();
+ host_impl_->active_tree(), 3).PassAs<LayerImpl>();
scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer =
- FakeDelegatedRendererLayerImpl::Create(host_impl_->activeTree(), 4);
+ FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 4);
- host_impl_->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
root_layer->SetBounds(gfx::Size(100, 100));
layer_before->SetPosition(gfx::Point(20, 20));
@@ -126,7 +126,7 @@ class DelegatedRendererLayerImplTestSimple
// Get the RenderPass generated by layer_before to come before the delegated
// RenderPasses.
root_layer->AddChild(layer_before.Pass());
- host_impl_->activeTree()->SetRootLayer(root_layer.Pass());
+ host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
}
protected:
@@ -138,108 +138,108 @@ class DelegatedRendererLayerImplTestSimple
TEST_F(DelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
- ASSERT_EQ(5u, frame.renderPasses.size());
+ ASSERT_EQ(5u, frame.render_passes.size());
// The DelegatedRendererLayer should have added its contributing RenderPasses
// to the frame.
- EXPECT_EQ(4, frame.renderPasses[1]->id.layer_id);
- EXPECT_EQ(1, frame.renderPasses[1]->id.index);
- EXPECT_EQ(4, frame.renderPasses[2]->id.layer_id);
- EXPECT_EQ(2, frame.renderPasses[2]->id.index);
+ EXPECT_EQ(4, frame.render_passes[1]->id.layer_id);
+ EXPECT_EQ(1, frame.render_passes[1]->id.index);
+ EXPECT_EQ(4, frame.render_passes[2]->id.layer_id);
+ EXPECT_EQ(2, frame.render_passes[2]->id.index);
// And all other RenderPasses should be non-delegated.
- EXPECT_NE(4, frame.renderPasses[0]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[0]->id.index);
- EXPECT_NE(4, frame.renderPasses[3]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[3]->id.index);
- EXPECT_NE(4, frame.renderPasses[4]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[4]->id.index);
+ EXPECT_NE(4, frame.render_passes[0]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[0]->id.index);
+ EXPECT_NE(4, frame.render_passes[3]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[3]->id.index);
+ EXPECT_NE(4, frame.render_passes[4]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[4]->id.index);
// The DelegatedRendererLayer should have added its RenderPasses to the frame
// in order.
EXPECT_EQ(gfx::Rect(6, 6, 6, 6).ToString(),
- frame.renderPasses[1]->output_rect.ToString());
+ frame.render_passes[1]->output_rect.ToString());
EXPECT_EQ(gfx::Rect(7, 7, 7, 7).ToString(),
- frame.renderPasses[2]->output_rect.ToString());
+ frame.render_passes[2]->output_rect.ToString());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestSimple,
AddsQuadsToContributingRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
- ASSERT_EQ(5u, frame.renderPasses.size());
+ ASSERT_EQ(5u, frame.render_passes.size());
// The DelegatedRendererLayer should have added its contributing RenderPasses
// to the frame.
- EXPECT_EQ(4, frame.renderPasses[1]->id.layer_id);
- EXPECT_EQ(1, frame.renderPasses[1]->id.index);
- EXPECT_EQ(4, frame.renderPasses[2]->id.layer_id);
- EXPECT_EQ(2, frame.renderPasses[2]->id.index);
+ EXPECT_EQ(4, frame.render_passes[1]->id.layer_id);
+ EXPECT_EQ(1, frame.render_passes[1]->id.index);
+ EXPECT_EQ(4, frame.render_passes[2]->id.layer_id);
+ EXPECT_EQ(2, frame.render_passes[2]->id.index);
// The DelegatedRendererLayer should have added copies of its quads to
// contributing RenderPasses.
- ASSERT_EQ(1u, frame.renderPasses[1]->quad_list.size());
+ ASSERT_EQ(1u, frame.render_passes[1]->quad_list.size());
EXPECT_EQ(gfx::Rect(0, 0, 6, 6).ToString(),
- frame.renderPasses[1]->quad_list[0]->rect.ToString());
+ frame.render_passes[1]->quad_list[0]->rect.ToString());
// Verify it added the right quads.
- ASSERT_EQ(2u, frame.renderPasses[2]->quad_list.size());
+ ASSERT_EQ(2u, frame.render_passes[2]->quad_list.size());
EXPECT_EQ(gfx::Rect(0, 0, 7, 7).ToString(),
- frame.renderPasses[2]->quad_list[0]->rect.ToString());
+ frame.render_passes[2]->quad_list[0]->rect.ToString());
EXPECT_EQ(gfx::Rect(6, 6, 6, 6).ToString(),
- frame.renderPasses[2]->quad_list[1]->rect.ToString());
- ASSERT_EQ(1u, frame.renderPasses[1]->quad_list.size());
+ frame.render_passes[2]->quad_list[1]->rect.ToString());
+ ASSERT_EQ(1u, frame.render_passes[1]->quad_list.size());
EXPECT_EQ(gfx::Rect(0, 0, 6, 6).ToString(),
- frame.renderPasses[1]->quad_list[0]->rect.ToString());
+ frame.render_passes[1]->quad_list[0]->rect.ToString());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
- ASSERT_EQ(5u, frame.renderPasses.size());
+ ASSERT_EQ(5u, frame.render_passes.size());
// The layer's target is the RenderPass from m_layer_after.
- EXPECT_EQ(RenderPass::Id(3, 0), frame.renderPasses[3]->id);
+ EXPECT_EQ(RenderPass::Id(3, 0), frame.render_passes[3]->id);
// The DelegatedRendererLayer should have added copies of quads in its root
// RenderPass to its target RenderPass. The m_layer_after also adds one quad.
- ASSERT_EQ(2u, frame.renderPasses[3]->quad_list.size());
+ ASSERT_EQ(2u, frame.render_passes[3]->quad_list.size());
// Verify it added the right quads.
EXPECT_EQ(gfx::Rect(7, 7, 7, 7).ToString(),
- frame.renderPasses[3]->quad_list[0]->rect.ToString());
+ frame.render_passes[3]->quad_list[0]->rect.ToString());
// Its target layer should have a quad as well.
EXPECT_EQ(gfx::Rect(0, 0, 15, 15).ToString(),
- frame.renderPasses[3]->quad_list[1]->rect.ToString());
+ frame.render_passes[3]->quad_list[1]->rect.ToString());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestSimple,
QuadsFromRootRenderPassAreModifiedForTheTarget) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes.
- ASSERT_EQ(5u, frame.renderPasses.size());
+ ASSERT_EQ(5u, frame.render_passes.size());
// The DelegatedRendererLayer is at position 3,3 compared to its target, and
// has a translation transform of 1,1. So its root RenderPass' quads should
@@ -250,47 +250,47 @@ TEST_F(DelegatedRendererLayerImplTestSimple,
transform.Translate(4.0, 4.0);
transform.Scale(10.0 / 8.0, 10.0 / 8.0);
EXPECT_TRANSFORMATION_MATRIX_EQ(
- transform, frame.renderPasses[3]->quad_list[0]->quadTransform());
+ transform, frame.render_passes[3]->quad_list[0]->quadTransform());
// Quads from non-root RenderPasses should not be shifted though.
- ASSERT_EQ(2u, frame.renderPasses[2]->quad_list.size());
+ ASSERT_EQ(2u, frame.render_passes[2]->quad_list.size());
EXPECT_TRANSFORMATION_MATRIX_EQ(
- gfx::Transform(), frame.renderPasses[2]->quad_list[0]->quadTransform());
+ gfx::Transform(), frame.render_passes[2]->quad_list[0]->quadTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(
- gfx::Transform(), frame.renderPasses[2]->quad_list[1]->quadTransform());
- ASSERT_EQ(1u, frame.renderPasses[1]->quad_list.size());
+ gfx::Transform(), frame.render_passes[2]->quad_list[1]->quadTransform());
+ ASSERT_EQ(1u, frame.render_passes[1]->quad_list.size());
EXPECT_TRANSFORMATION_MATRIX_EQ(
- gfx::Transform(), frame.renderPasses[1]->quad_list[0]->quadTransform());
+ gfx::Transform(), frame.render_passes[1]->quad_list[0]->quadTransform());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestSimple, DoesNotOwnARenderSurface) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// If the DelegatedRendererLayer is axis aligned and has opacity 1, then it
// has no need to be a renderSurface for the quads it carries.
EXPECT_FALSE(delegated_renderer_layer_->render_surface());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestSimple, DoesOwnARenderSurfaceForOpacity) {
delegated_renderer_layer_->SetOpacity(0.5f);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// This test case has quads from multiple layers in the delegated renderer, so
// if the DelegatedRendererLayer has opacity < 1, it should end up with a
// render surface.
EXPECT_TRUE(delegated_renderer_layer_->render_surface());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestSimple,
@@ -300,15 +300,15 @@ TEST_F(DelegatedRendererLayerImplTestSimple,
delegated_renderer_layer_->SetTransform(rotation);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// This test case has quads from multiple layers in the delegated renderer, so
// if the DelegatedRendererLayer has opacity < 1, it should end up with a
// render surface.
EXPECT_TRUE(delegated_renderer_layer_->render_surface());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
class DelegatedRendererLayerImplTestOwnSurface
@@ -322,113 +322,113 @@ class DelegatedRendererLayerImplTestOwnSurface
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
// added one pass.
- ASSERT_EQ(6u, frame.renderPasses.size());
+ ASSERT_EQ(6u, frame.render_passes.size());
// The DelegatedRendererLayer should have added its contributing RenderPasses
// to the frame.
- EXPECT_EQ(4, frame.renderPasses[1]->id.layer_id);
- EXPECT_EQ(1, frame.renderPasses[1]->id.index);
- EXPECT_EQ(4, frame.renderPasses[2]->id.layer_id);
- EXPECT_EQ(2, frame.renderPasses[2]->id.index);
+ EXPECT_EQ(4, frame.render_passes[1]->id.layer_id);
+ EXPECT_EQ(1, frame.render_passes[1]->id.index);
+ EXPECT_EQ(4, frame.render_passes[2]->id.layer_id);
+ EXPECT_EQ(2, frame.render_passes[2]->id.index);
// The DelegatedRendererLayer should have added a RenderPass for its surface
// to the frame.
- EXPECT_EQ(4, frame.renderPasses[1]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[3]->id.index);
+ EXPECT_EQ(4, frame.render_passes[1]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[3]->id.index);
// And all other RenderPasses should be non-delegated.
- EXPECT_NE(4, frame.renderPasses[0]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[0]->id.index);
- EXPECT_NE(4, frame.renderPasses[4]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[4]->id.index);
- EXPECT_NE(4, frame.renderPasses[5]->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses[5]->id.index);
+ EXPECT_NE(4, frame.render_passes[0]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[0]->id.index);
+ EXPECT_NE(4, frame.render_passes[4]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[4]->id.index);
+ EXPECT_NE(4, frame.render_passes[5]->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes[5]->id.index);
// The DelegatedRendererLayer should have added its RenderPasses to the frame
// in order.
EXPECT_EQ(gfx::Rect(6, 6, 6, 6).ToString(),
- frame.renderPasses[1]->output_rect.ToString());
+ frame.render_passes[1]->output_rect.ToString());
EXPECT_EQ(gfx::Rect(7, 7, 7, 7).ToString(),
- frame.renderPasses[2]->output_rect.ToString());
+ frame.render_passes[2]->output_rect.ToString());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface,
AddsQuadsToContributingRenderPasses) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
// added one pass.
- ASSERT_EQ(6u, frame.renderPasses.size());
+ ASSERT_EQ(6u, frame.render_passes.size());
// The DelegatedRendererLayer should have added its contributing RenderPasses
// to the frame.
- EXPECT_EQ(4, frame.renderPasses[1]->id.layer_id);
- EXPECT_EQ(1, frame.renderPasses[1]->id.index);
- EXPECT_EQ(4, frame.renderPasses[2]->id.layer_id);
- EXPECT_EQ(2, frame.renderPasses[2]->id.index);
+ EXPECT_EQ(4, frame.render_passes[1]->id.layer_id);
+ EXPECT_EQ(1, frame.render_passes[1]->id.index);
+ EXPECT_EQ(4, frame.render_passes[2]->id.layer_id);
+ EXPECT_EQ(2, frame.render_passes[2]->id.index);
// The DelegatedRendererLayer should have added copies of its quads to
// contributing RenderPasses.
- ASSERT_EQ(1u, frame.renderPasses[1]->quad_list.size());
+ ASSERT_EQ(1u, frame.render_passes[1]->quad_list.size());
EXPECT_EQ(gfx::Rect(0, 0, 6, 6).ToString(),
- frame.renderPasses[1]->quad_list[0]->rect.ToString());
+ frame.render_passes[1]->quad_list[0]->rect.ToString());
// Verify it added the right quads.
- ASSERT_EQ(2u, frame.renderPasses[2]->quad_list.size());
+ ASSERT_EQ(2u, frame.render_passes[2]->quad_list.size());
EXPECT_EQ(gfx::Rect(0, 0, 7, 7).ToString(),
- frame.renderPasses[2]->quad_list[0]->rect.ToString());
+ frame.render_passes[2]->quad_list[0]->rect.ToString());
EXPECT_EQ(gfx::Rect(6, 6, 6, 6).ToString(),
- frame.renderPasses[2]->quad_list[1]->rect.ToString());
- ASSERT_EQ(1u, frame.renderPasses[1]->quad_list.size());
+ frame.render_passes[2]->quad_list[1]->rect.ToString());
+ ASSERT_EQ(1u, frame.render_passes[1]->quad_list.size());
EXPECT_EQ(gfx::Rect(0, 0, 6, 6).ToString(),
- frame.renderPasses[1]->quad_list[0]->rect.ToString());
+ frame.render_passes[1]->quad_list[0]->rect.ToString());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
// added one pass.
- ASSERT_EQ(6u, frame.renderPasses.size());
+ ASSERT_EQ(6u, frame.render_passes.size());
// The layer's target is the RenderPass owned by itself.
- EXPECT_EQ(RenderPass::Id(4, 0), frame.renderPasses[3]->id);
+ EXPECT_EQ(RenderPass::Id(4, 0), frame.render_passes[3]->id);
// The DelegatedRendererLayer should have added copies of quads in its root
// RenderPass to its target RenderPass.
// The m_layer_after also adds one quad.
- ASSERT_EQ(1u, frame.renderPasses[3]->quad_list.size());
+ ASSERT_EQ(1u, frame.render_passes[3]->quad_list.size());
// Verify it added the right quads.
EXPECT_EQ(gfx::Rect(7, 7, 7, 7).ToString(),
- frame.renderPasses[3]->quad_list[0]->rect.ToString());
+ frame.render_passes[3]->quad_list[0]->rect.ToString());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface,
QuadsFromRootRenderPassAreNotModifiedForTheTarget) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
// Each non-DelegatedRendererLayer added one RenderPass. The
// DelegatedRendererLayer added two contributing passes and its owned surface
// added one pass.
- ASSERT_EQ(6u, frame.renderPasses.size());
+ ASSERT_EQ(6u, frame.render_passes.size());
// Because the DelegatedRendererLayer owns a RenderSurfaceImpl, its root
// RenderPass' quads do not need to be translated at all. However, they are
@@ -436,20 +436,20 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface,
gfx::Transform transform;
transform.Scale(10.0 / 8.0, 10.0 / 8.0);
EXPECT_TRANSFORMATION_MATRIX_EQ(
- transform, frame.renderPasses[3]->quad_list[0]->quadTransform());
+ transform, frame.render_passes[3]->quad_list[0]->quadTransform());
// Quads from non-root RenderPasses should not be shifted either.
- ASSERT_EQ(2u, frame.renderPasses[2]->quad_list.size());
+ ASSERT_EQ(2u, frame.render_passes[2]->quad_list.size());
EXPECT_TRANSFORMATION_MATRIX_EQ(
- gfx::Transform(), frame.renderPasses[2]->quad_list[0]->quadTransform());
+ gfx::Transform(), frame.render_passes[2]->quad_list[0]->quadTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(
- gfx::Transform(), frame.renderPasses[2]->quad_list[1]->quadTransform());
- ASSERT_EQ(1u, frame.renderPasses[1]->quad_list.size());
+ gfx::Transform(), frame.render_passes[2]->quad_list[1]->quadTransform());
+ ASSERT_EQ(1u, frame.render_passes[1]->quad_list.size());
EXPECT_TRANSFORMATION_MATRIX_EQ(
- gfx::Transform(), frame.renderPasses[1]->quad_list[0]->quadTransform());
+ gfx::Transform(), frame.render_passes[1]->quad_list[0]->quadTransform());
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
class DelegatedRendererLayerImplTestTransform
@@ -457,11 +457,11 @@ class DelegatedRendererLayerImplTestTransform
public:
void SetUpTest() {
scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(
- host_impl_->activeTree(), 1);
+ host_impl_->active_tree(), 1);
scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer =
- FakeDelegatedRendererLayerImpl::Create(host_impl_->activeTree(), 2);
+ FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 2);
- host_impl_->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
root_layer->SetBounds(gfx::Size(100, 100));
delegated_renderer_layer->SetPosition(gfx::Point(20, 20));
@@ -526,7 +526,8 @@ class DelegatedRendererLayerImplTestTransform
gfx::Transform());
MockQuadCuller quad_sink(pass->quad_list, pass->shared_quad_state_list);
AppendQuadsData data(pass->id);
- SharedQuadState* shared_quad_state = quad_sink.useSharedQuadState(SharedQuadState::Create());
+ SharedQuadState* shared_quad_state =
+ quad_sink.useSharedQuadState(SharedQuadState::Create());
shared_quad_state->SetAll(
root_pass_transform,
root_pass_content_bounds,
@@ -577,7 +578,7 @@ class DelegatedRendererLayerImplTestTransform
delegated_renderer_layer_ = delegated_renderer_layer.get();
root_layer->AddChild(delegated_renderer_layer.PassAs<LayerImpl>());
- host_impl_->activeTree()->SetRootLayer(root_layer.Pass());
+ host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
}
void VerifyRenderPasses(
@@ -585,19 +586,20 @@ class DelegatedRendererLayerImplTestTransform
size_t num_render_passes,
const SharedQuadState** root_delegated_shared_quad_state,
const SharedQuadState** contrib_delegated_shared_quad_state) {
- ASSERT_EQ(num_render_passes, frame.renderPasses.size());
+ ASSERT_EQ(num_render_passes, frame.render_passes.size());
// The contributing render pass in the DelegatedRendererLayer.
- EXPECT_EQ(2, frame.renderPasses[0]->id.layer_id);
- EXPECT_EQ(1, frame.renderPasses[0]->id.index);
+ EXPECT_EQ(2, frame.render_passes[0]->id.layer_id);
+ EXPECT_EQ(1, frame.render_passes[0]->id.index);
// The root render pass.
- EXPECT_EQ(1, frame.renderPasses.back()->id.layer_id);
- EXPECT_EQ(0, frame.renderPasses.back()->id.index);
+ EXPECT_EQ(1, frame.render_passes.back()->id.layer_id);
+ EXPECT_EQ(0, frame.render_passes.back()->id.index);
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list =
+ frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
// All quads in a render pass should share the same state.
@@ -632,7 +634,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_NoSurface) {
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -677,8 +679,8 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_NoSurface) {
expected,
contrib_delegated_shared_quad_state->content_to_target_transform);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_NoSurface) {
@@ -686,7 +688,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_NoSurface) {
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -736,8 +738,8 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_NoSurface) {
expected,
contrib_delegated_shared_quad_state->content_to_target_transform);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_Surface) {
@@ -747,7 +749,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_Surface) {
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -791,8 +793,8 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsUnclipped_Surface) {
expected,
contrib_delegated_shared_quad_state->content_to_target_transform);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_Surface) {
@@ -802,7 +804,7 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_Surface) {
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
const SharedQuadState* root_delegated_shared_quad_state = NULL;
const SharedQuadState* contrib_delegated_shared_quad_state = NULL;
@@ -845,8 +847,8 @@ TEST_F(DelegatedRendererLayerImplTestTransform, QuadsClipped_Surface) {
expected,
contrib_delegated_shared_quad_state->content_to_target_transform);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
class DelegatedRendererLayerImplTestClip
@@ -854,15 +856,15 @@ class DelegatedRendererLayerImplTestClip
public:
void SetUpTest() {
scoped_ptr<LayerImpl> root_layer =
- LayerImpl::Create(host_impl_->activeTree(), 1);
+ LayerImpl::Create(host_impl_->active_tree(), 1);
scoped_ptr<FakeDelegatedRendererLayerImpl> delegated_renderer_layer =
- FakeDelegatedRendererLayerImpl::Create(host_impl_->activeTree(), 2);
+ FakeDelegatedRendererLayerImpl::Create(host_impl_->active_tree(), 2);
scoped_ptr<LayerImpl> clip_layer =
- LayerImpl::Create(host_impl_->activeTree(), 3);
+ LayerImpl::Create(host_impl_->active_tree(), 3);
scoped_ptr<LayerImpl> origin_layer =
- LayerImpl::Create(host_impl_->activeTree(), 4);
+ LayerImpl::Create(host_impl_->active_tree(), 4);
- host_impl_->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
root_layer->SetBounds(gfx::Size(100, 100));
delegated_renderer_layer->SetPosition(gfx::Point(20, 20));
@@ -987,7 +989,7 @@ class DelegatedRendererLayerImplTestClip
root_layer->AddChild(delegated_renderer_layer.PassAs<LayerImpl>());
}
- host_impl_->activeTree()->SetRootLayer(root_layer.Pass());
+ host_impl_->active_tree()->SetRootLayer(root_layer.Pass());
}
protected:
@@ -1004,13 +1006,13 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(2u, frame.renderPasses.size());
+ ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1024,8 +1026,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// Quads are clipped to the delegated renderer layer.
EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip,
@@ -1035,14 +1037,14 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(2u, frame.renderPasses.size());
+ ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
const QuadList& root_delegated_quad_list =
- frame.renderPasses[1]->quad_list;
+ frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1055,8 +1057,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// Quads came with a clip rect.
EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip,
@@ -1066,13 +1068,13 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(2u, frame.renderPasses.size());
+ ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1087,8 +1089,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// Quads are clipped to the delegated renderer layer.
EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip,
@@ -1098,13 +1100,13 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(2u, frame.renderPasses.size());
+ ASSERT_EQ(2u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1118,8 +1120,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// Quads came with a clip rect.
EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip,
@@ -1131,13 +1133,13 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(3u, frame.renderPasses.size());
+ ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1149,8 +1151,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// clip rect is ignored, and they are not set as clipped.
EXPECT_FALSE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip,
@@ -1162,14 +1164,16 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(3u, frame.renderPasses.size());
- const QuadList& contrib_delegated_quad_list = frame.renderPasses[0]->quad_list;
+ ASSERT_EQ(3u, frame.render_passes.size());
+ const QuadList& contrib_delegated_quad_list =
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
- const SharedQuadState* root_delegated_shared_quad_state = root_delegated_quad_list[0]->shared_quad_state;
+ const SharedQuadState* root_delegated_shared_quad_state =
+ root_delegated_quad_list[0]->shared_quad_state;
const SharedQuadState* contrib_delegated_shared_quad_state =
contrib_delegated_quad_list[0]->shared_quad_state;
@@ -1179,8 +1183,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// Quads came with a clip rect.
EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip,
@@ -1192,13 +1196,13 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(3u, frame.renderPasses.size());
+ ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1210,8 +1214,8 @@ TEST_F(DelegatedRendererLayerImplTestClip,
// clip rect is ignored, and they are not set as clipped.
EXPECT_FALSE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
TEST_F(DelegatedRendererLayerImplTestClip, QuadsClipped_LayerClipped_Surface) {
@@ -1222,13 +1226,13 @@ TEST_F(DelegatedRendererLayerImplTestClip, QuadsClipped_LayerClipped_Surface) {
delegated_renderer_layer_->SetForceRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(host_impl_->prepareToDraw(frame));
+ EXPECT_TRUE(host_impl_->PrepareToDraw(&frame));
- ASSERT_EQ(3u, frame.renderPasses.size());
+ ASSERT_EQ(3u, frame.render_passes.size());
const QuadList& contrib_delegated_quad_list =
- frame.renderPasses[0]->quad_list;
+ frame.render_passes[0]->quad_list;
ASSERT_EQ(2u, contrib_delegated_quad_list.size());
- const QuadList& root_delegated_quad_list = frame.renderPasses[1]->quad_list;
+ const QuadList& root_delegated_quad_list = frame.render_passes[1]->quad_list;
ASSERT_EQ(5u, root_delegated_quad_list.size());
const SharedQuadState* root_delegated_shared_quad_state =
root_delegated_quad_list[0]->shared_quad_state;
@@ -1243,8 +1247,8 @@ TEST_F(DelegatedRendererLayerImplTestClip, QuadsClipped_LayerClipped_Surface) {
// Quads came with a clip rect.
EXPECT_TRUE(root_delegated_shared_quad_state->is_clipped);
- host_impl_->drawLayers(frame);
- host_impl_->didDrawAllLayers(frame);
+ host_impl_->DrawLayers(&frame);
+ host_impl_->DidDrawAllLayers(frame);
}
} // namespace
diff --git a/cc/delegating_renderer_unittest.cc b/cc/delegating_renderer_unittest.cc
index 59d633f..69e5a46 100644
--- a/cc/delegating_renderer_unittest.cc
+++ b/cc/delegating_renderer_unittest.cc
@@ -44,7 +44,7 @@ class DelegatingRendererTestDraw : public DelegatingRendererTest {
virtual void afterTest() OVERRIDE {}
virtual bool prepareToDrawOnThread(
- LayerTreeHostImpl*, LayerTreeHostImpl::FrameData& frame, bool result)
+ LayerTreeHostImpl*, LayerTreeHostImpl::FrameData* frame, bool result)
OVERRIDE {
EXPECT_EQ(0u, output_surface_->num_sent_frames());
@@ -64,7 +64,7 @@ class DelegatingRendererTestDraw : public DelegatingRendererTest {
ASSERT_TRUE(last_frame.delegated_frame_data);
EXPECT_FALSE(last_frame.gl_frame_data);
EXPECT_EQ(
- gfx::Rect(host_impl->DeviceViewportSize()).ToString(),
+ gfx::Rect(host_impl->device_viewport_size()).ToString(),
last_frame_data->render_pass_list.back()->output_rect.ToString());
EXPECT_EQ(0.5f, last_frame.metadata.min_page_scale_factor);
EXPECT_EQ(4.f, last_frame.metadata.max_page_scale_factor);
@@ -89,27 +89,27 @@ class DelegatingRendererTestResources : public DelegatingRendererTest {
virtual bool prepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData& frame,
+ LayerTreeHostImpl::FrameData* frame,
bool result) OVERRIDE {
- frame.renderPasses.clear();
- frame.renderPassesById.clear();
+ frame->render_passes.clear();
+ frame->render_passes_by_id.clear();
TestRenderPass* child_pass = addRenderPass(
- frame.renderPasses,
+ frame->render_passes,
RenderPass::Id(2, 1),
gfx::Rect(3, 3, 10, 10),
gfx::Transform());
child_pass->AppendOneOfEveryQuadType(
- host_impl->resourceProvider(), RenderPass::Id(0, 0));
+ host_impl->resource_provider(), RenderPass::Id(0, 0));
TestRenderPass* pass = addRenderPass(
- frame.renderPasses,
+ frame->render_passes,
RenderPass::Id(1, 1),
gfx::Rect(3, 3, 10, 10),
gfx::Transform());
pass->AppendOneOfEveryQuadType(
- host_impl->resourceProvider(), child_pass->id);
+ host_impl->resource_provider(), child_pass->id);
return true;
}
diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc
index b844690..f9c24ba 100644
--- a/cc/gl_renderer_unittest.cc
+++ b/cc/gl_renderer_unittest.cc
@@ -67,7 +67,7 @@ public:
: m_hostImpl(&m_proxy)
, m_setFullRootLayerDamageCount(0)
, m_lastCallWasSetVisibility(0)
- , m_rootLayer(LayerImpl::Create(m_hostImpl.activeTree(), 1))
+ , m_rootLayer(LayerImpl::Create(m_hostImpl.active_tree(), 1))
, m_memoryAllocationLimitBytes(PrioritizedResourceManager::defaultMemoryAllocationLimit())
{
m_rootLayer->CreateRenderSurface();
diff --git a/cc/input_handler.h b/cc/input_handler.h
index 712fa608..e6314b5 100644
--- a/cc/input_handler.h
+++ b/cc/input_handler.h
@@ -27,70 +27,72 @@ namespace cc {
// The InputHandler is constructed with a InputHandlerClient, which is the
// interface by which the handler can manipulate the LayerTree.
class CC_EXPORT InputHandlerClient {
-public:
- enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored };
- enum ScrollInputType { Gesture, Wheel, NonBubblingGesture };
-
- // Selects a layer to be scrolled at a given point in viewport (logical
- // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates
- // can be scrolled, ScrollOnMainThread if the scroll event should instead be
- // delegated to the main thread, or ScrollIgnored if there is nothing to be
- // scrolled at the given coordinates.
- virtual ScrollStatus scrollBegin(gfx::Point, ScrollInputType) = 0;
-
- // Scroll the selected layer starting at the given position. If the scroll
- // type given to scrollBegin was a gesture, then the scroll point and delta
- // should be in viewport (logical pixel) coordinates. Otherwise they are in
- // scrolling layer's (logical pixel) space. If there is no room to move the
- // layer in the requested direction, its first ancestor layer that can be
- // scrolled will be moved instead. If no layer can be moved in the requested
- // direction at all, then false is returned. If any layer is moved, then
- // true is returned.
- // Should only be called if scrollBegin() returned ScrollStarted.
- virtual bool scrollBy(const gfx::Point&, const gfx::Vector2dF&) = 0;
-
- // Stop scrolling the selected layer. Should only be called if scrollBegin()
- // returned ScrollStarted.
- virtual void scrollEnd() = 0;
-
- virtual void pinchGestureBegin() = 0;
- virtual void pinchGestureUpdate(float magnifyDelta, gfx::Point anchor) = 0;
- virtual void pinchGestureEnd() = 0;
-
- virtual void startPageScaleAnimation(gfx::Vector2d targetOffset,
- bool anchorPoint,
- float pageScale,
- base::TimeTicks startTime,
- base::TimeDelta duration) = 0;
-
- // Request another callback to InputHandler::animate().
- virtual void scheduleAnimation() = 0;
-
- virtual bool haveTouchEventHandlersAt(const gfx::Point&) = 0;
-
-protected:
- InputHandlerClient() { }
- virtual ~InputHandlerClient() { }
-
-private:
- DISALLOW_COPY_AND_ASSIGN(InputHandlerClient);
+ public:
+ enum ScrollStatus { ScrollOnMainThread, ScrollStarted, ScrollIgnored };
+ enum ScrollInputType { Gesture, Wheel, NonBubblingGesture };
+
+ // Selects a layer to be scrolled at a given point in viewport (logical
+ // pixel) coordinates. Returns ScrollStarted if the layer at the coordinates
+ // can be scrolled, ScrollOnMainThread if the scroll event should instead be
+ // delegated to the main thread, or ScrollIgnored if there is nothing to be
+ // scrolled at the given coordinates.
+ virtual ScrollStatus ScrollBegin(gfx::Point viewport_point,
+ ScrollInputType type) = 0;
+
+ // Scroll the selected layer starting at the given position. If the scroll
+ // type given to scrollBegin was a gesture, then the scroll point and delta
+ // should be in viewport (logical pixel) coordinates. Otherwise they are in
+ // scrolling layer's (logical pixel) space. If there is no room to move the
+ // layer in the requested direction, its first ancestor layer that can be
+ // scrolled will be moved instead. If no layer can be moved in the requested
+ // direction at all, then false is returned. If any layer is moved, then
+ // true is returned.
+ // Should only be called if ScrollBegin() returned ScrollStarted.
+ virtual bool ScrollBy(gfx::Point viewport_point,
+ gfx::Vector2dF scroll_delta) = 0;
+
+ // Stop scrolling the selected layer. Should only be called if ScrollBegin()
+ // returned ScrollStarted.
+ virtual void ScrollEnd() = 0;
+
+ virtual void PinchGestureBegin() = 0;
+ virtual void PinchGestureUpdate(float magnify_delta, gfx::Point anchor) = 0;
+ virtual void PinchGestureEnd() = 0;
+
+ virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
+ bool anchor_point,
+ float page_scale,
+ base::TimeTicks start_time,
+ base::TimeDelta duration) = 0;
+
+ // Request another callback to InputHandler::Animate().
+ virtual void ScheduleAnimation() = 0;
+
+ virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_point) = 0;
+
+ protected:
+ InputHandlerClient() {}
+ virtual ~InputHandlerClient() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InputHandlerClient);
};
class CC_EXPORT InputHandler {
-public:
- virtual ~InputHandler() { }
+ public:
+ virtual ~InputHandler() {}
- virtual void bindToClient(InputHandlerClient*) = 0;
- virtual void animate(base::TimeTicks time) = 0;
- virtual void mainThreadHasStoppedFlinging() = 0;
+ virtual void BindToClient(InputHandlerClient* client) = 0;
+ virtual void Animate(base::TimeTicks time) = 0;
+ virtual void MainThreadHasStoppedFlinging() = 0;
-protected:
- InputHandler() { }
+ protected:
+ InputHandler() {}
-private:
- DISALLOW_COPY_AND_ASSIGN(InputHandler);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(InputHandler);
};
-}
+} // namespace cc
#endif // CC_INPUT_HANDLER_H_
diff --git a/cc/layer_impl_unittest.cc b/cc/layer_impl_unittest.cc
index 56e4163..fbca63b 100644
--- a/cc/layer_impl_unittest.cc
+++ b/cc/layer_impl_unittest.cc
@@ -53,19 +53,19 @@ namespace {
EXPECT_FALSE(grandChild->LayerPropertyChanged()); \
EXPECT_TRUE(root->LayerSurfacePropertyChanged())
-#define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(codeToTest) \
- root->ResetAllChangeTrackingForSubtree(); \
- hostImpl.forcePrepareToDraw(); \
- EXPECT_FALSE(hostImpl.activeTree()->needs_update_draw_properties());\
- codeToTest; \
- EXPECT_TRUE(hostImpl.activeTree()->needs_update_draw_properties());
-
-#define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(codeToTest) \
- root->ResetAllChangeTrackingForSubtree(); \
- hostImpl.forcePrepareToDraw(); \
- EXPECT_FALSE(hostImpl.activeTree()->needs_update_draw_properties());\
- codeToTest; \
- EXPECT_FALSE(hostImpl.activeTree()->needs_update_draw_properties());
+#define VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(codeToTest) \
+ root->ResetAllChangeTrackingForSubtree(); \
+ hostImpl.ForcePrepareToDraw(); \
+ EXPECT_FALSE(hostImpl.active_tree()->needs_update_draw_properties()); \
+ codeToTest; \
+ EXPECT_TRUE(hostImpl.active_tree()->needs_update_draw_properties());
+
+#define VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(codeToTest) \
+ root->ResetAllChangeTrackingForSubtree(); \
+ hostImpl.ForcePrepareToDraw(); \
+ EXPECT_FALSE(hostImpl.active_tree()->needs_update_draw_properties()); \
+ codeToTest; \
+ EXPECT_FALSE(hostImpl.active_tree()->needs_update_draw_properties());
TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly)
{
@@ -77,11 +77,11 @@ TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly)
// Create a simple LayerImpl tree:
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- EXPECT_TRUE(hostImpl.initializeRenderer(createFakeOutputSurface()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
- root->AddChild(LayerImpl::Create(hostImpl.activeTree(), 2));
+ EXPECT_TRUE(hostImpl.InitializeRenderer(createFakeOutputSurface()));
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
+ root->AddChild(LayerImpl::Create(hostImpl.active_tree(), 2));
LayerImpl* child = root->children()[0];
- child->AddChild(LayerImpl::Create(hostImpl.activeTree(), 3));
+ child->AddChild(LayerImpl::Create(hostImpl.active_tree(), 3));
LayerImpl* grandChild = child->children()[0];
// Adding children is an internal operation and should not mark layers as changed.
@@ -113,10 +113,10 @@ TEST(LayerImplTest, verifyLayerChangesAreTrackedProperly)
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(arbitraryFilters));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilters(WebFilterOperations()));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetFilter(arbitraryFilter));
- EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMaskLayer(LayerImpl::Create(hostImpl.activeTree(), 4)));
+ EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMaskLayer(LayerImpl::Create(hostImpl.active_tree(), 4)));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetMasksToBounds(true));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetContentsOpaque(true));
- EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetReplicaLayer(LayerImpl::Create(hostImpl.activeTree(), 5)));
+ EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetReplicaLayer(LayerImpl::Create(hostImpl.active_tree(), 5)));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPosition(arbitraryPointF));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetPreserves3d(true));
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetDoubleSided(false)); // constructor initializes it to "true".
@@ -174,8 +174,8 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- EXPECT_TRUE(hostImpl.initializeRenderer(createFakeOutputSurface()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ EXPECT_TRUE(hostImpl.InitializeRenderer(createFakeOutputSurface()));
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
gfx::PointF arbitraryPointF = gfx::PointF(0.125f, 0.25f);
float arbitraryNumber = 0.352f;
@@ -205,7 +205,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties)
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->ScrollBy(arbitraryVector2d));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->ScrollBy(gfx::Vector2d()));
root->SetScrollDelta(gfx::Vector2d(0, 0));
- hostImpl.forcePrepareToDraw();
+ hostImpl.ForcePrepareToDraw();
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetScrollDelta(arbitraryVector2d));
VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetScrollDelta(arbitraryVector2d));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetScrollOffset(arbitraryVector2d));
@@ -213,10 +213,10 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties)
// Unrelated functions, always set to new values, always set needs update.
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetAnchorPointZ(arbitraryNumber));
- VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMaskLayer(LayerImpl::Create(hostImpl.activeTree(), 4)));
+ VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMaskLayer(LayerImpl::Create(hostImpl.active_tree(), 4)));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetMasksToBounds(true));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetContentsOpaque(true));
- VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetReplicaLayer(LayerImpl::Create(hostImpl.activeTree(), 5)));
+ VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetReplicaLayer(LayerImpl::Create(hostImpl.active_tree(), 5)));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPosition(arbitraryPointF));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetPreserves3d(true));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(root->SetDoubleSided(false)); // constructor initializes it to "true".
diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc
index 3a492b9..58f653b 100644
--- a/cc/layer_sorter_unittest.cc
+++ b/cc/layer_sorter_unittest.cc
@@ -212,11 +212,11 @@ TEST(LayerSorterTest, VerifyExistingOrderingPreservedWhenNoZDiff) {
FakeImplProxy proxy;
FakeLayerTreeHostImpl host_impl(&proxy);
- scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.activeTree(), 1);
- scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.activeTree(), 2);
- scoped_ptr<LayerImpl> layer3 = LayerImpl::Create(host_impl.activeTree(), 3);
- scoped_ptr<LayerImpl> layer4 = LayerImpl::Create(host_impl.activeTree(), 4);
- scoped_ptr<LayerImpl> layer5 = LayerImpl::Create(host_impl.activeTree(), 5);
+ scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1);
+ scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2);
+ scoped_ptr<LayerImpl> layer3 = LayerImpl::Create(host_impl.active_tree(), 3);
+ scoped_ptr<LayerImpl> layer4 = LayerImpl::Create(host_impl.active_tree(), 4);
+ scoped_ptr<LayerImpl> layer5 = LayerImpl::Create(host_impl.active_tree(), 5);
gfx::Transform BehindMatrix;
BehindMatrix.Translate3d(0.0, 0.0, 2.0);
@@ -277,8 +277,8 @@ TEST(LayerSorterTest, VerifyConcidentLayerPrecisionLossResultsInDocumentOrder) {
FakeImplProxy proxy;
FakeLayerTreeHostImpl host_impl(&proxy);
- scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.activeTree(), 1);
- scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.activeTree(), 2);
+ scoped_ptr<LayerImpl> layer1 = LayerImpl::Create(host_impl.active_tree(), 1);
+ scoped_ptr<LayerImpl> layer2 = LayerImpl::Create(host_impl.active_tree(), 2);
// Layer 1 should occur before layer 2 in paint. However, due to numeric
// issues in the sorter, it will put the layers in the wrong order
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 8bee454..b56bdde 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -266,19 +266,19 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
LayerTreeImpl* sync_tree;
if (settings_.implSidePainting) {
// Commits should not occur while there is already a pending tree.
- DCHECK(!host_impl->pendingTree());
- host_impl->createPendingTree();
- sync_tree = host_impl->pendingTree();
+ DCHECK(!host_impl->pending_tree());
+ host_impl->CreatePendingTree();
+ sync_tree = host_impl->pending_tree();
} else {
- contents_texture_manager_->reduceMemory(host_impl->resourceProvider());
- sync_tree = host_impl->activeTree();
+ contents_texture_manager_->reduceMemory(host_impl->resource_provider());
+ sync_tree = host_impl->active_tree();
}
if (needs_full_tree_sync_)
sync_tree->SetRootLayer(TreeSynchronizer::synchronizeTrees(
root_layer(), sync_tree->DetachLayerTree(), sync_tree)); {
TRACE_EVENT0("cc", "LayerTreeHost::PushProperties");
- TreeSynchronizer::pushProperties(root_layer(), sync_tree->RootLayer());
+ TreeSynchronizer::pushProperties(root_layer(), sync_tree->root_layer());
}
sync_tree->set_needs_full_tree_sync(needs_full_tree_sync_);
@@ -286,7 +286,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
if (root_layer_ && hud_layer_) {
LayerImpl* hud_impl = LayerTreeHostCommon::findLayerInSubtree(
- sync_tree->RootLayer(), hud_layer_->id());
+ sync_tree->root_layer(), hud_layer_->id());
sync_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(hud_impl));
} else {
sync_tree->set_hud_layer(NULL);
@@ -304,8 +304,8 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
// adjusted its delta prior to the pending tree being created.
// This code is equivalent to that in LayerTreeImpl::SetPageScaleDelta.
DCHECK_EQ(1.f, sync_tree->sent_page_scale_delta());
- page_scale_delta = host_impl->activeTree()->page_scale_delta();
- sent_page_scale_delta = host_impl->activeTree()->sent_page_scale_delta();
+ page_scale_delta = host_impl->active_tree()->page_scale_delta();
+ sent_page_scale_delta = host_impl->active_tree()->sent_page_scale_delta();
} else {
page_scale_delta = sync_tree->page_scale_delta();
sent_page_scale_delta = sync_tree->sent_page_scale_delta();
@@ -317,9 +317,9 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
max_page_scale_factor_);
sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta);
- host_impl->setViewportSize(layout_viewport_size_, device_viewport_size_);
- host_impl->setDeviceScaleFactor(device_scale_factor_);
- host_impl->setDebugState(debug_state_);
+ host_impl->SetViewportSize(layout_viewport_size_, device_viewport_size_);
+ host_impl->SetDeviceScaleFactor(device_scale_factor_);
+ host_impl->SetDebugState(debug_state_);
DCHECK(!sync_tree->ViewportSizeInvalid());
@@ -335,7 +335,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
}
if (debug_state_.continuousPainting)
- host_impl->savePaintTime(rendering_stats_.totalPaintTime, commit_number());
+ host_impl->SavePaintTime(rendering_stats_.totalPaintTime, commit_number());
commit_number_++;
}
@@ -373,11 +373,11 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
LayerTreeHostImplClient* client) {
DCHECK(proxy_->IsImplThread());
scoped_ptr<LayerTreeHostImpl> host_impl =
- LayerTreeHostImpl::create(settings_, client, proxy_.get());
+ LayerTreeHostImpl::Create(settings_, client, proxy_.get());
if (settings_.calculateTopControlsPosition &&
- host_impl->topControlsManager()) {
+ host_impl->top_controls_manager()) {
top_controls_manager_weak_ptr_ =
- host_impl->topControlsManager()->AsWeakPtr();
+ host_impl->top_controls_manager()->AsWeakPtr();
}
return host_impl.Pass();
}
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index 1228d63..f690047 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -77,10 +77,10 @@ void executeCalculateDrawProperties(LayerImpl* rootLayer, float deviceScaleFacto
scoped_ptr<LayerImpl> createTreeForFixedPositionTests(LayerTreeHostImpl* hostImpl)
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl->activeTree(), 1);
- scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl->activeTree(), 2);
- scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(hostImpl->activeTree(), 3);
- scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::Create(hostImpl->activeTree(), 4);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl->active_tree(), 1);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl->active_tree(), 2);
+ scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(hostImpl->active_tree(), 3);
+ scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::Create(hostImpl->active_tree(), 4);
gfx::Transform IdentityMatrix;
gfx::PointF anchor(0, 0);
@@ -270,12 +270,12 @@ TEST(LayerTreeHostCommonTest, verifyTransformsAboutScrollOffset)
FakeLayerTreeHostImpl hostImpl(&proxy);
gfx::Transform identityMatrix;
- scoped_ptr<LayerImpl> sublayerScopedPtr(LayerImpl::Create(hostImpl.activeTree(), 1));
+ scoped_ptr<LayerImpl> sublayerScopedPtr(LayerImpl::Create(hostImpl.active_tree(), 1));
LayerImpl* sublayer = sublayerScopedPtr.get();
sublayer->SetContentsScale(kPageScale * kDeviceScale, kPageScale * kDeviceScale);
setLayerPropertiesForTesting(sublayer, identityMatrix, identityMatrix, gfx::Point(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
- scoped_ptr<LayerImpl> scrollLayerScopedPtr(LayerImpl::Create(hostImpl.activeTree(), 2));
+ scoped_ptr<LayerImpl> scrollLayerScopedPtr(LayerImpl::Create(hostImpl.active_tree(), 2));
LayerImpl* scrollLayer = scrollLayerScopedPtr.get();
setLayerPropertiesForTesting(scrollLayer, identityMatrix, identityMatrix, gfx::PointF(0, 0), kScrollLayerPosition, gfx::Size(10, 20), false);
scrollLayer->SetScrollable(true);
@@ -286,7 +286,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsAboutScrollOffset)
scrollLayer->SetImplTransform(implTransform);
scrollLayer->AddChild(sublayerScopedPtr.Pass());
- scoped_ptr<LayerImpl> root(LayerImpl::Create(hostImpl.activeTree(), 3));
+ scoped_ptr<LayerImpl> root(LayerImpl::Create(hostImpl.active_tree(), 3));
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
root->AddChild(scrollLayerScopedPtr.Pass());
@@ -1303,7 +1303,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
// Add one more layer to the test tree for this scenario.
{
gfx::Transform identity;
- scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::Create(hostImpl.activeTree(), 5);
+ scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::Create(hostImpl.active_tree(), 5);
setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
greatGrandChild->AddChild(fixedPositionChild.Pass());
}
@@ -2978,7 +2978,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -3020,8 +3020,8 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerAndHud)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
- scoped_ptr<HeadsUpDisplayLayerImpl> hud = HeadsUpDisplayLayerImpl::Create(hostImpl.activeTree(), 11111);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
+ scoped_ptr<HeadsUpDisplayLayerImpl> hud = HeadsUpDisplayLayerImpl::Create(hostImpl.active_tree(), 11111);
gfx::Transform identityMatrix;
gfx::PointF anchor(0.f, 0.f);
@@ -3035,7 +3035,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerAndHud)
setLayerPropertiesForTesting(hud.get(), identityMatrix, identityMatrix, anchor, position, hudBounds, false);
hud->SetDrawsContent(true);
- hostImpl.activeTree()->set_hud_layer(hud.get());
+ hostImpl.active_tree()->set_hud_layer(hud.get());
root->AddChild(hud.PassAs<LayerImpl>());
std::vector<LayerImpl*> renderSurfaceLayerList;
@@ -3071,7 +3071,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform uninvertibleTransform;
uninvertibleTransform.matrix().setDouble(0, 0, 0);
@@ -3132,7 +3132,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -3175,7 +3175,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform identityMatrix;
gfx::Transform rotation45DegreesAboutCenter;
@@ -3226,7 +3226,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform identityMatrix;
@@ -3288,7 +3288,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
//
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -3298,7 +3298,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
{
gfx::PointF position(25, 25);
gfx::Size bounds(50, 50);
- scoped_ptr<LayerImpl> testLayer = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> testLayer = LayerImpl::Create(hostImpl.active_tree(), 12345);
setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// override contentBounds and contentsScale
@@ -3354,17 +3354,17 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
- scoped_ptr<LayerImpl> clippingLayer = LayerImpl::Create(hostImpl.activeTree(), 123);
+ scoped_ptr<LayerImpl> clippingLayer = LayerImpl::Create(hostImpl.active_tree(), 123);
gfx::PointF position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
clippingLayer->SetMasksToBounds(true);
- scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.activeTree(), 456);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.active_tree(), 456);
position = gfx::PointF(-50, -50);
bounds = gfx::Size(300, 300);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
@@ -3419,7 +3419,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
//
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 123);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 123);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -3429,9 +3429,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
root->SetMasksToBounds(true);
{
- scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.activeTree(), 456);
- scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(hostImpl.activeTree(), 789);
- scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::Create(hostImpl.activeTree(), 2468);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.active_tree(), 456);
+ scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(hostImpl.active_tree(), 789);
+ scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::Create(hostImpl.active_tree(), 2468);
position = gfx::PointF(10, 10);
bounds = gfx::Size(80, 80);
@@ -3522,11 +3522,11 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
- scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::Create(hostImpl.activeTree(), 123);
+ scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::Create(hostImpl.active_tree(), 123);
gfx::PointF position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located.
gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
@@ -3536,7 +3536,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
// The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all.
// If child is incorrectly clipped, we would not be able to hit it successfully.
- scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.activeTree(), 456);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.active_tree(), 456);
position = gfx::PointF(60, 60); // 70, 70 in screen space
bounds = gfx::Size(20, 20);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
@@ -3580,7 +3580,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -3595,9 +3595,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
// The expected stacking order is:
// (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
- scoped_ptr<LayerImpl> child1 = LayerImpl::Create(hostImpl.activeTree(), 2);
- scoped_ptr<LayerImpl> child2 = LayerImpl::Create(hostImpl.activeTree(), 3);
- scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(hostImpl.activeTree(), 4);
+ scoped_ptr<LayerImpl> child1 = LayerImpl::Create(hostImpl.active_tree(), 2);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(hostImpl.active_tree(), 3);
+ scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(hostImpl.active_tree(), 4);
position = gfx::PointF(10, 10);
bounds = gfx::Size(50, 50);
@@ -3685,7 +3685,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
//
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -3700,9 +3700,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
// The expected stacking order is:
// (front) child2, (second) grandChild, (third) child1, and (back) the root layer behind all other layers.
- scoped_ptr<LayerImpl> child1 = LayerImpl::Create(hostImpl.activeTree(), 2);
- scoped_ptr<LayerImpl> child2 = LayerImpl::Create(hostImpl.activeTree(), 3);
- scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(hostImpl.activeTree(), 4);
+ scoped_ptr<LayerImpl> child1 = LayerImpl::Create(hostImpl.active_tree(), 2);
+ scoped_ptr<LayerImpl> child2 = LayerImpl::Create(hostImpl.active_tree(), 3);
+ scoped_ptr<LayerImpl> grandChild1 = LayerImpl::Create(hostImpl.active_tree(), 4);
position = gfx::PointF(10, 10);
bounds = gfx::Size(50, 50);
@@ -3809,7 +3809,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform identityMatrix;
Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
@@ -3867,7 +3867,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForUninvertibl
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform uninvertibleTransform;
uninvertibleTransform.matrix().setDouble(0, 0, 0);
@@ -3930,7 +3930,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSinglePosit
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 12345);
gfx::Transform identityMatrix;
Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
@@ -3990,7 +3990,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
//
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -4001,7 +4001,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
Region touchHandlerRegion(gfx::Rect(10, 10, 30, 30));
gfx::PointF position(25, 25);
gfx::Size bounds(50, 50);
- scoped_ptr<LayerImpl> testLayer = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> testLayer = LayerImpl::Create(hostImpl.active_tree(), 12345);
setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// override contentBounds and contentsScale
@@ -4064,7 +4064,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
// be able to hit the touch handler region by scaling the points accordingly.
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
gfx::Transform identityMatrix;
gfx::PointF anchor(0, 0);
@@ -4075,7 +4075,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
Region touchHandlerRegion(gfx::Rect(10, 10, 30, 30));
gfx::PointF position(25, 25);
gfx::Size bounds(50, 50);
- scoped_ptr<LayerImpl> testLayer = LayerImpl::Create(hostImpl.activeTree(), 12345);
+ scoped_ptr<LayerImpl> testLayer = LayerImpl::Create(hostImpl.active_tree(), 12345);
setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
testLayer->SetDrawsContent(true);
@@ -4152,17 +4152,17 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSimpleClipp
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(hostImpl.active_tree(), 1);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
- scoped_ptr<LayerImpl> clippingLayer = LayerImpl::Create(hostImpl.activeTree(), 123);
+ scoped_ptr<LayerImpl> clippingLayer = LayerImpl::Create(hostImpl.active_tree(), 123);
gfx::PointF position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
clippingLayer->SetMasksToBounds(true);
- scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.activeTree(), 456);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(hostImpl.active_tree(), 456);
Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
position = gfx::PointF(-50, -50);
bounds = gfx::Size(300, 300);
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 3e20336..3c13252 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -50,1691 +50,1882 @@
namespace {
-void didVisibilityChange(cc::LayerTreeHostImpl* id, bool visible)
-{
- if (visible) {
- TRACE_EVENT_ASYNC_BEGIN1("webkit", "LayerTreeHostImpl::setVisible", id, "LayerTreeHostImpl", id);
- return;
- }
+void DidVisibilityChange(cc::LayerTreeHostImpl* id, bool visible) {
+ if (visible) {
+ TRACE_EVENT_ASYNC_BEGIN1("webkit",
+ "LayerTreeHostImpl::SetVisible",
+ id,
+ "LayerTreeHostImpl",
+ id);
+ return;
+ }
- TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::setVisible", id);
+ TRACE_EVENT_ASYNC_END0("webkit", "LayerTreeHostImpl::SetVisible", id);
}
-std::string ValueToString(scoped_ptr<base::Value> value)
-{
- std::string str;
- base::JSONWriter::Write(value.get(), &str);
- return str;
+std::string ValueToString(scoped_ptr<base::Value> value) {
+ std::string str;
+ base::JSONWriter::Write(value.get(), &str);
+ return str;
}
-} // namespace
+} // namespace
namespace cc {
class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
-public:
- static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> Create(LayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<DelayBasedTimeSource> timeSource)
- {
- return make_scoped_ptr(new LayerTreeHostImplTimeSourceAdapter(layerTreeHostImpl, timeSource));
- }
- virtual ~LayerTreeHostImplTimeSourceAdapter()
- {
- m_timeSource->setClient(0);
- m_timeSource->setActive(false);
- }
-
- virtual void onTimerTick() OVERRIDE
- {
- // In single threaded mode we attempt to simulate changing the current
- // thread by maintaining a fake thread id. When we switch from one
- // thread to another, we construct DebugScopedSetXXXThread objects that
- // update the thread id. This lets DCHECKS that ensure we're on the
- // right thread to work correctly in single threaded mode. The problem
- // here is that the timer tasks are run via the message loop, and when
- // they run, we've had no chance to construct a DebugScopedSetXXXThread
- // object. The result is that we report that we're running on the main
- // thread. In multi-threaded mode, this timer is run on the compositor
- // thread, so to keep this consistent in single-threaded mode, we'll
- // construct a DebugScopedSetImplThread object. There is no need to do
- // this in multi-threaded mode since the real thread id's will be
- // correct. In fact, setting fake thread id's interferes with the real
- // thread id's and causes breakage.
- scoped_ptr<DebugScopedSetImplThread> setImplThread;
- if (!m_layerTreeHostImpl->proxy()->HasImplThread())
- setImplThread.reset(new DebugScopedSetImplThread(m_layerTreeHostImpl->proxy()));
-
- m_layerTreeHostImpl->activatePendingTreeIfNeeded();
- m_layerTreeHostImpl->animate(base::TimeTicks::Now(), base::Time::Now());
- m_layerTreeHostImpl->beginNextFrame();
+ public:
+ static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> Create(
+ LayerTreeHostImpl* layer_tree_host_impl,
+ scoped_refptr<DelayBasedTimeSource> time_source) {
+ return make_scoped_ptr(
+ new LayerTreeHostImplTimeSourceAdapter(layer_tree_host_impl,
+ time_source));
+ }
+ virtual ~LayerTreeHostImplTimeSourceAdapter() {
+ time_source_->setClient(NULL);
+ time_source_->setActive(false);
+ }
+
+ virtual void onTimerTick() OVERRIDE {
+ // In single threaded mode we attempt to simulate changing the current
+ // thread by maintaining a fake thread id. When we switch from one
+ // thread to another, we construct DebugScopedSetXXXThread objects that
+ // update the thread id. This lets DCHECKS that ensure we're on the
+ // right thread to work correctly in single threaded mode. The problem
+ // here is that the timer tasks are run via the message loop, and when
+ // they run, we've had no chance to construct a DebugScopedSetXXXThread
+ // object. The result is that we report that we're running on the main
+ // thread. In multi-threaded mode, this timer is run on the compositor
+ // thread, so to keep this consistent in single-threaded mode, we'll
+ // construct a DebugScopedSetImplThread object. There is no need to do
+ // this in multi-threaded mode since the real thread id's will be
+ // correct. In fact, setting fake thread id's interferes with the real
+ // thread id's and causes breakage.
+ scoped_ptr<DebugScopedSetImplThread> set_impl_thread;
+ if (!layer_tree_host_impl_->proxy()->HasImplThread()) {
+ set_impl_thread.reset(
+ new DebugScopedSetImplThread(layer_tree_host_impl_->proxy()));
}
- void setActive(bool active)
- {
- if (active != m_timeSource->active())
- m_timeSource->setActive(active);
- }
-
-private:
- LayerTreeHostImplTimeSourceAdapter(LayerTreeHostImpl* layerTreeHostImpl, scoped_refptr<DelayBasedTimeSource> timeSource)
- : m_layerTreeHostImpl(layerTreeHostImpl)
- , m_timeSource(timeSource)
- {
- m_timeSource->setClient(this);
- }
-
- LayerTreeHostImpl* m_layerTreeHostImpl;
- scoped_refptr<DelayBasedTimeSource> m_timeSource;
-
- DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTimeSourceAdapter);
+ layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
+ layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now());
+ layer_tree_host_impl_->BeginNextFrame();
+ }
+
+ void SetActive(bool active) {
+ if (active != time_source_->active())
+ time_source_->setActive(active);
+ }
+
+ private:
+ LayerTreeHostImplTimeSourceAdapter(
+ LayerTreeHostImpl* layer_tree_host_impl,
+ scoped_refptr<DelayBasedTimeSource> time_source)
+ : layer_tree_host_impl_(layer_tree_host_impl),
+ time_source_(time_source) {
+ time_source_->setClient(this);
+ }
+
+ LayerTreeHostImpl* layer_tree_host_impl_;
+ scoped_refptr<DelayBasedTimeSource> time_source_;
+
+ DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTimeSourceAdapter);
};
LayerTreeHostImpl::FrameData::FrameData()
- : containsIncompleteTile(false)
-{
-}
-
-LayerTreeHostImpl::FrameData::~FrameData()
-{
-}
-
-scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
-{
- return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy));
-}
-
-LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
- : m_client(client)
- , m_proxy(proxy)
- , m_didLockScrollingLayer(false)
- , m_shouldBubbleScrolls(false)
- , m_wheelScrolling(false)
- , m_settings(settings)
- , m_deviceScaleFactor(1)
- , m_visible(true)
- , m_managedMemoryPolicy(PrioritizedResourceManager::defaultMemoryAllocationLimit(),
- ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
- 0,
- ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING)
- , m_pinchGestureActive(false)
- , m_fpsCounter(FrameRateCounter::create(m_proxy->HasImplThread()))
- , m_paintTimeCounter(PaintTimeCounter::create())
- , m_memoryHistory(MemoryHistory::Create())
- , m_debugRectHistory(DebugRectHistory::create())
- , m_numImplThreadScrolls(0)
- , m_numMainThreadScrolls(0)
- , m_cumulativeNumLayersDrawn(0)
- , m_cumulativeNumMissingTiles(0)
- , m_lastSentMemoryVisibleBytes(0)
- , m_lastSentMemoryVisibleAndNearbyBytes(0)
- , m_lastSentMemoryUseBytes(0)
- , m_animationRegistrar(AnimationRegistrar::create())
-{
- DCHECK(m_proxy->IsImplThread());
- didVisibilityChange(this, m_visible);
-
- setDebugState(settings.initialDebugState);
-
- if (settings.calculateTopControlsPosition) {
- m_topControlsManager = TopControlsManager::Create(this,
- settings.topControlsHeight,
- settings.topControlsShowThreshold,
- settings.topControlsHideThreshold);
- }
-
- setDebugState(settings.initialDebugState);
-
- // LTHI always has an active tree.
- m_activeTree = LayerTreeImpl::create(this);
-}
-
-LayerTreeHostImpl::~LayerTreeHostImpl()
-{
- DCHECK(m_proxy->IsImplThread());
- TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()");
-
- if (rootLayer()) {
- clearRenderSurfaces();
- // The layer trees must be destroyed before the layer tree host. We've
- // made a contract with our animation controllers that the registrar
- // will outlive them, and we must make good.
- m_recycleTree.reset();
- m_pendingTree.reset();
- m_activeTree.reset();
- }
-}
-
-void LayerTreeHostImpl::beginCommit()
-{
-}
-
-void LayerTreeHostImpl::commitComplete()
-{
- TRACE_EVENT0("cc", "LayerTreeHostImpl::commitComplete");
-
- // Impl-side painting needs an update immediately post-commit to have the
- // opportunity to create tilings. Other paths can call updateDrawProperties
- // more lazily when needed prior to drawing.
- if (m_settings.implSidePainting) {
- pendingTree()->set_needs_update_draw_properties();
- pendingTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE);
- } else {
- activeTree()->set_needs_update_draw_properties();
- }
-
- m_client->sendManagedMemoryStats();
-}
-
-bool LayerTreeHostImpl::canDraw()
-{
- // Note: If you are changing this function or any other function that might
- // affect the result of canDraw, make sure to call m_client->onCanDrawStateChanged
- // in the proper places and update the notifyIfCanDrawChanged test.
-
- if (!rootLayer()) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no root layer");
- return false;
- }
- if (DeviceViewportSize().IsEmpty()) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport");
- return false;
- }
- if (m_activeTree->ViewportSizeInvalid()) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw viewport size recently changed");
- return false;
- }
- if (!m_renderer) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no renderer");
- return false;
- }
- if (m_activeTree->ContentsTexturesPurged()) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw contents textures purged");
- return false;
- }
- return true;
-}
-
-OutputSurface* LayerTreeHostImpl::outputSurface() const
-{
- return m_outputSurface.get();
-}
-
-void LayerTreeHostImpl::animate(base::TimeTicks monotonicTime, base::Time wallClockTime)
-{
- animatePageScale(monotonicTime);
- animateLayers(monotonicTime, wallClockTime);
- animateScrollbars(monotonicTime);
- if (m_topControlsManager)
- m_topControlsManager->Animate(monotonicTime);
-}
-
-void LayerTreeHostImpl::manageTiles()
-{
- DCHECK(m_tileManager);
- m_tileManager->ManageTiles();
-
- size_t memoryRequiredBytes;
- size_t memoryNiceToHaveBytes;
- size_t memoryUsedBytes;
- m_tileManager->GetMemoryStats(&memoryRequiredBytes,
- &memoryNiceToHaveBytes,
- &memoryUsedBytes);
- sendManagedMemoryStats(memoryRequiredBytes,
- memoryNiceToHaveBytes,
- memoryUsedBytes);
-}
-
-void LayerTreeHostImpl::startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration)
-{
- if (!rootScrollLayer())
- return;
-
- gfx::Vector2dF scrollTotal = rootScrollLayer()->scroll_offset() + rootScrollLayer()->scroll_delta();
- gfx::SizeF scaledScrollableSize = activeTree()->ScrollableSize();
- gfx::SizeF viewportSize = gfx::ScaleSize(m_deviceViewportSize, 1 / m_deviceScaleFactor);
-
- double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF();
- m_pageScaleAnimation = PageScaleAnimation::Create(scrollTotal, activeTree()->total_page_scale_factor(), viewportSize, scaledScrollableSize, startTimeSeconds);
-
- if (anchorPoint) {
- gfx::Vector2dF anchor(targetOffset);
- m_pageScaleAnimation->ZoomWithAnchor(anchor, pageScale, duration.InSecondsF());
- } else {
- gfx::Vector2dF scaledTargetOffset = targetOffset;
- m_pageScaleAnimation->ZoomTo(scaledTargetOffset, pageScale, duration.InSecondsF());
- }
-
- m_client->setNeedsRedrawOnImplThread();
- m_client->setNeedsCommitOnImplThread();
- m_client->renewTreePriority();
-}
-
-void LayerTreeHostImpl::scheduleAnimation()
-{
- m_client->setNeedsRedrawOnImplThread();
-}
-
-bool LayerTreeHostImpl::haveTouchEventHandlersAt(const gfx::Point& viewportPoint)
-{
- if (!ensureRenderSurfaceLayerList())
- return false;
-
- gfx::PointF deviceViewportPoint = gfx::ScalePoint(viewportPoint, m_deviceScaleFactor);
-
- // First find out which layer was hit from the saved list of visible layers
- // in the most recent frame.
- LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(deviceViewportPoint, activeTree()->RenderSurfaceLayerList());
-
- // Walk up the hierarchy and look for a layer with a touch event handler region that the given point hits.
- for (; layerImpl; layerImpl = layerImpl->parent()) {
- if (LayerTreeHostCommon::layerHasTouchEventHandlersAt(deviceViewportPoint,layerImpl))
- return true;
- }
-
+ : contains_incomplete_tile(false) {}
+
+LayerTreeHostImpl::FrameData::~FrameData() {}
+
+scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create(
+ const LayerTreeSettings& settings,
+ LayerTreeHostImplClient* client,
+ Proxy* proxy) {
+ return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy));
+}
+
+LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings,
+ LayerTreeHostImplClient* client,
+ Proxy* proxy)
+ : client_(client),
+ proxy_(proxy),
+ did_lock_scrolling_layer_(false),
+ should_bubble_scrolls_(false),
+ wheel_scrolling_(false),
+ settings_(settings),
+ device_scale_factor_(1.f),
+ visible_(true),
+ managed_memory_policy_(
+ PrioritizedResourceManager::defaultMemoryAllocationLimit(),
+ ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
+ 0,
+ ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING),
+ pinch_gesture_active_(false),
+ fps_counter_(FrameRateCounter::create(proxy_->HasImplThread())),
+ paint_time_counter_(PaintTimeCounter::create()),
+ memory_history_(MemoryHistory::Create()),
+ debug_rect_history_(DebugRectHistory::create()),
+ num_impl_thread_scrolls_(0),
+ num_main_thread_scrolls_(0),
+ cumulative_num_layers_drawn_(0),
+ cumulative_num_missing_tiles_(0),
+ last_sent_memory_visible_bytes_(0),
+ last_sent_memory_visible_and_nearby_bytes_(0),
+ last_sent_memory_use_bytes_(0),
+ animation_registrar_(AnimationRegistrar::create()) {
+ DCHECK(proxy_->IsImplThread());
+ DidVisibilityChange(this, visible_);
+
+ SetDebugState(settings.initialDebugState);
+
+ if (settings.calculateTopControlsPosition) {
+ top_controls_manager_ =
+ TopControlsManager::Create(this,
+ settings.topControlsHeight,
+ settings.topControlsShowThreshold,
+ settings.topControlsHideThreshold);
+ }
+
+ SetDebugState(settings.initialDebugState);
+
+ // LTHI always has an active tree.
+ active_tree_ = LayerTreeImpl::create(this);
+}
+
+LayerTreeHostImpl::~LayerTreeHostImpl() {
+ DCHECK(proxy_->IsImplThread());
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()");
+
+ if (active_tree_->root_layer()) {
+ ClearRenderSurfaces();
+ // The layer trees must be destroyed before the layer tree host. We've
+ // made a contract with our animation controllers that the registrar
+ // will outlive them, and we must make good.
+ recycle_tree_.reset();
+ pending_tree_.reset();
+ active_tree_.reset();
+ }
+}
+
+void LayerTreeHostImpl::BeginCommit() {}
+
+void LayerTreeHostImpl::CommitComplete() {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete");
+
+ // Impl-side painting needs an update immediately post-commit to have the
+ // opportunity to create tilings. Other paths can call UpdateDrawProperties
+ // more lazily when needed prior to drawing.
+ if (settings_.implSidePainting) {
+ pending_tree_->set_needs_update_draw_properties();
+ pending_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE);
+ } else {
+ active_tree_->set_needs_update_draw_properties();
+ }
+
+ client_->SendManagedMemoryStats();
+}
+
+bool LayerTreeHostImpl::CanDraw() {
+ // Note: If you are changing this function or any other function that might
+ // affect the result of CanDraw, make sure to call
+ // client_->OnCanDrawStateChanged in the proper places and update the
+ // NotifyIfCanDrawChanged test.
+
+ if (!active_tree_->root_layer()) {
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer");
+ return false;
+ }
+ if (device_viewport_size_.IsEmpty()) {
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport");
+ return false;
+ }
+ if (active_tree_->ViewportSizeInvalid()) {
+ TRACE_EVENT_INSTANT0(
+ "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed");
+ return false;
+ }
+ if (!renderer_) {
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer");
+ return false;
+ }
+ if (active_tree_->ContentsTexturesPurged()) {
+ TRACE_EVENT_INSTANT0(
+ "cc", "LayerTreeHostImpl::CanDraw contents textures purged");
+ return false;
+ }
+ return true;
+}
+
+void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time,
+ base::Time wall_clock_time) {
+ AnimatePageScale(monotonic_time);
+ AnimateLayers(monotonic_time, wall_clock_time);
+ AnimateScrollbars(monotonic_time);
+ if (top_controls_manager_)
+ top_controls_manager_->Animate(monotonic_time);
+}
+
+void LayerTreeHostImpl::ManageTiles() {
+ DCHECK(tile_manager_);
+ tile_manager_->ManageTiles();
+
+ size_t memory_required_bytes;
+ size_t memory_nice_to_have_bytes;
+ size_t memory_used_bytes;
+ tile_manager_->GetMemoryStats(&memory_required_bytes,
+ &memory_nice_to_have_bytes,
+ &memory_used_bytes);
+ SendManagedMemoryStats(memory_required_bytes,
+ memory_nice_to_have_bytes,
+ memory_used_bytes);
+}
+
+void LayerTreeHostImpl::StartPageScaleAnimation(gfx::Vector2d target_offset,
+ bool anchor_point,
+ float page_scale,
+ base::TimeTicks start_time,
+ base::TimeDelta duration) {
+ if (!RootScrollLayer())
+ return;
+
+ gfx::Vector2dF scroll_total =
+ RootScrollLayer()->scroll_offset() + RootScrollLayer()->scroll_delta();
+ gfx::SizeF scaled_scrollable_size = active_tree_->ScrollableSize();
+ gfx::SizeF viewport_size =
+ gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor_);
+
+ double start_time_seconds = (start_time - base::TimeTicks()).InSecondsF();
+ page_scale_animation_ =
+ PageScaleAnimation::Create(scroll_total,
+ active_tree_->total_page_scale_factor(),
+ viewport_size,
+ scaled_scrollable_size,
+ start_time_seconds);
+
+ if (anchor_point) {
+ gfx::Vector2dF anchor(target_offset);
+ page_scale_animation_->ZoomWithAnchor(anchor,
+ page_scale,
+ duration.InSecondsF());
+ } else {
+ gfx::Vector2dF scaled_target_offset = target_offset;
+ page_scale_animation_->ZoomTo(scaled_target_offset,
+ page_scale,
+ duration.InSecondsF());
+ }
+
+ client_->SetNeedsRedrawOnImplThread();
+ client_->SetNeedsCommitOnImplThread();
+ client_->RenewTreePriority();
+}
+
+void LayerTreeHostImpl::ScheduleAnimation() {
+ client_->SetNeedsRedrawOnImplThread();
+}
+
+bool LayerTreeHostImpl::HaveTouchEventHandlersAt(gfx::Point viewport_point) {
+ if (!EnsureRenderSurfaceLayerList())
return false;
-}
-
-void LayerTreeHostImpl::trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList)
-{
- // For now, we use damage tracking to compute a global scissor. To do this, we must
- // compute all damage tracking before drawing anything, so that we know the root
- // damage rect. The root damage rect is then used to scissor each surface.
-
- for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
- LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
- RenderSurfaceImpl* renderSurface = renderSurfaceLayer->render_surface();
- DCHECK(renderSurface);
- renderSurface->damage_tracker()->UpdateDamageTrackingState(renderSurface->layer_list(), renderSurfaceLayer->id(), renderSurface->SurfacePropertyChangedOnlyFromDescendant(), renderSurface->content_rect(), renderSurfaceLayer->mask_layer(), renderSurfaceLayer->filters(), renderSurfaceLayer->filter().get());
- }
-}
-
-void LayerTreeHostImpl::FrameData::appendRenderPass(scoped_ptr<RenderPass> renderPass)
-{
- renderPassesById[renderPass->id] = renderPass.get();
- renderPasses.push_back(renderPass.Pass());
-}
-
-static void appendQuadsForLayer(RenderPass* targetRenderPass, LayerImpl* layer, OcclusionTrackerImpl& occlusionTracker, AppendQuadsData& appendQuadsData)
-{
- bool forSurface = false;
- QuadCuller quadCuller(targetRenderPass->quad_list,
- targetRenderPass->shared_quad_state_list,
- layer,
- occlusionTracker,
- layer->ShowDebugBorders(),
- forSurface);
- layer->AppendQuads(&quadCuller, &appendQuadsData);
-}
-
-static void appendQuadsForRenderSurfaceLayer(RenderPass* targetRenderPass, LayerImpl* layer, const RenderPass* contributingRenderPass, OcclusionTrackerImpl& occlusionTracker, AppendQuadsData& appendQuadsData)
-{
- bool forSurface = true;
- QuadCuller quadCuller(targetRenderPass->quad_list,
- targetRenderPass->shared_quad_state_list,
- layer,
- occlusionTracker,
- layer->ShowDebugBorders(),
- forSurface);
-
- bool isReplica = false;
- layer->render_surface()->AppendQuads(&quadCuller,
- &appendQuadsData,
- isReplica,
- contributingRenderPass->id);
-
- // Add replica after the surface so that it appears below the surface.
- if (layer->has_replica()) {
- isReplica = true;
- layer->render_surface()->AppendQuads(&quadCuller,
- &appendQuadsData,
- isReplica,
- contributingRenderPass->id);
- }
-}
-static void appendQuadsToFillScreen(RenderPass* targetRenderPass, LayerImpl* rootLayer, SkColor screenBackgroundColor, const OcclusionTrackerImpl& occlusionTracker)
-{
- if (!rootLayer || !SkColorGetA(screenBackgroundColor))
- return;
-
- Region fillRegion = occlusionTracker.ComputeVisibleRegionInScreen();
- if (fillRegion.IsEmpty())
- return;
-
- bool forSurface = false;
- QuadCuller quadCuller(targetRenderPass->quad_list,
- targetRenderPass->shared_quad_state_list,
- rootLayer,
- occlusionTracker,
- rootLayer->ShowDebugBorders(),
- forSurface);
-
- // Manually create the quad state for the gutter quads, as the root layer
- // doesn't have any bounds and so can't generate this itself.
- // FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
-
- gfx::Rect rootTargetRect = rootLayer->render_surface()->content_rect();
- float opacity = 1;
- SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::Create());
- sharedQuadState->SetAll(rootLayer->draw_transform(),
- rootTargetRect.size(),
- rootTargetRect,
- rootTargetRect,
+ gfx::PointF device_viewport_point =
+ gfx::ScalePoint(viewport_point, device_scale_factor_);
+
+ // First find out which layer was hit from the saved list of visible layers
+ // in the most recent frame.
+ LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint(
+ device_viewport_point,
+ active_tree_->RenderSurfaceLayerList());
+
+ // Walk up the hierarchy and look for a layer with a touch event handler
+ // region that the given point hits.
+ for (; layer_impl; layer_impl = layer_impl->parent()) {
+ if (LayerTreeHostCommon::layerHasTouchEventHandlersAt(device_viewport_point,
+ layer_impl))
+ return true;
+ }
+
+ return false;
+}
+
+void LayerTreeHostImpl::TrackDamageForAllSurfaces(
+ LayerImpl* root_draw_layer,
+ const LayerList& render_surface_layer_list) {
+ // For now, we use damage tracking to compute a global scissor. To do this, we
+ // must compute all damage tracking before drawing anything, so that we know
+ // the root damage rect. The root damage rect is then used to scissor each
+ // surface.
+
+ for (int surface_index = render_surface_layer_list.size() - 1;
+ surface_index >= 0 ;
+ --surface_index) {
+ LayerImpl* render_surface_layer = render_surface_layer_list[surface_index];
+ RenderSurfaceImpl* render_surface = render_surface_layer->render_surface();
+ DCHECK(render_surface);
+ render_surface->damage_tracker()->UpdateDamageTrackingState(
+ render_surface->layer_list(),
+ render_surface_layer->id(),
+ render_surface->SurfacePropertyChangedOnlyFromDescendant(),
+ render_surface->content_rect(),
+ render_surface_layer->mask_layer(),
+ render_surface_layer->filters(),
+ render_surface_layer->filter().get());
+ }
+}
+
+void LayerTreeHostImpl::FrameData::AppendRenderPass(
+ scoped_ptr<RenderPass> render_pass) {
+ render_passes_by_id[render_pass->id] = render_pass.get();
+ render_passes.push_back(render_pass.Pass());
+}
+
+static void AppendQuadsForLayer(RenderPass* target_render_pass,
+ LayerImpl* layer,
+ const OcclusionTrackerImpl& occlusion_tracker,
+ AppendQuadsData* append_quads_data) {
+ bool for_surface = false;
+ QuadCuller quad_culler(target_render_pass->quad_list,
+ target_render_pass->shared_quad_state_list,
+ layer,
+ occlusion_tracker,
+ layer->ShowDebugBorders(),
+ for_surface);
+ layer->AppendQuads(&quad_culler, append_quads_data);
+}
+
+static void AppendQuadsForRenderSurfaceLayer(
+ RenderPass* target_render_pass,
+ LayerImpl* layer,
+ const RenderPass* contributing_render_pass,
+ const OcclusionTrackerImpl& occlusion_tracker,
+ AppendQuadsData* append_quads_data) {
+ bool for_surface = true;
+ QuadCuller quad_culler(target_render_pass->quad_list,
+ target_render_pass->shared_quad_state_list,
+ layer,
+ occlusion_tracker,
+ layer->ShowDebugBorders(),
+ for_surface);
+
+ bool is_replica = false;
+ layer->render_surface()->AppendQuads(&quad_culler,
+ append_quads_data,
+ is_replica,
+ contributing_render_pass->id);
+
+ // Add replica after the surface so that it appears below the surface.
+ if (layer->has_replica()) {
+ is_replica = true;
+ layer->render_surface()->AppendQuads(&quad_culler,
+ append_quads_data,
+ is_replica,
+ contributing_render_pass->id);
+ }
+}
+
+static void AppendQuadsToFillScreen(
+ RenderPass* target_render_pass,
+ LayerImpl* root_layer,
+ SkColor screen_background_color,
+ const OcclusionTrackerImpl& occlusion_tracker) {
+ if (!root_layer || !SkColorGetA(screen_background_color))
+ return;
+
+ Region fill_region = occlusion_tracker.ComputeVisibleRegionInScreen();
+ if (fill_region.IsEmpty())
+ return;
+
+ bool for_surface = false;
+ QuadCuller quad_culler(target_render_pass->quad_list,
+ target_render_pass->shared_quad_state_list,
+ root_layer,
+ occlusion_tracker,
+ root_layer->ShowDebugBorders(),
+ for_surface);
+
+ // Manually create the quad state for the gutter quads, as the root layer
+ // doesn't have any bounds and so can't generate this itself.
+ // TODO(danakj): Make the gutter quads generated by the solid color layer
+ // (make it smarter about generating quads to fill unoccluded areas).
+
+ gfx::Rect root_target_rect = root_layer->render_surface()->content_rect();
+ float opacity = 1.f;
+ SharedQuadState* shared_quad_state =
+ quad_culler.useSharedQuadState(SharedQuadState::Create());
+ shared_quad_state->SetAll(root_layer->draw_transform(),
+ root_target_rect.size(),
+ root_target_rect,
+ root_target_rect,
false,
opacity);
- AppendQuadsData appendQuadsData;
-
- gfx::Transform transformToLayerSpace(gfx::Transform::kSkipInitialization);
- bool didInvert = rootLayer->screen_space_transform().GetInverse(&transformToLayerSpace);
- DCHECK(didInvert);
- for (Region::Iterator fillRects(fillRegion); fillRects.has_rect(); fillRects.next()) {
- // The root layer transform is composed of translations and scales only,
- // no perspective, so mapping is sufficient (as opposed to projecting).
- gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, fillRects.rect());
- // Skip the quad culler and just append the quads directly to avoid
- // occlusion checks.
- scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
- quad->SetNew(sharedQuadState, layerRect, screenBackgroundColor);
- quadCuller.append(quad.PassAs<DrawQuad>(), &appendQuadsData);
- }
-}
-
-bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
-{
- DCHECK(frame.renderPasses.empty());
-
- if (!canDraw() || !rootLayer())
- return false;
-
- trackDamageForAllSurfaces(rootLayer(), *frame.renderSurfaceLayerList);
-
- TRACE_EVENT1("cc", "LayerTreeHostImpl::calculateRenderPasses", "renderSurfaceLayerList.size()", static_cast<long long unsigned>(frame.renderSurfaceLayerList->size()));
-
- // Create the render passes in dependency order.
- for (int surfaceIndex = frame.renderSurfaceLayerList->size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
- LayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceIndex];
- renderSurfaceLayer->render_surface()->AppendRenderPasses(&frame);
- }
-
- bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled();
- OcclusionTrackerImpl occlusionTracker(rootLayer()->render_surface()->content_rect(), recordMetricsForFrame);
- occlusionTracker.set_minimum_tracking_size(m_settings.minimumOcclusionTrackingSize);
-
- if (m_debugState.showOccludingRects)
- occlusionTracker.set_occluding_screen_space_rects_container(&frame.occludingScreenSpaceRects);
- if (m_debugState.showNonOccludingRects)
- occlusionTracker.set_non_occluding_screen_space_rects_container(&frame.nonOccludingScreenSpaceRects);
-
- // Add quads to the Render passes in FrontToBack order to allow for testing occlusion and performing culling during the tree walk.
- typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
-
- // Typically when we are missing a texture and use a checkerboard quad, we still draw the frame. However when the layer being
- // checkerboarded is moving due to an impl-animation, we drop the frame to avoid flashing due to the texture suddenly appearing
- // in the future.
- bool drawFrame = true;
-
- LayerIteratorType end = LayerIteratorType::end(frame.renderSurfaceLayerList);
- for (LayerIteratorType it = LayerIteratorType::begin(frame.renderSurfaceLayerList); it != end; ++it) {
- RenderPass::Id targetRenderPassId = it.targetRenderSurfaceLayer()->render_surface()->RenderPassId();
- RenderPass* targetRenderPass = frame.renderPassesById[targetRenderPassId];
-
- occlusionTracker.EnterLayer(it);
-
- AppendQuadsData appendQuadsData(targetRenderPass->id);
-
- if (it.representsContributingRenderSurface()) {
- RenderPass::Id contributingRenderPassId = it->render_surface()->RenderPassId();
- RenderPass* contributingRenderPass = frame.renderPassesById[contributingRenderPassId];
- appendQuadsForRenderSurfaceLayer(targetRenderPass, *it, contributingRenderPass, occlusionTracker, appendQuadsData);
- } else if (it.representsItself() && !it->visible_content_rect().IsEmpty()) {
- bool hasOcclusionFromOutsideTargetSurface;
- bool implDrawTransformIsUnknown = false;
- if (occlusionTracker.Occluded(it->render_target(), it->visible_content_rect(), it->draw_transform(), implDrawTransformIsUnknown, it->is_clipped(), it->clip_rect(), &hasOcclusionFromOutsideTargetSurface))
- appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface;
- else {
- DCHECK_EQ(activeTree(), it->layer_tree_impl());
- it->WillDraw(m_resourceProvider.get());
- frame.willDrawLayers.push_back(*it);
-
- if (it->HasContributingDelegatedRenderPasses()) {
- RenderPass::Id contributingRenderPassId = it->FirstContributingRenderPassId();
- while (frame.renderPassesById.find(contributingRenderPassId) != frame.renderPassesById.end()) {
- RenderPass* renderPass = frame.renderPassesById[contributingRenderPassId];
-
- AppendQuadsData appendQuadsData(renderPass->id);
- appendQuadsForLayer(renderPass, *it, occlusionTracker, appendQuadsData);
-
- contributingRenderPassId = it->NextContributingRenderPassId(contributingRenderPassId);
- }
- }
-
- appendQuadsForLayer(targetRenderPass, *it, occlusionTracker, appendQuadsData);
- }
-
- ++m_cumulativeNumLayersDrawn;
- }
-
- if (appendQuadsData.hadOcclusionFromOutsideTargetSurface)
- targetRenderPass->has_occlusion_from_outside_target_surface = true;
+ AppendQuadsData append_quads_data;
+
+ gfx::Transform transform_to_layer_space(gfx::Transform::kSkipInitialization);
+ bool did_invert = root_layer->screen_space_transform().GetInverse(
+ &transform_to_layer_space);
+ DCHECK(did_invert);
+ for (Region::Iterator fill_rects(fill_region);
+ fill_rects.has_rect();
+ fill_rects.next()) {
+ // The root layer transform is composed of translations and scales only,
+ // no perspective, so mapping is sufficient (as opposed to projecting).
+ gfx::Rect layer_rect =
+ MathUtil::mapClippedRect(transform_to_layer_space, fill_rects.rect());
+ // Skip the quad culler and just append the quads directly to avoid
+ // occlusion checks.
+ scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
+ quad->SetNew(shared_quad_state, layer_rect, screen_background_color);
+ quad_culler.append(quad.PassAs<DrawQuad>(), &append_quads_data);
+ }
+}
+
+bool LayerTreeHostImpl::CalculateRenderPasses(FrameData* frame) {
+ DCHECK(frame->render_passes.empty());
+
+ if (!CanDraw() || !active_tree_->root_layer())
+ return false;
- if (appendQuadsData.numMissingTiles) {
- m_cumulativeNumMissingTiles += appendQuadsData.numMissingTiles;
- bool layerHasAnimatingTransform = it->screen_space_transform_is_animating() || it->draw_transform_is_animating();
- if (layerHasAnimatingTransform)
- drawFrame = false;
+ TrackDamageForAllSurfaces(active_tree_->root_layer(),
+ *frame->render_surface_layer_list);
+
+ TRACE_EVENT1("cc",
+ "LayerTreeHostImpl::CalculateRenderPasses",
+ "render_surface_layer_list.size()",
+ static_cast<long long unsigned>(
+ frame->render_surface_layer_list->size()));
+
+ // Create the render passes in dependency order.
+ for (int surface_index = frame->render_surface_layer_list->size() - 1;
+ surface_index >= 0 ;
+ --surface_index) {
+ LayerImpl* render_surface_layer =
+ (*frame->render_surface_layer_list)[surface_index];
+ render_surface_layer->render_surface()->AppendRenderPasses(frame);
+ }
+
+ bool record_metrics_for_frame =
+ settings_.showOverdrawInTracing &&
+ base::debug::TraceLog::GetInstance() &&
+ base::debug::TraceLog::GetInstance()->IsEnabled();
+ OcclusionTrackerImpl occlusion_tracker(
+ active_tree_->root_layer()->render_surface()->content_rect(),
+ record_metrics_for_frame);
+ occlusion_tracker.set_minimum_tracking_size(
+ settings_.minimumOcclusionTrackingSize);
+
+ if (debug_state_.showOccludingRects) {
+ occlusion_tracker.set_occluding_screen_space_rects_container(
+ &frame->occluding_screen_space_rects);
+ }
+ if (debug_state_.showNonOccludingRects) {
+ occlusion_tracker.set_non_occluding_screen_space_rects_container(
+ &frame->non_occluding_screen_space_rects);
+ }
+
+ // Add quads to the Render passes in FrontToBack order to allow for testing
+ // occlusion and performing culling during the tree walk.
+ typedef LayerIterator<LayerImpl,
+ std::vector<LayerImpl*>,
+ RenderSurfaceImpl,
+ LayerIteratorActions::FrontToBack> LayerIteratorType;
+
+ // Typically when we are missing a texture and use a checkerboard quad, we
+ // still draw the frame. However when the layer being checkerboarded is moving
+ // due to an impl-animation, we drop the frame to avoid flashing due to the
+ // texture suddenly appearing in the future.
+ bool draw_frame = true;
+
+ LayerIteratorType end =
+ LayerIteratorType::end(frame->render_surface_layer_list);
+ for (LayerIteratorType it =
+ LayerIteratorType::begin(frame->render_surface_layer_list);
+ it != end;
+ ++it) {
+ RenderPass::Id target_render_pass_id =
+ it.targetRenderSurfaceLayer()->render_surface()->RenderPassId();
+ RenderPass* target_render_pass =
+ frame->render_passes_by_id[target_render_pass_id];
+
+ occlusion_tracker.EnterLayer(it);
+
+ AppendQuadsData append_quads_data(target_render_pass->id);
+
+ if (it.representsContributingRenderSurface()) {
+ RenderPass::Id contributing_render_pass_id =
+ it->render_surface()->RenderPassId();
+ RenderPass* contributing_render_pass =
+ frame->render_passes_by_id[contributing_render_pass_id];
+ AppendQuadsForRenderSurfaceLayer(target_render_pass,
+ *it,
+ contributing_render_pass,
+ occlusion_tracker,
+ &append_quads_data);
+ } else if (it.representsItself() && !it->visible_content_rect().IsEmpty()) {
+ bool has_occlusion_from_outside_target_surface;
+ bool impl_draw_transform_is_unknown = false;
+ if (occlusion_tracker.Occluded(
+ it->render_target(),
+ it->visible_content_rect(),
+ it->draw_transform(),
+ impl_draw_transform_is_unknown,
+ it->is_clipped(),
+ it->clip_rect(),
+ &has_occlusion_from_outside_target_surface)) {
+ append_quads_data.hadOcclusionFromOutsideTargetSurface |=
+ has_occlusion_from_outside_target_surface;
+ } else {
+ DCHECK_EQ(active_tree_, it->layer_tree_impl());
+ it->WillDraw(resource_provider_.get());
+ frame->will_draw_layers.push_back(*it);
+
+ if (it->HasContributingDelegatedRenderPasses()) {
+ RenderPass::Id contributing_render_pass_id =
+ it->FirstContributingRenderPassId();
+ while (frame->render_passes_by_id.find(contributing_render_pass_id) !=
+ frame->render_passes_by_id.end()) {
+ RenderPass* render_pass =
+ frame->render_passes_by_id[contributing_render_pass_id];
+
+ AppendQuadsData append_quads_data(render_pass->id);
+ AppendQuadsForLayer(render_pass,
+ *it,
+ occlusion_tracker,
+ &append_quads_data);
+
+ contributing_render_pass_id =
+ it->NextContributingRenderPassId(contributing_render_pass_id);
+ }
}
- if (appendQuadsData.hadIncompleteTile)
- frame.containsIncompleteTile = true;
+ AppendQuadsForLayer(target_render_pass,
+ *it,
+ occlusion_tracker,
+ &append_quads_data);
+ }
- occlusionTracker.LeaveLayer(it);
+ ++cumulative_num_layers_drawn_;
}
-#ifndef NDEBUG
- for (size_t i = 0; i < frame.renderPasses.size(); ++i) {
- for (size_t j = 0; j < frame.renderPasses[i]->quad_list.size(); ++j)
- DCHECK(frame.renderPasses[i]->quad_list[j]->shared_quad_state);
- DCHECK(frame.renderPassesById.find(frame.renderPasses[i]->id)
- != frame.renderPassesById.end());
- }
-#endif
- DCHECK(frame.renderPasses.back()->output_rect.origin().IsOrigin());
+ if (append_quads_data.hadOcclusionFromOutsideTargetSurface)
+ target_render_pass->has_occlusion_from_outside_target_surface = true;
- if (!activeTree()->has_transparent_background()) {
- frame.renderPasses.back()->has_transparent_background = false;
- appendQuadsToFillScreen(frame.renderPasses.back(), rootLayer(), activeTree()->background_color(), occlusionTracker);
+ if (append_quads_data.numMissingTiles) {
+ cumulative_num_missing_tiles_ += append_quads_data.numMissingTiles;
+ bool layer_has_animating_transform =
+ it->screen_space_transform_is_animating() ||
+ it->draw_transform_is_animating();
+ if (layer_has_animating_transform)
+ draw_frame = false;
}
- if (drawFrame)
- occlusionTracker.overdraw_metrics()->RecordMetrics(this);
-
- removeRenderPasses(CullRenderPassesWithNoQuads(), frame);
- m_renderer->DecideRenderPassAllocationsForFrame(frame.renderPasses);
- removeRenderPasses(CullRenderPassesWithCachedTextures(*m_renderer), frame);
+ if (append_quads_data.hadIncompleteTile)
+ frame->contains_incomplete_tile = true;
- return drawFrame;
-}
-
-void LayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled)
-{
- // Lazily create the timeSource adapter so that we can vary the interval for testing.
- if (!m_timeSourceClientAdapter)
- m_timeSourceClientAdapter = LayerTreeHostImplTimeSourceAdapter::Create(this, DelayBasedTimeSource::create(lowFrequencyAnimationInterval(), m_proxy->CurrentThread()));
-
- m_timeSourceClientAdapter->setActive(enabled);
-}
-
-static inline RenderPass* findRenderPassById(RenderPass::Id renderPassId, const LayerTreeHostImpl::FrameData& frame)
-{
- RenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId);
- return it != frame.renderPassesById.end() ? it->second : NULL;
-}
+ occlusion_tracker.LeaveLayer(it);
+ }
-static void removeRenderPassesRecursive(RenderPass::Id removeRenderPassId, LayerTreeHostImpl::FrameData& frame)
-{
- RenderPass* removeRenderPass = findRenderPassById(removeRenderPassId, frame);
- // The pass was already removed by another quad - probably the original, and we are the replica.
- if (!removeRenderPass)
- return;
- RenderPassList& renderPasses = frame.renderPasses;
- RenderPassList::iterator toRemove = std::find(renderPasses.begin(), renderPasses.end(), removeRenderPass);
-
- DCHECK(toRemove != renderPasses.end());
-
- scoped_ptr<RenderPass> removedPass = renderPasses.take(toRemove);
- frame.renderPasses.erase(toRemove);
- frame.renderPassesById.erase(removeRenderPassId);
-
- // Now follow up for all RenderPass quads and remove their RenderPasses recursively.
- const QuadList& quadList = removedPass->quad_list;
- QuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin();
- for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) {
- DrawQuad* currentQuad = (*quadListIterator);
- if (currentQuad->material != DrawQuad::RENDER_PASS)
- continue;
-
- RenderPass::Id nextRemoveRenderPassId = RenderPassDrawQuad::MaterialCast(currentQuad)->render_pass_id;
- removeRenderPassesRecursive(nextRemoveRenderPassId, frame);
- }
-}
-
-bool LayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const RenderPassDrawQuad& quad, const FrameData&) const
-{
- if (!quad.contents_changed_since_last_frame.IsEmpty()) {
- TRACE_EVENT0("cc", "CullRenderPassesWithCachedTextures have damage");
- return false;
- } else if (!m_renderer.HaveCachedResourcesForRenderPassId(quad.render_pass_id)) {
- TRACE_EVENT0("cc", "CullRenderPassesWithCachedTextures have no texture");
- return false;
- }
- TRACE_EVENT0("cc", "CullRenderPassesWithCachedTextures dropped!");
- return true;
+#ifndef NDEBUG
+ for (size_t i = 0; i < frame->render_passes.size(); ++i) {
+ for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j)
+ DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state);
+ DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id)
+ != frame->render_passes_by_id.end());
+ }
+#endif
+ DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin());
+
+ if (!active_tree_->has_transparent_background()) {
+ frame->render_passes.back()->has_transparent_background = false;
+ AppendQuadsToFillScreen(frame->render_passes.back(),
+ active_tree_->root_layer(),
+ active_tree_->background_color(),
+ occlusion_tracker);
+ }
+
+ if (draw_frame)
+ occlusion_tracker.overdraw_metrics()->RecordMetrics(this);
+
+ RemoveRenderPasses(CullRenderPassesWithNoQuads(), frame);
+ renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes);
+ RemoveRenderPasses(CullRenderPassesWithCachedTextures(*renderer_), frame);
+
+ return draw_frame;
+}
+
+void LayerTreeHostImpl::SetBackgroundTickingEnabled(bool enabled) {
+ // Lazily create the time_source adapter so that we can vary the interval for
+ // testing.
+ if (!time_source_client_adapter_) {
+ time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create(
+ this,
+ DelayBasedTimeSource::create(LowFrequencyAnimationInterval(),
+ proxy_->CurrentThread()));
+ }
+
+ time_source_client_adapter_->SetActive(enabled);
+}
+
+static inline RenderPass* FindRenderPassById(
+ RenderPass::Id render_pass_id,
+ const LayerTreeHostImpl::FrameData& frame) {
+ RenderPassIdHashMap::const_iterator it =
+ frame.render_passes_by_id.find(render_pass_id);
+ return it != frame.render_passes_by_id.end() ? it->second : NULL;
+}
+
+static void RemoveRenderPassesRecursive(RenderPass::Id remove_render_pass_id,
+ LayerTreeHostImpl::FrameData* frame) {
+ RenderPass* remove_render_pass =
+ FindRenderPassById(remove_render_pass_id, *frame);
+ // The pass was already removed by another quad - probably the original, and
+ // we are the replica.
+ if (!remove_render_pass)
+ return;
+ RenderPassList& render_passes = frame->render_passes;
+ RenderPassList::iterator to_remove = std::find(render_passes.begin(),
+ render_passes.end(),
+ remove_render_pass);
+
+ DCHECK(to_remove != render_passes.end());
+
+ scoped_ptr<RenderPass> removed_pass = render_passes.take(to_remove);
+ frame->render_passes.erase(to_remove);
+ frame->render_passes_by_id.erase(remove_render_pass_id);
+
+ // Now follow up for all RenderPass quads and remove their RenderPasses
+ // recursively.
+ const QuadList& quad_list = removed_pass->quad_list;
+ QuadList::constBackToFrontIterator quad_list_iterator =
+ quad_list.backToFrontBegin();
+ for (; quad_list_iterator != quad_list.backToFrontEnd();
+ ++quad_list_iterator) {
+ DrawQuad* current_quad = (*quad_list_iterator);
+ if (current_quad->material != DrawQuad::RENDER_PASS)
+ continue;
+
+ RenderPass::Id next_remove_render_pass_id =
+ RenderPassDrawQuad::MaterialCast(current_quad)->render_pass_id;
+ RemoveRenderPassesRecursive(next_remove_render_pass_id, frame);
+ }
+}
+
+bool LayerTreeHostImpl::CullRenderPassesWithCachedTextures::
+ ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
+ const FrameData& frame) const {
+ bool quad_has_damage = !quad.contents_changed_since_last_frame.IsEmpty();
+ bool quad_has_cached_resource =
+ renderer_.HaveCachedResourcesForRenderPassId(quad.render_pass_id);
+ if (quad_has_damage) {
+ TRACE_EVENT0("cc", "CullRenderPassesWithCachedTextures have damage");
+ return false;
+ } else if (!quad_has_cached_resource) {
+ TRACE_EVENT0("cc", "CullRenderPassesWithCachedTextures have no texture");
+ return false;
+ }
+ TRACE_EVENT0("cc", "CullRenderPassesWithCachedTextures dropped!");
+ return true;
}
-bool LayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const RenderPassDrawQuad& quad, const FrameData& frame) const
-{
- const RenderPass* renderPass = findRenderPassById(quad.render_pass_id, frame);
- if (!renderPass)
- return false;
+bool LayerTreeHostImpl::CullRenderPassesWithNoQuads::ShouldRemoveRenderPass(
+ const RenderPassDrawQuad& quad, const FrameData& frame) const {
+ const RenderPass* render_pass =
+ FindRenderPassById(quad.render_pass_id, frame);
+ if (!render_pass)
+ return false;
- // If any quad or RenderPass draws into this RenderPass, then keep it.
- const QuadList& quadList = renderPass->quad_list;
- for (QuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) {
- DrawQuad* currentQuad = *quadListIterator;
+ // If any quad or RenderPass draws into this RenderPass, then keep it.
+ const QuadList& quad_list = render_pass->quad_list;
+ for (QuadList::constBackToFrontIterator quad_list_iterator =
+ quad_list.backToFrontBegin();
+ quad_list_iterator != quad_list.backToFrontEnd();
+ ++quad_list_iterator) {
+ DrawQuad* current_quad = *quad_list_iterator;
- if (currentQuad->material != DrawQuad::RENDER_PASS)
- return false;
+ if (current_quad->material != DrawQuad::RENDER_PASS)
+ return false;
- const RenderPass* contributingPass = findRenderPassById(RenderPassDrawQuad::MaterialCast(currentQuad)->render_pass_id, frame);
- if (contributingPass)
- return false;
- }
- return true;
+ const RenderPass* contributing_pass = FindRenderPassById(
+ RenderPassDrawQuad::MaterialCast(current_quad)->render_pass_id, frame);
+ if (contributing_pass)
+ return false;
+ }
+ return true;
}
// Defined for linking tests.
-template CC_EXPORT void LayerTreeHostImpl::removeRenderPasses<LayerTreeHostImpl::CullRenderPassesWithCachedTextures>(CullRenderPassesWithCachedTextures, FrameData&);
-template CC_EXPORT void LayerTreeHostImpl::removeRenderPasses<LayerTreeHostImpl::CullRenderPassesWithNoQuads>(CullRenderPassesWithNoQuads, FrameData&);
+template CC_EXPORT void LayerTreeHostImpl::RemoveRenderPasses<
+ LayerTreeHostImpl::CullRenderPassesWithCachedTextures>(
+ CullRenderPassesWithCachedTextures culler, FrameData* frame);
+template CC_EXPORT void LayerTreeHostImpl::RemoveRenderPasses<
+ LayerTreeHostImpl::CullRenderPassesWithNoQuads>(
+ CullRenderPassesWithNoQuads culler, FrameData*);
// static
-template<typename RenderPassCuller>
-void LayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& frame)
-{
- for (size_t it = culler.renderPassListBegin(frame.renderPasses); it != culler.renderPassListEnd(frame.renderPasses); it = culler.renderPassListNext(it)) {
- const RenderPass* currentPass = frame.renderPasses[it];
- const QuadList& quadList = currentPass->quad_list;
- QuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin();
-
- for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) {
- DrawQuad* currentQuad = *quadListIterator;
-
- if (currentQuad->material != DrawQuad::RENDER_PASS)
- continue;
-
- RenderPassDrawQuad* renderPassQuad = static_cast<RenderPassDrawQuad*>(currentQuad);
- if (!culler.shouldRemoveRenderPass(*renderPassQuad, frame))
- continue;
-
- // We are changing the vector in the middle of iteration. Because we
- // delete render passes that draw into the current pass, we are
- // guaranteed that any data from the iterator to the end will not
- // change. So, capture the iterator position from the end of the
- // list, and restore it after the change.
- int positionFromEnd = frame.renderPasses.size() - it;
- removeRenderPassesRecursive(renderPassQuad->render_pass_id, frame);
- it = frame.renderPasses.size() - positionFromEnd;
- DCHECK(frame.renderPasses.size() >= static_cast<size_t>(positionFromEnd));
- }
+template <typename RenderPassCuller>
+void LayerTreeHostImpl::RemoveRenderPasses(RenderPassCuller culler,
+ FrameData* frame) {
+ for (size_t it = culler.RenderPassListBegin(frame->render_passes);
+ it != culler.RenderPassListEnd(frame->render_passes);
+ it = culler.RenderPassListNext(it)) {
+ const RenderPass* current_pass = frame->render_passes[it];
+ const QuadList& quad_list = current_pass->quad_list;
+ QuadList::constBackToFrontIterator quad_list_iterator =
+ quad_list.backToFrontBegin();
+
+ for (; quad_list_iterator != quad_list.backToFrontEnd();
+ ++quad_list_iterator) {
+ DrawQuad* current_quad = *quad_list_iterator;
+
+ if (current_quad->material != DrawQuad::RENDER_PASS)
+ continue;
+
+ const RenderPassDrawQuad* render_pass_quad =
+ RenderPassDrawQuad::MaterialCast(current_quad);
+ if (!culler.ShouldRemoveRenderPass(*render_pass_quad, *frame))
+ continue;
+
+ // We are changing the vector in the middle of iteration. Because we
+ // delete render passes that draw into the current pass, we are
+ // guaranteed that any data from the iterator to the end will not
+ // change. So, capture the iterator position from the end of the
+ // list, and restore it after the change.
+ size_t position_from_end = frame->render_passes.size() - it;
+ RemoveRenderPassesRecursive(render_pass_quad->render_pass_id, frame);
+ it = frame->render_passes.size() - position_from_end;
+ DCHECK_GE(frame->render_passes.size(), position_from_end);
}
+ }
}
-bool LayerTreeHostImpl::prepareToDraw(FrameData& frame)
-{
- TRACE_EVENT0("cc", "LayerTreeHostImpl::prepareToDraw");
-
- activeTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE_FOR_DRAW);
+bool LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::PrepareToDraw");
- frame.renderSurfaceLayerList = &activeTree()->RenderSurfaceLayerList();
- frame.renderPasses.clear();
- frame.renderPassesById.clear();
- frame.willDrawLayers.clear();
+ active_tree_->UpdateDrawProperties(
+ LayerTreeImpl::UPDATE_ACTIVE_TREE_FOR_DRAW);
- if (!calculateRenderPasses(frame))
- return false;
+ frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList();
+ frame->render_passes.clear();
+ frame->render_passes_by_id.clear();
+ frame->will_draw_layers.clear();
- // If we return true, then we expect drawLayers() to be called before this function is called again.
- return true;
-}
-
-void LayerTreeHostImpl::EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
-{
- bool evictedResources = m_client->reduceContentsTextureMemoryOnImplThread(
- m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible,
- ManagedMemoryPolicy::priorityCutoffToValue(
- m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWhenNotVisible));
- if (evictedResources) {
- activeTree()->SetContentsTexturesPurged();
- if (pendingTree())
- pendingTree()->SetContentsTexturesPurged();
- m_client->setNeedsCommitOnImplThread();
- m_client->onCanDrawStateChanged(canDraw());
- m_client->renewTreePriority();
- }
- m_client->sendManagedMemoryStats();
-
- if (m_tileManager) {
- GlobalStateThatImpactsTilePriority new_state(m_tileManager->GlobalState());
- new_state.memory_limit_in_bytes = m_visible ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible;
- new_state.memory_limit_policy = ManagedMemoryPolicy::priorityCutoffToTileMemoryLimitPolicy(
- m_visible ? policy.priorityCutoffWhenVisible : policy.priorityCutoffWhenNotVisible);
- m_tileManager->SetGlobalState(new_state);
- }
-}
-
-bool LayerTreeHostImpl::HasImplThread() const
-{
- return m_proxy->HasImplThread();
-}
-
-void LayerTreeHostImpl::ScheduleManageTiles()
-{
- if (m_client)
- m_client->setNeedsManageTilesOnImplThread();
-}
-
-void LayerTreeHostImpl::DidUploadVisibleHighResolutionTile()
-{
- if (m_client)
- m_client->didUploadVisibleHighResolutionTileOnImplThread();
-}
-
-bool LayerTreeHostImpl::ShouldClearRootRenderPass() const
-{
- return m_settings.shouldClearRootRenderPass;
-}
-
-void LayerTreeHostImpl::SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
-{
- if (m_managedMemoryPolicy == policy)
- return;
-
- m_managedMemoryPolicy = policy;
- if (!m_proxy->HasImplThread()) {
- // FIXME: In single-thread mode, this can be called on the main thread
- // by GLRenderer::onMemoryAllocationChanged.
- DebugScopedSetImplThread implThread(m_proxy);
- EnforceManagedMemoryPolicy(m_managedMemoryPolicy);
- } else {
- DCHECK(m_proxy->IsImplThread());
- EnforceManagedMemoryPolicy(m_managedMemoryPolicy);
- }
- // We always need to commit after changing the memory policy because the new
- // limit can result in more or less content having texture allocated for it.
- m_client->setNeedsCommitOnImplThread();
-}
-
-void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval)
-{
- m_client->onVSyncParametersChanged(timebase, interval);
-}
-
-void LayerTreeHostImpl::OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
-{
- if (!m_renderer)
- return;
-
- // TODO(piman): We may need to do some validation on this ack before processing it.
- m_renderer->ReceiveCompositorFrameAck(ack);
-}
-
-void LayerTreeHostImpl::OnCanDrawStateChangedForTree(LayerTreeImpl*)
-{
- m_client->onCanDrawStateChanged(canDraw());
-}
-
-CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const
-{
- CompositorFrameMetadata metadata;
- metadata.device_scale_factor = m_deviceScaleFactor;
- metadata.page_scale_factor = activeTree()->total_page_scale_factor();
- metadata.viewport_size = activeTree()->ScrollableViewportSize();
- metadata.root_layer_size = activeTree()->ScrollableSize();
- metadata.min_page_scale_factor = activeTree()->min_page_scale_factor();
- metadata.max_page_scale_factor = activeTree()->max_page_scale_factor();
- if (m_topControlsManager) {
- metadata.location_bar_offset = gfx::Vector2dF(0.f, m_topControlsManager->controls_top_offset());
- metadata.location_bar_content_translation = gfx::Vector2dF(0.f, m_topControlsManager->content_top_offset());
- }
+ if (!CalculateRenderPasses(frame))
+ return false;
- if (!rootScrollLayer())
- return metadata;
+ // If we return true, then we expect DrawLayers() to be called before this
+ // function is called again.
+ return true;
+}
+
+void LayerTreeHostImpl::EnforceManagedMemoryPolicy(
+ const ManagedMemoryPolicy& policy) {
+ bool evicted_resources = client_->ReduceContentsTextureMemoryOnImplThread(
+ visible_ ? policy.bytesLimitWhenVisible : policy.bytesLimitWhenNotVisible,
+ ManagedMemoryPolicy::priorityCutoffToValue(
+ visible_ ?
+ policy.priorityCutoffWhenVisible :
+ policy.priorityCutoffWhenNotVisible));
+ if (evicted_resources) {
+ active_tree_->SetContentsTexturesPurged();
+ if (pending_tree_)
+ pending_tree_->SetContentsTexturesPurged();
+ client_->SetNeedsCommitOnImplThread();
+ client_->OnCanDrawStateChanged(CanDraw());
+ client_->RenewTreePriority();
+ }
+ client_->SendManagedMemoryStats();
+
+ if (tile_manager_) {
+ GlobalStateThatImpactsTilePriority new_state(tile_manager_->GlobalState());
+ new_state.memory_limit_in_bytes = visible_ ?
+ policy.bytesLimitWhenVisible :
+ policy.bytesLimitWhenNotVisible;
+ new_state.memory_limit_policy =
+ ManagedMemoryPolicy::priorityCutoffToTileMemoryLimitPolicy(
+ visible_ ?
+ policy.priorityCutoffWhenVisible :
+ policy.priorityCutoffWhenNotVisible);
+ tile_manager_->SetGlobalState(new_state);
+ }
+}
+
+bool LayerTreeHostImpl::HasImplThread() const {
+ return proxy_->HasImplThread();
+}
+
+void LayerTreeHostImpl::ScheduleManageTiles() {
+ if (client_)
+ client_->SetNeedsManageTilesOnImplThread();
+}
+
+void LayerTreeHostImpl::DidUploadVisibleHighResolutionTile() {
+ if (client_)
+ client_->DidUploadVisibleHighResolutionTileOnImplThread();
+}
+
+bool LayerTreeHostImpl::ShouldClearRootRenderPass() const {
+ return settings_.shouldClearRootRenderPass;
+}
+
+void LayerTreeHostImpl::SetManagedMemoryPolicy(
+ const ManagedMemoryPolicy& policy) {
+ if (managed_memory_policy_ == policy)
+ return;
+
+ managed_memory_policy_ = policy;
+ if (!proxy_->HasImplThread()) {
+ // TODO(ccameron): In single-thread mode, this can be called on the main
+ // thread by GLRenderer::OnMemoryAllocationChanged.
+ DebugScopedSetImplThread impl_thread(proxy_);
+ EnforceManagedMemoryPolicy(managed_memory_policy_);
+ } else {
+ DCHECK(proxy_->IsImplThread());
+ EnforceManagedMemoryPolicy(managed_memory_policy_);
+ }
+ // We always need to commit after changing the memory policy because the new
+ // limit can result in more or less content having texture allocated for it.
+ client_->SetNeedsCommitOnImplThread();
+}
+
+void LayerTreeHostImpl::OnVSyncParametersChanged(base::TimeTicks timebase,
+ base::TimeDelta interval) {
+ client_->OnVSyncParametersChanged(timebase, interval);
+}
+
+void LayerTreeHostImpl::OnSendFrameToParentCompositorAck(
+ const CompositorFrameAck& ack) {
+ if (!renderer_)
+ return;
+
+ // TODO(piman): We may need to do some validation on this ack before
+ // processing it.
+ renderer_->ReceiveCompositorFrameAck(ack);
+}
+
+void LayerTreeHostImpl::OnCanDrawStateChangedForTree() {
+ client_->OnCanDrawStateChanged(CanDraw());
+}
+
+CompositorFrameMetadata LayerTreeHostImpl::MakeCompositorFrameMetadata() const {
+ CompositorFrameMetadata metadata;
+ metadata.device_scale_factor = device_scale_factor_;
+ metadata.page_scale_factor = active_tree_->total_page_scale_factor();
+ metadata.viewport_size = active_tree_->ScrollableViewportSize();
+ metadata.root_layer_size = active_tree_->ScrollableSize();
+ metadata.min_page_scale_factor = active_tree_->min_page_scale_factor();
+ metadata.max_page_scale_factor = active_tree_->max_page_scale_factor();
+ if (top_controls_manager_) {
+ metadata.location_bar_offset =
+ gfx::Vector2dF(0.f, top_controls_manager_->controls_top_offset());
+ metadata.location_bar_content_translation =
+ gfx::Vector2dF(0.f, top_controls_manager_->content_top_offset());
+ }
+
+ if (!RootScrollLayer())
+ return metadata;
- metadata.root_scroll_offset = rootScrollLayer()->scroll_offset() + rootScrollLayer()->scroll_delta();
+ metadata.root_scroll_offset = RootScrollLayer()->scroll_offset() +
+ RootScrollLayer()->scroll_delta();
- return metadata;
+ return metadata;
}
-void LayerTreeHostImpl::drawLayers(FrameData& frame)
-{
- TRACE_EVENT0("cc", "LayerTreeHostImpl::drawLayers");
- DCHECK(canDraw());
- DCHECK(!frame.renderPasses.empty());
+void LayerTreeHostImpl::DrawLayers(FrameData* frame) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
+ DCHECK(CanDraw());
+ DCHECK(!frame->render_passes.empty());
- // FIXME: use the frame begin time from the overall compositor scheduler.
- // This value is currently inaccessible because it is up in Chromium's
- // RenderWidget.
- m_fpsCounter->saveTimeStamp(base::TimeTicks::Now());
+ // FIXME: use the frame begin time from the overall compositor scheduler.
+ // This value is currently inaccessible because it is up in Chromium's
+ // RenderWidget.
+ fps_counter_->saveTimeStamp(base::TimeTicks::Now());
- if (m_tileManager) {
- m_memoryHistory->SaveEntry(
- m_tileManager->memory_stats_from_last_assign());
- }
+ if (tile_manager_) {
+ memory_history_->SaveEntry(
+ tile_manager_->memory_stats_from_last_assign());
+ }
- if (m_debugState.showHudRects())
- m_debugRectHistory->saveDebugRectsForCurrentFrame(rootLayer(), *frame.renderSurfaceLayerList, frame.occludingScreenSpaceRects, frame.nonOccludingScreenSpaceRects, m_debugState);
+ if (debug_state_.showHudRects()) {
+ debug_rect_history_->saveDebugRectsForCurrentFrame(
+ active_tree_->root_layer(),
+ *frame->render_surface_layer_list,
+ frame->occluding_screen_space_rects,
+ frame->non_occluding_screen_space_rects,
+ debug_state_);
+ }
- if (m_debugState.traceAllRenderedFrames) {
- TRACE_EVENT_INSTANT1("cc.debug", "Frame",
- "frame", ValueToString(frameStateAsValue()));
- }
+ if (debug_state_.traceAllRenderedFrames) {
+ TRACE_EVENT_INSTANT1("cc.debug", "Frame",
+ "frame", ValueToString(FrameStateAsValue()));
+ }
- // Because the contents of the HUD depend on everything else in the frame, the contents
- // of its texture are updated as the last thing before the frame is drawn.
- if (m_activeTree->hud_layer())
- m_activeTree->hud_layer()->updateHudTexture(m_resourceProvider.get());
+ // Because the contents of the HUD depend on everything else in the frame, the
+ // contents of its texture are updated as the last thing before the frame is
+ // drawn.
+ if (active_tree_->hud_layer())
+ active_tree_->hud_layer()->updateHudTexture(resource_provider_.get());
- m_renderer->DrawFrame(frame.renderPasses);
- // The render passes should be consumed by the renderer.
- DCHECK(frame.renderPasses.empty());
- frame.renderPassesById.clear();
+ renderer_->DrawFrame(frame->render_passes);
+ // The render passes should be consumed by the renderer.
+ DCHECK(frame->render_passes.empty());
+ frame->render_passes_by_id.clear();
- // The next frame should start by assuming nothing has changed, and changes are noted as they occur.
- for (unsigned int i = 0; i < frame.renderSurfaceLayerList->size(); i++)
- (*frame.renderSurfaceLayerList)[i]->render_surface()->damage_tracker()->DidDrawDamagedArea();
- rootLayer()->ResetAllChangeTrackingForSubtree();
- updateAnimationState();
+ // The next frame should start by assuming nothing has changed, and changes
+ // are noted as they occur.
+ for (unsigned int i = 0; i < frame->render_surface_layer_list->size(); i++) {
+ (*frame->render_surface_layer_list)[i]->render_surface()->damage_tracker()->
+ DidDrawDamagedArea();
+ }
+ active_tree_->root_layer()->ResetAllChangeTrackingForSubtree();
+ UpdateAnimationState();
}
-void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame)
-{
- for (size_t i = 0; i < frame.willDrawLayers.size(); ++i)
- frame.willDrawLayers[i]->DidDraw(m_resourceProvider.get());
+void LayerTreeHostImpl::DidDrawAllLayers(const FrameData& frame) {
+ for (size_t i = 0; i < frame.will_draw_layers.size(); ++i)
+ frame.will_draw_layers[i]->DidDraw(resource_provider_.get());
- // Once all layers have been drawn, pending texture uploads should no
- // longer block future uploads.
- m_resourceProvider->MarkPendingUploadsAsNonBlocking();
+ // Once all layers have been drawn, pending texture uploads should no
+ // longer block future uploads.
+ resource_provider_->MarkPendingUploadsAsNonBlocking();
}
-void LayerTreeHostImpl::finishAllRendering()
-{
- if (m_renderer)
- m_renderer->Finish();
+void LayerTreeHostImpl::FinishAllRendering() {
+ if (renderer_)
+ renderer_->Finish();
}
-bool LayerTreeHostImpl::isContextLost()
-{
- DCHECK(m_proxy->IsImplThread());
- return m_renderer && m_renderer->IsContextLost();
+bool LayerTreeHostImpl::IsContextLost() {
+ DCHECK(proxy_->IsImplThread());
+ return renderer_ && renderer_->IsContextLost();
}
-const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
-{
- return m_renderer->Capabilities();
+const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const {
+ return renderer_->Capabilities();
}
-bool LayerTreeHostImpl::swapBuffers()
-{
- if (m_tileManager)
- m_tileManager->DidCompleteFrame();
- return m_renderer->SwapBuffers();
+bool LayerTreeHostImpl::SwapBuffers() {
+ if (tile_manager_)
+ tile_manager_->DidCompleteFrame();
+ return renderer_->SwapBuffers();
}
-gfx::Size LayerTreeHostImpl::DeviceViewportSize() const
-{
- return m_deviceViewportSize;
+gfx::Size LayerTreeHostImpl::DeviceViewportSize() const {
+ return device_viewport_size();
}
-const LayerTreeSettings& LayerTreeHostImpl::Settings() const
-{
- return m_settings;
+const LayerTreeSettings& LayerTreeHostImpl::Settings() const {
+ return settings();
}
-void LayerTreeHostImpl::DidLoseOutputSurface()
-{
- m_client->didLoseOutputSurfaceOnImplThread();
+void LayerTreeHostImpl::DidLoseOutputSurface() {
+ client_->DidLoseOutputSurfaceOnImplThread();
}
-void LayerTreeHostImpl::OnSwapBuffersComplete()
-{
- m_client->onSwapBuffersCompleteOnImplThread();
+void LayerTreeHostImpl::OnSwapBuffersComplete() {
+ client_->OnSwapBuffersCompleteOnImplThread();
}
-void LayerTreeHostImpl::readback(void* pixels,
- gfx::Rect rect_in_device_viewport)
-{
- DCHECK(m_renderer);
- m_renderer->GetFramebufferPixels(pixels, rect_in_device_viewport);
+void LayerTreeHostImpl::Readback(void* pixels,
+ gfx::Rect rect_in_device_viewport) {
+ DCHECK(renderer_);
+ renderer_->GetFramebufferPixels(pixels, rect_in_device_viewport);
}
bool LayerTreeHostImpl::haveRootScrollLayer() const {
- return rootScrollLayer();
+ return RootScrollLayer();
}
float LayerTreeHostImpl::rootScrollLayerTotalScrollY() const {
- if (LayerImpl* layer = rootScrollLayer())
+ if (LayerImpl* layer = RootScrollLayer())
return layer->scroll_offset().y() + layer->scroll_delta().y();
return 0.0f;
}
-LayerImpl* LayerTreeHostImpl::rootLayer() const
-{
- return m_activeTree->RootLayer();
+LayerImpl* LayerTreeHostImpl::RootLayer() const {
+ return active_tree_->root_layer();
}
-LayerImpl* LayerTreeHostImpl::rootScrollLayer() const
-{
- return m_activeTree->RootScrollLayer();
+LayerImpl* LayerTreeHostImpl::RootScrollLayer() const {
+ return active_tree_->RootScrollLayer();
}
-LayerImpl* LayerTreeHostImpl::currentlyScrollingLayer() const
-{
- return m_activeTree->CurrentlyScrollingLayer();
+LayerImpl* LayerTreeHostImpl::CurrentlyScrollingLayer() const {
+ return active_tree_->CurrentlyScrollingLayer();
}
// Content layers can be either directly scrollable or contained in an outer
// scrolling layer which applies the scroll transform. Given a content layer,
// this function returns the associated scroll layer if any.
-static LayerImpl* findScrollLayerForContentLayer(LayerImpl* layerImpl)
-{
- if (!layerImpl)
- return 0;
+static LayerImpl* FindScrollLayerForContentLayer(LayerImpl* layer_impl) {
+ if (!layer_impl)
+ return 0;
- if (layerImpl->scrollable())
- return layerImpl;
+ if (layer_impl->scrollable())
+ return layer_impl;
- if (layerImpl->DrawsContent() && layerImpl->parent() && layerImpl->parent()->scrollable())
- return layerImpl->parent();
+ if (layer_impl->DrawsContent() &&
+ layer_impl->parent() &&
+ layer_impl->parent()->scrollable())
+ return layer_impl->parent();
- return 0;
+ return 0;
}
-void LayerTreeHostImpl::createPendingTree()
-{
- CHECK(!m_pendingTree);
- if (m_recycleTree)
- m_recycleTree.swap(m_pendingTree);
- else
- m_pendingTree = LayerTreeImpl::create(this);
- m_client->onCanDrawStateChanged(canDraw());
- m_client->onHasPendingTreeStateChanged(pendingTree());
- TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree", m_pendingTree.get());
- TRACE_EVENT_ASYNC_STEP0("cc",
- "PendingTree", m_pendingTree.get(), "waiting");
-}
-
-void LayerTreeHostImpl::checkForCompletedTileUploads()
-{
- DCHECK(!m_client->isInsideDraw()) << "Checking for completed uploads within a draw may trigger spurious redraws.";
- if (m_tileManager)
- m_tileManager->CheckForCompletedTileUploads();
-}
-
-bool LayerTreeHostImpl::activatePendingTreeIfNeeded()
-{
- if (!pendingTree())
- return false;
-
- CHECK(m_tileManager);
-
- pendingTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE);
-
- TRACE_EVENT_ASYNC_STEP1("cc",
- "PendingTree", m_pendingTree.get(), "activate",
- "state", ValueToString(activationStateAsValue()));
-
- // It's always fine to activate to an empty tree. Otherwise, only
- // activate once all visible resources in pending tree are ready
- // or tile manager has no work scheduled for pending tree.
- if (activeTree()->RootLayer() &&
- !pendingTree()->AreVisibleResourcesReady()) {
- // In smoothness takes priority mode, the pending tree's priorities are
- // ignored, so the tile manager may not have work for it even though it
- // is simultaneously not ready to be activated.
- if (m_tileManager->GlobalState().tree_priority ==
- SMOOTHNESS_TAKES_PRIORITY ||
- m_tileManager->HasPendingWorkScheduled(PENDING_TREE)) {
- TRACE_EVENT_ASYNC_STEP0("cc",
- "PendingTree",
- m_pendingTree.get(),
- "waiting");
- return false;
- }
- }
-
- activatePendingTree();
- return true;
+void LayerTreeHostImpl::CreatePendingTree() {
+ CHECK(!pending_tree_);
+ if (recycle_tree_)
+ recycle_tree_.swap(pending_tree_);
+ else
+ pending_tree_ = LayerTreeImpl::create(this);
+ client_->OnCanDrawStateChanged(CanDraw());
+ client_->OnHasPendingTreeStateChanged(pending_tree_);
+ TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree", pending_tree_.get());
+ TRACE_EVENT_ASYNC_STEP0("cc",
+ "PendingTree", pending_tree_.get(), "waiting");
}
-void LayerTreeHostImpl::activatePendingTree()
-{
- CHECK(m_pendingTree);
- TRACE_EVENT_ASYNC_END0("cc", "PendingTree", m_pendingTree.get());
-
- m_activeTree->PushPersistedState(m_pendingTree.get());
- if (m_pendingTree->needs_full_tree_sync())
- m_activeTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(m_pendingTree->RootLayer(), m_activeTree->DetachLayerTree(), m_activeTree.get()));
- TreeSynchronizer::pushProperties(m_pendingTree->RootLayer(), m_activeTree->RootLayer());
- DCHECK(!m_recycleTree);
-
- m_pendingTree->PushPropertiesTo(m_activeTree.get());
-
- // Now that we've synced everything from the pending tree to the active
- // tree, rename the pending tree the recycle tree so we can reuse it on the
- // next sync.
- m_pendingTree.swap(m_recycleTree);
- m_recycleTree->ClearRenderSurfaces();
-
- m_activeTree->DidBecomeActive();
-
- // Reduce wasted memory now that unlinked resources are guaranteed not
- // to be used.
- m_client->reduceWastedContentsTextureMemoryOnImplThread();
+void LayerTreeHostImpl::CheckForCompletedTileUploads() {
+ DCHECK(!client_->IsInsideDraw()) <<
+ "Checking for completed uploads within a draw may trigger "
+ "spurious redraws.";
+ if (tile_manager_)
+ tile_manager_->CheckForCompletedTileUploads();
+}
- m_client->onCanDrawStateChanged(canDraw());
- m_client->onHasPendingTreeStateChanged(pendingTree());
- m_client->setNeedsRedrawOnImplThread();
- m_client->renewTreePriority();
+bool LayerTreeHostImpl::ActivatePendingTreeIfNeeded() {
+ if (!pending_tree_)
+ return false;
- if (m_tileManager && m_debugState.continuousPainting) {
- RenderingStats stats;
- m_tileManager->GetRenderingStats(&stats);
- m_paintTimeCounter->SaveRasterizeTime(stats.totalRasterizeTimeForNowBinsOnPendingTree, m_activeTree->source_frame_number());
+ CHECK(tile_manager_);
+
+ pending_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_PENDING_TREE);
+
+ TRACE_EVENT_ASYNC_STEP1("cc",
+ "PendingTree", pending_tree_.get(), "activate",
+ "state", ValueToString(ActivationStateAsValue()));
+
+ // It's always fine to activate to an empty tree. Otherwise, only
+ // activate once all visible resources in pending tree are ready
+ // or tile manager has no work scheduled for pending tree.
+ if (active_tree_->root_layer() &&
+ !pending_tree_->AreVisibleResourcesReady()) {
+ // In smoothness takes priority mode, the pending tree's priorities are
+ // ignored, so the tile manager may not have work for it even though it
+ // is simultaneously not ready to be activated.
+ if (tile_manager_->GlobalState().tree_priority ==
+ SMOOTHNESS_TAKES_PRIORITY ||
+ tile_manager_->HasPendingWorkScheduled(PENDING_TREE)) {
+ TRACE_EVENT_ASYNC_STEP0("cc",
+ "PendingTree",
+ pending_tree_.get(),
+ "waiting");
+ return false;
}
-}
+ }
+
+ ActivatePendingTree();
+ return true;
+}
+
+void LayerTreeHostImpl::ActivatePendingTree() {
+ CHECK(pending_tree_);
+ TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get());
+
+ active_tree_->PushPersistedState(pending_tree_.get());
+ if (pending_tree_->needs_full_tree_sync()) {
+ active_tree_->SetRootLayer(
+ TreeSynchronizer::synchronizeTrees(pending_tree_->root_layer(),
+ active_tree_->DetachLayerTree(),
+ active_tree_.get()));
+ }
+ TreeSynchronizer::pushProperties(pending_tree_->root_layer(),
+ active_tree_->root_layer());
+ DCHECK(!recycle_tree_);
+
+ pending_tree_->PushPropertiesTo(active_tree_.get());
+
+ // Now that we've synced everything from the pending tree to the active
+ // tree, rename the pending tree the recycle tree so we can reuse it on the
+ // next sync.
+ pending_tree_.swap(recycle_tree_);
+ recycle_tree_->ClearRenderSurfaces();
+
+ active_tree_->DidBecomeActive();
+
+ // Reduce wasted memory now that unlinked resources are guaranteed not
+ // to be used.
+ client_->ReduceWastedContentsTextureMemoryOnImplThread();
+
+ client_->OnCanDrawStateChanged(CanDraw());
+ client_->OnHasPendingTreeStateChanged(pending_tree_);
+ client_->SetNeedsRedrawOnImplThread();
+ client_->RenewTreePriority();
+
+ if (tile_manager_ && debug_state_.continuousPainting) {
+ RenderingStats stats;
+ tile_manager_->GetRenderingStats(&stats);
+ paint_time_counter_->SaveRasterizeTime(
+ stats.totalRasterizeTimeForNowBinsOnPendingTree,
+ active_tree_->source_frame_number());
+ }
+}
+
+void LayerTreeHostImpl::SetVisible(bool visible) {
+ DCHECK(proxy_->IsImplThread());
+
+ if (visible_ == visible)
+ return;
+ visible_ = visible;
+ DidVisibilityChange(this, visible_);
+ EnforceManagedMemoryPolicy(managed_memory_policy_);
+
+ if (!renderer_)
+ return;
+
+ renderer_->SetVisible(visible);
+
+ SetBackgroundTickingEnabled(
+ !visible_ &&
+ !animation_registrar_->active_animation_controllers().empty());
+}
+
+bool LayerTreeHostImpl::InitializeRenderer(
+ scoped_ptr<OutputSurface> output_surface) {
+ // Since we will create a new resource provider, we cannot continue to use
+ // the old resources (i.e. render_surfaces and texture IDs). Clear them
+ // before we destroy the old resource provider.
+ if (active_tree_->root_layer())
+ ClearRenderSurfaces();
+ if (active_tree_->root_layer())
+ SendDidLoseOutputSurfaceRecursive(active_tree_->root_layer());
+ if (pending_tree_ && pending_tree_->root_layer())
+ SendDidLoseOutputSurfaceRecursive(pending_tree_->root_layer());
+ if (recycle_tree_ && recycle_tree_->root_layer())
+ SendDidLoseOutputSurfaceRecursive(recycle_tree_->root_layer());
+
+ // Note: order is important here.
+ renderer_.reset();
+ tile_manager_.reset();
+ resource_provider_.reset();
+ output_surface_.reset();
+
+ if (!output_surface->BindToClient(this))
+ return false;
-void LayerTreeHostImpl::setVisible(bool visible)
-{
- DCHECK(m_proxy->IsImplThread());
-
- if (m_visible == visible)
- return;
- m_visible = visible;
- didVisibilityChange(this, m_visible);
- EnforceManagedMemoryPolicy(m_managedMemoryPolicy);
-
- if (!m_renderer)
- return;
-
- m_renderer->SetVisible(visible);
-
- setBackgroundTickingEnabled(!m_visible && !m_animationRegistrar->active_animation_controllers().empty());
-}
-
-bool LayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurface)
-{
- // Since we will create a new resource provider, we cannot continue to use
- // the old resources (i.e. renderSurfaces and texture IDs). Clear them
- // before we destroy the old resource provider.
- if (rootLayer())
- clearRenderSurfaces();
- if (activeTree()->RootLayer())
- sendDidLoseOutputSurfaceRecursive(activeTree()->RootLayer());
- if (pendingTree() && pendingTree()->RootLayer())
- sendDidLoseOutputSurfaceRecursive(pendingTree()->RootLayer());
- if (m_recycleTree && m_recycleTree->RootLayer())
- sendDidLoseOutputSurfaceRecursive(m_recycleTree->RootLayer());
-
- // Note: order is important here.
- m_renderer.reset();
- m_tileManager.reset();
- m_resourceProvider.reset();
- m_outputSurface.reset();
-
- if (!outputSurface->BindToClient(this))
- return false;
-
- scoped_ptr<ResourceProvider> resourceProvider = ResourceProvider::Create(outputSurface.get());
- if (!resourceProvider)
- return false;
-
- if (m_settings.implSidePainting) {
- m_tileManager.reset(new TileManager(this,
- resourceProvider.get(),
- m_settings.numRasterThreads,
- m_settings.useCheapnessEstimator,
- m_settings.useColorEstimator,
- m_settings.predictionBenchmarking));
- m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats());
- }
+ scoped_ptr<ResourceProvider> resource_provider =
+ ResourceProvider::Create(output_surface.get());
+ if (!resource_provider)
+ return false;
- if (outputSurface->capabilities().has_parent_compositor)
- m_renderer = DelegatingRenderer::Create(this, outputSurface.get(), resourceProvider.get());
- else if (outputSurface->context3d())
- m_renderer = GLRenderer::Create(this, outputSurface.get(), resourceProvider.get());
- else if (outputSurface->software_device())
- m_renderer = SoftwareRenderer::Create(this, outputSurface.get(), resourceProvider.get());
- if (!m_renderer)
- return false;
+ if (settings_.implSidePainting) {
+ tile_manager_.reset(new TileManager(this,
+ resource_provider.get(),
+ settings_.numRasterThreads,
+ settings_.useCheapnessEstimator,
+ settings_.useColorEstimator,
+ settings_.predictionBenchmarking));
+ tile_manager_->SetRecordRenderingStats(debug_state_.recordRenderingStats());
+ }
+
+ if (output_surface->capabilities().has_parent_compositor) {
+ renderer_ = DelegatingRenderer::Create(this, output_surface.get(),
+ resource_provider.get());
+ } else if (output_surface->context3d()) {
+ renderer_ = GLRenderer::Create(this,
+ output_surface.get(),
+ resource_provider.get());
+ } else if (output_surface->software_device()) {
+ renderer_ = SoftwareRenderer::Create(this,
+ output_surface.get(),
+ resource_provider.get());
+ }
+ if (!renderer_)
+ return false;
- m_resourceProvider = resourceProvider.Pass();
- m_outputSurface = outputSurface.Pass();
+ resource_provider_ = resource_provider.Pass();
+ output_surface_ = output_surface.Pass();
- if (!m_visible)
- m_renderer->SetVisible(m_visible);
+ if (!visible_)
+ renderer_->SetVisible(visible_);
- m_client->onCanDrawStateChanged(canDraw());
+ client_->OnCanDrawStateChanged(CanDraw());
- // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
- // to be initialized to get max texture size.
- activeTree()->set_needs_update_draw_properties();
- if (pendingTree())
- pendingTree()->set_needs_update_draw_properties();
+ // See note in LayerTreeImpl::UpdateDrawProperties. Renderer needs
+ // to be initialized to get max texture size.
+ active_tree_->set_needs_update_draw_properties();
+ if (pending_tree_)
+ pending_tree_->set_needs_update_draw_properties();
- return true;
+ return true;
}
-void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
-{
- if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
- return;
+void LayerTreeHostImpl::SetViewportSize(gfx::Size layout_viewport_size,
+ gfx::Size device_viewport_size) {
+ if (layout_viewport_size == layout_viewport_size_ &&
+ device_viewport_size == device_viewport_size_)
+ return;
- if (pendingTree() && m_deviceViewportSize != deviceViewportSize)
- activeTree()->SetViewportSizeInvalid();
+ if (pending_tree_ && device_viewport_size_ != device_viewport_size)
+ active_tree_->SetViewportSizeInvalid();
- m_layoutViewportSize = layoutViewportSize;
- m_deviceViewportSize = deviceViewportSize;
+ layout_viewport_size_ = layout_viewport_size;
+ device_viewport_size_ = device_viewport_size;
- updateMaxScrollOffset();
+ UpdateMaxScrollOffset();
- if (m_renderer)
- m_renderer->ViewportChanged();
+ if (renderer_)
+ renderer_->ViewportChanged();
- m_client->onCanDrawStateChanged(canDraw());
+ client_->OnCanDrawStateChanged(CanDraw());
}
-static void adjustScrollsForPageScaleChange(LayerImpl* layerImpl, float pageScaleChange)
-{
- if (!layerImpl)
- return;
+static void AdjustScrollsForPageScaleChange(LayerImpl* layer_impl,
+ float page_scale_change) {
+ if (!layer_impl)
+ return;
- if (layerImpl->scrollable()) {
- // We need to convert impl-side scroll deltas to pageScale space.
- gfx::Vector2dF scrollDelta = layerImpl->scroll_delta();
- scrollDelta.Scale(pageScaleChange);
- layerImpl->SetScrollDelta(scrollDelta);
- }
+ if (layer_impl->scrollable()) {
+ // We need to convert impl-side scroll deltas to page_scale space.
+ gfx::Vector2dF scroll_delta = layer_impl->scroll_delta();
+ scroll_delta.Scale(page_scale_change);
+ layer_impl->SetScrollDelta(scroll_delta);
+ }
- for (size_t i = 0; i < layerImpl->children().size(); ++i)
- adjustScrollsForPageScaleChange(layerImpl->children()[i], pageScaleChange);
+ for (size_t i = 0; i < layer_impl->children().size(); ++i)
+ AdjustScrollsForPageScaleChange(layer_impl->children()[i],
+ page_scale_change);
}
-void LayerTreeHostImpl::setDeviceScaleFactor(float deviceScaleFactor)
-{
- if (deviceScaleFactor == m_deviceScaleFactor)
- return;
- m_deviceScaleFactor = deviceScaleFactor;
+void LayerTreeHostImpl::SetDeviceScaleFactor(float device_scale_factor) {
+ if (device_scale_factor == device_scale_factor_)
+ return;
+ device_scale_factor_ = device_scale_factor;
- updateMaxScrollOffset();
+ UpdateMaxScrollOffset();
}
-void LayerTreeHostImpl::updateMaxScrollOffset()
-{
- activeTree()->UpdateMaxScrollOffset();
+void LayerTreeHostImpl::UpdateMaxScrollOffset() {
+ active_tree_->UpdateMaxScrollOffset();
}
-void LayerTreeHostImpl::setActiveTreeNeedsUpdateDrawProperties()
-{
- activeTree()->set_needs_update_draw_properties();
+void LayerTreeHostImpl::setActiveTreeNeedsUpdateDrawProperties() {
+ active_tree_->set_needs_update_draw_properties();
}
-void LayerTreeHostImpl::setNeedsRedraw()
-{
- m_client->setNeedsRedrawOnImplThread();
+void LayerTreeHostImpl::setNeedsRedraw() {
+ client_->SetNeedsRedrawOnImplThread();
}
-bool LayerTreeHostImpl::ensureRenderSurfaceLayerList()
-{
- activeTree()->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE);
- return activeTree()->RenderSurfaceLayerList().size();
+bool LayerTreeHostImpl::EnsureRenderSurfaceLayerList() {
+ active_tree_->UpdateDrawProperties(LayerTreeImpl::UPDATE_ACTIVE_TREE);
+ return active_tree_->RenderSurfaceLayerList().size();
}
-InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewportPoint, InputHandlerClient::ScrollInputType type)
-{
- TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin");
-
- if (m_topControlsManager)
- m_topControlsManager->ScrollBegin();
+InputHandlerClient::ScrollStatus LayerTreeHostImpl::ScrollBegin(
+ gfx::Point viewport_point, InputHandlerClient::ScrollInputType type) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBegin");
- DCHECK(!currentlyScrollingLayer());
- clearCurrentlyScrollingLayer();
+ if (top_controls_manager_)
+ top_controls_manager_->ScrollBegin();
- if (!ensureRenderSurfaceLayerList())
- return ScrollIgnored;
+ DCHECK(!CurrentlyScrollingLayer());
+ ClearCurrentlyScrollingLayer();
- gfx::PointF deviceViewportPoint = gfx::ScalePoint(viewportPoint, m_deviceScaleFactor);
+ if (!EnsureRenderSurfaceLayerList())
+ return ScrollIgnored;
- // First find out which layer was hit from the saved list of visible layers
- // in the most recent frame.
- LayerImpl* layerImpl = LayerTreeHostCommon::findLayerThatIsHitByPoint(deviceViewportPoint, activeTree()->RenderSurfaceLayerList());
+ gfx::PointF device_viewport_point = gfx::ScalePoint(viewport_point,
+ device_scale_factor_);
+
+ // First find out which layer was hit from the saved list of visible layers
+ // in the most recent frame.
+ LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint(
+ device_viewport_point, active_tree_->RenderSurfaceLayerList());
+
+ // Walk up the hierarchy and look for a scrollable layer.
+ LayerImpl* potentially_scrolling_layer_impl = 0;
+ for (; layer_impl; layer_impl = layer_impl->parent()) {
+ // The content layer can also block attempts to scroll outside the main
+ // thread.
+ ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type);
+ if (status == ScrollOnMainThread) {
+ num_main_thread_scrolls_++;
+ UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
+ return ScrollOnMainThread;
+ }
- // Walk up the hierarchy and look for a scrollable layer.
- LayerImpl* potentiallyScrollingLayerImpl = 0;
- for (; layerImpl; layerImpl = layerImpl->parent()) {
- // The content layer can also block attempts to scroll outside the main thread.
- if (layerImpl->TryScroll(deviceViewportPoint, type) == ScrollOnMainThread) {
- m_numMainThreadScrolls++;
- UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
- return ScrollOnMainThread;
- }
+ LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl);
+ if (!scroll_layer_impl)
+ continue;
- LayerImpl* scrollLayerImpl = findScrollLayerForContentLayer(layerImpl);
- if (!scrollLayerImpl)
- continue;
+ status = scroll_layer_impl->TryScroll(device_viewport_point, type);
- ScrollStatus status = scrollLayerImpl->TryScroll(deviceViewportPoint, type);
+ // If any layer wants to divert the scroll event to the main thread, abort.
+ if (status == ScrollOnMainThread) {
+ num_main_thread_scrolls_++;
+ UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
+ return ScrollOnMainThread;
+ }
- // If any layer wants to divert the scroll event to the main thread, abort.
- if (status == ScrollOnMainThread) {
- m_numMainThreadScrolls++;
- UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
- return ScrollOnMainThread;
- }
+ if (status == ScrollStarted && !potentially_scrolling_layer_impl)
+ potentially_scrolling_layer_impl = scroll_layer_impl;
+ }
+
+ // When hiding top controls is enabled and the controls are hidden or
+ // overlaying the content, force scrolls to be enabled on the root layer to
+ // allow bringing the top controls back into view.
+ if (!potentially_scrolling_layer_impl && top_controls_manager_ &&
+ top_controls_manager_->content_top_offset() !=
+ settings_.topControlsHeight) {
+ potentially_scrolling_layer_impl = RootScrollLayer();
+ }
+
+ if (potentially_scrolling_layer_impl) {
+ active_tree_->set_currently_scrolling_layer(
+ potentially_scrolling_layer_impl);
+ should_bubble_scrolls_ = (type != NonBubblingGesture);
+ wheel_scrolling_ = (type == Wheel);
+ num_impl_thread_scrolls_++;
+ client_->RenewTreePriority();
+ UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
+ return ScrollStarted;
+ }
+ return ScrollIgnored;
+}
+
+gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta(
+ LayerImpl* layer_impl,
+ float scale_from_viewport_to_screen_space,
+ gfx::PointF viewport_point,
+ gfx::Vector2dF viewport_delta) {
+ // Layers with non-invertible screen space transforms should not have passed
+ // the scroll hit test in the first place.
+ DCHECK(layer_impl->screen_space_transform().IsInvertible());
+ gfx::Transform inverse_screen_space_transform(
+ gfx::Transform::kSkipInitialization);
+ bool did_invert = layer_impl->screen_space_transform().GetInverse(
+ &inverse_screen_space_transform);
+ // TODO: With the advent of impl-side crolling for non-root layers, we may
+ // need to explicitly handle uninvertible transforms here.
+ DCHECK(did_invert);
+
+ gfx::PointF screen_space_point =
+ gfx::ScalePoint(viewport_point, scale_from_viewport_to_screen_space);
+
+ gfx::Vector2dF screen_space_delta = viewport_delta;
+ screen_space_delta.Scale(scale_from_viewport_to_screen_space);
+
+ // First project the scroll start and end points to local layer space to find
+ // the scroll delta in layer coordinates.
+ bool start_clipped, end_clipped;
+ gfx::PointF screen_space_end_point = screen_space_point + screen_space_delta;
+ gfx::PointF local_start_point =
+ MathUtil::projectPoint(inverse_screen_space_transform,
+ screen_space_point,
+ start_clipped);
+ gfx::PointF local_end_point =
+ MathUtil::projectPoint(inverse_screen_space_transform,
+ screen_space_end_point,
+ end_clipped);
+
+ // In general scroll point coordinates should not get clipped.
+ DCHECK(!start_clipped);
+ DCHECK(!end_clipped);
+ if (start_clipped || end_clipped)
+ return gfx::Vector2dF();
+
+ // local_start_point and local_end_point are in content space but we want to
+ // move them to layer space for scrolling.
+ float width_scale = 1.f / layer_impl->contents_scale_x();
+ float height_scale = 1.f / layer_impl->contents_scale_y();
+ local_start_point.Scale(width_scale, height_scale);
+ local_end_point.Scale(width_scale, height_scale);
+
+ // Apply the scroll delta.
+ gfx::Vector2dF previous_delta = layer_impl->scroll_delta();
+ layer_impl->ScrollBy(local_end_point - local_start_point);
+
+ // Get the end point in the layer's content space so we can apply its
+ // ScreenSpaceTransform.
+ gfx::PointF actual_local_end_point = local_start_point +
+ layer_impl->scroll_delta() -
+ previous_delta;
+ gfx::PointF actual_local_content_end_point =
+ gfx::ScalePoint(actual_local_end_point,
+ 1.f / width_scale,
+ 1.f / height_scale);
+
+ // Calculate the applied scroll delta in viewport space coordinates.
+ gfx::PointF actual_screen_space_end_point =
+ MathUtil::mapPoint(layer_impl->screen_space_transform(),
+ actual_local_content_end_point,
+ end_clipped);
+ DCHECK(!end_clipped);
+ if (end_clipped)
+ return gfx::Vector2dF();
+ gfx::PointF actual_viewport_end_point =
+ gfx::ScalePoint(actual_screen_space_end_point,
+ 1.f / scale_from_viewport_to_screen_space);
+ return actual_viewport_end_point - viewport_point;
+}
+
+static gfx::Vector2dF ScrollLayerWithLocalDelta(LayerImpl* layer_impl,
+ gfx::Vector2dF local_delta) {
+ gfx::Vector2dF previous_delta(layer_impl->scroll_delta());
+ layer_impl->ScrollBy(local_delta);
+ return layer_impl->scroll_delta() - previous_delta;
+}
+
+bool LayerTreeHostImpl::ScrollBy(gfx::Point viewport_point,
+ gfx::Vector2dF scroll_delta) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
+ if (!CurrentlyScrollingLayer())
+ return false;
- if (status == ScrollStarted && !potentiallyScrollingLayerImpl)
- potentiallyScrollingLayerImpl = scrollLayerImpl;
+ gfx::Vector2dF pending_delta = scroll_delta;
+ bool did_scroll = false;
+
+ for (LayerImpl* layer_impl = CurrentlyScrollingLayer();
+ layer_impl;
+ layer_impl = layer_impl->parent()) {
+ if (!layer_impl->scrollable())
+ continue;
+
+ gfx::Vector2dF applied_delta;
+ if (top_controls_manager_ && layer_impl == RootScrollLayer())
+ pending_delta = top_controls_manager_->ScrollBy(pending_delta);
+
+ // Gesture events need to be transformed from viewport coordinates to local
+ // layer coordinates so that the scrolling contents exactly follow the
+ // user's finger. In contrast, wheel events represent a fixed amount of
+ // scrolling so we can just apply them directly.
+ if (!wheel_scrolling_) {
+ float scale_from_viewport_to_screen_space = device_scale_factor_;
+ applied_delta =
+ ScrollLayerWithViewportSpaceDelta(layer_impl,
+ scale_from_viewport_to_screen_space,
+ viewport_point, pending_delta);
+ } else {
+ applied_delta = ScrollLayerWithLocalDelta(layer_impl, pending_delta);
}
- // When hiding top controls is enabled and the controls are hidden or
- // overlaying the content, force scrolls to be enabled on the root layer to
- // allow bringing the top controls back into view.
- if (!potentiallyScrollingLayerImpl && m_topControlsManager &&
- m_topControlsManager->content_top_offset() != m_settings.topControlsHeight) {
- potentiallyScrollingLayerImpl = rootScrollLayer();
+ // If the layer wasn't able to move, try the next one in the hierarchy.
+ float move_threshold_squared = 0.1f * 0.1f;
+ if (applied_delta.LengthSquared() < move_threshold_squared) {
+ if (should_bubble_scrolls_ || !did_lock_scrolling_layer_)
+ continue;
+ else
+ break;
}
-
- if (potentiallyScrollingLayerImpl) {
- m_activeTree->set_currently_scrolling_layer(potentiallyScrollingLayerImpl);
- m_shouldBubbleScrolls = (type != NonBubblingGesture);
- m_wheelScrolling = (type == Wheel);
- m_numImplThreadScrolls++;
- m_client->renewTreePriority();
- UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
- return ScrollStarted;
+ did_scroll = true;
+ did_lock_scrolling_layer_ = true;
+ if (!should_bubble_scrolls_) {
+ active_tree_->set_currently_scrolling_layer(layer_impl);
+ break;
}
- return ScrollIgnored;
-}
-gfx::Vector2dF LayerTreeHostImpl::scrollLayerWithViewportSpaceDelta(LayerImpl* layerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx::Vector2dF viewportDelta)
-{
- // Layers with non-invertible screen space transforms should not have passed the scroll hit
- // test in the first place.
- DCHECK(layerImpl->screen_space_transform().IsInvertible());
- gfx::Transform inverseScreenSpaceTransform(gfx::Transform::kSkipInitialization);
- bool didInvert = layerImpl->screen_space_transform().GetInverse(&inverseScreenSpaceTransform);
- // TODO: With the advent of impl-side crolling for non-root layers, we may
- // need to explicitly handle uninvertible transforms here.
- DCHECK(didInvert);
-
- gfx::PointF screenSpacePoint = gfx::ScalePoint(viewportPoint, scaleFromViewportToScreenSpace);
-
- gfx::Vector2dF screenSpaceDelta = viewportDelta;
- screenSpaceDelta.Scale(scaleFromViewportToScreenSpace);
-
- // First project the scroll start and end points to local layer space to find the scroll delta
- // in layer coordinates.
- bool startClipped, endClipped;
- gfx::PointF screenSpaceEndPoint = screenSpacePoint + screenSpaceDelta;
- gfx::PointF localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped);
- gfx::PointF localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped);
-
- // In general scroll point coordinates should not get clipped.
- DCHECK(!startClipped);
- DCHECK(!endClipped);
- if (startClipped || endClipped)
- return gfx::Vector2dF();
-
- // localStartPoint and localEndPoint are in content space but we want to move them to layer space for scrolling.
- float widthScale = 1.f / layerImpl->contents_scale_x();
- float heightScale = 1.f / layerImpl->contents_scale_y();
- localStartPoint.Scale(widthScale, heightScale);
- localEndPoint.Scale(widthScale, heightScale);
-
- // Apply the scroll delta.
- gfx::Vector2dF previousDelta = layerImpl->scroll_delta();
- layerImpl->ScrollBy(localEndPoint - localStartPoint);
-
- // Get the end point in the layer's content space so we can apply its screenSpaceTransform.
- gfx::PointF actualLocalEndPoint = localStartPoint + layerImpl->scroll_delta() - previousDelta;
- gfx::PointF actualLocalContentEndPoint = gfx::ScalePoint(actualLocalEndPoint, 1 / widthScale, 1 / heightScale);
-
- // Calculate the applied scroll delta in viewport space coordinates.
- gfx::PointF actualScreenSpaceEndPoint = MathUtil::mapPoint(layerImpl->screen_space_transform(), actualLocalContentEndPoint, endClipped);
- DCHECK(!endClipped);
- if (endClipped)
- return gfx::Vector2dF();
- gfx::PointF actualViewportEndPoint = gfx::ScalePoint(actualScreenSpaceEndPoint, 1 / scaleFromViewportToScreenSpace);
- return actualViewportEndPoint - viewportPoint;
-}
-
-static gfx::Vector2dF scrollLayerWithLocalDelta(LayerImpl& layerImpl, gfx::Vector2dF localDelta)
-{
- gfx::Vector2dF previousDelta(layerImpl.scroll_delta());
- layerImpl.ScrollBy(localDelta);
- return layerImpl.scroll_delta() - previousDelta;
-}
-
-bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint,
- const gfx::Vector2dF& scrollDelta)
-{
- TRACE_EVENT0("cc", "LayerTreeHostImpl::scrollBy");
- if (!currentlyScrollingLayer())
- return false;
-
- gfx::Vector2dF pendingDelta = scrollDelta;
- bool didScroll = false;
-
- for (LayerImpl* layerImpl = currentlyScrollingLayer(); layerImpl; layerImpl = layerImpl->parent()) {
- if (!layerImpl->scrollable())
- continue;
-
- gfx::Vector2dF appliedDelta;
- if (m_topControlsManager && layerImpl == rootScrollLayer())
- pendingDelta = m_topControlsManager->ScrollBy(pendingDelta);
-
- // Gesture events need to be transformed from viewport coordinates to local layer coordinates
- // so that the scrolling contents exactly follow the user's finger. In contrast, wheel
- // events represent a fixed amount of scrolling so we can just apply them directly.
- if (!m_wheelScrolling) {
- float scaleFromViewportToScreenSpace = m_deviceScaleFactor;
- appliedDelta = scrollLayerWithViewportSpaceDelta(layerImpl, scaleFromViewportToScreenSpace, viewportPoint, pendingDelta);
- } else
- appliedDelta = scrollLayerWithLocalDelta(*layerImpl, pendingDelta);
-
- // If the layer wasn't able to move, try the next one in the hierarchy.
- float moveThresholdSquared = 0.1f * 0.1f;
- if (appliedDelta.LengthSquared() < moveThresholdSquared) {
- if (m_shouldBubbleScrolls || !m_didLockScrollingLayer)
- continue;
- else
- break;
- }
- didScroll = true;
- m_didLockScrollingLayer = true;
- if (!m_shouldBubbleScrolls) {
- m_activeTree->set_currently_scrolling_layer(layerImpl);
- break;
- }
-
- // If the applied delta is within 45 degrees of the input delta, bail out to make it easier
- // to scroll just one layer in one direction without affecting any of its parents.
- float angleThreshold = 45;
- if (MathUtil::smallestAngleBetweenVectors(appliedDelta, pendingDelta) < angleThreshold) {
- pendingDelta = gfx::Vector2d();
- break;
- }
+ // If the applied delta is within 45 degrees of the input delta, bail out to
+ // make it easier to scroll just one layer in one direction without
+ // affecting any of its parents.
+ float angle_threshold = 45;
+ if (MathUtil::smallestAngleBetweenVectors(
+ applied_delta, pending_delta) < angle_threshold) {
+ pending_delta = gfx::Vector2d();
+ break;
+ }
- // Allow further movement only on an axis perpendicular to the direction in which the layer
- // moved.
- gfx::Vector2dF perpendicularAxis(-appliedDelta.y(), appliedDelta.x());
- pendingDelta = MathUtil::projectVector(pendingDelta, perpendicularAxis);
+ // Allow further movement only on an axis perpendicular to the direction in
+ // which the layer moved.
+ gfx::Vector2dF perpendicular_axis(-applied_delta.y(), applied_delta.x());
+ pending_delta = MathUtil::projectVector(pending_delta, perpendicular_axis);
- if (gfx::ToFlooredVector2d(pendingDelta).IsZero())
- break;
- }
+ if (gfx::ToFlooredVector2d(pending_delta).IsZero())
+ break;
+ }
- if (didScroll) {
- m_client->setNeedsCommitOnImplThread();
- m_client->setNeedsRedrawOnImplThread();
- m_client->renewTreePriority();
- }
- return didScroll;
+ if (did_scroll) {
+ client_->SetNeedsCommitOnImplThread();
+ client_->SetNeedsRedrawOnImplThread();
+ client_->RenewTreePriority();
+ }
+ return did_scroll;
}
-void LayerTreeHostImpl::clearCurrentlyScrollingLayer()
-{
- m_activeTree->ClearCurrentlyScrollingLayer();
- m_didLockScrollingLayer = false;
+void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() {
+ active_tree_->ClearCurrentlyScrollingLayer();
+ did_lock_scrolling_layer_ = false;
}
-void LayerTreeHostImpl::scrollEnd()
-{
- if (m_topControlsManager)
- m_topControlsManager->ScrollEnd();
- clearCurrentlyScrollingLayer();
+void LayerTreeHostImpl::ScrollEnd() {
+ if (top_controls_manager_)
+ top_controls_manager_->ScrollEnd();
+ ClearCurrentlyScrollingLayer();
}
-void LayerTreeHostImpl::pinchGestureBegin()
-{
- m_pinchGestureActive = true;
- m_previousPinchAnchor = gfx::Point();
- m_client->renewTreePriority();
+void LayerTreeHostImpl::PinchGestureBegin() {
+ pinch_gesture_active_ = true;
+ previous_pinch_anchor_ = gfx::Point();
+ client_->RenewTreePriority();
}
-void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta, gfx::Point anchor)
-{
- TRACE_EVENT0("cc", "LayerTreeHostImpl::pinchGestureUpdate");
+void LayerTreeHostImpl::PinchGestureUpdate(float magnify_delta,
+ gfx::Point anchor) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::PinchGestureUpdate");
- if (!rootScrollLayer())
- return;
+ if (!RootScrollLayer())
+ return;
- // Keep the center-of-pinch anchor specified by (x, y) in a stable
- // position over the course of the magnify.
- float pageScaleDelta = activeTree()->page_scale_delta();
- gfx::PointF previousScaleAnchor = gfx::ScalePoint(anchor, 1 / pageScaleDelta);
- activeTree()->SetPageScaleDelta(pageScaleDelta * magnifyDelta);
- pageScaleDelta = activeTree()->page_scale_delta();
- gfx::PointF newScaleAnchor = gfx::ScalePoint(anchor, 1 / pageScaleDelta);
- gfx::Vector2dF move = previousScaleAnchor - newScaleAnchor;
+ // Keep the center-of-pinch anchor specified by (x, y) in a stable
+ // position over the course of the magnify.
+ float page_scale_delta = active_tree_->page_scale_delta();
+ gfx::PointF previous_scale_anchor =
+ gfx::ScalePoint(anchor, 1.f / page_scale_delta);
+ active_tree_->SetPageScaleDelta(page_scale_delta * magnify_delta);
+ page_scale_delta = active_tree_->page_scale_delta();
+ gfx::PointF new_scale_anchor =
+ gfx::ScalePoint(anchor, 1.f / page_scale_delta);
+ gfx::Vector2dF move = previous_scale_anchor - new_scale_anchor;
- m_previousPinchAnchor = anchor;
+ previous_pinch_anchor_ = anchor;
- move.Scale(1 / activeTree()->page_scale_factor());
+ move.Scale(1 / active_tree_->page_scale_factor());
- rootScrollLayer()->ScrollBy(move);
+ RootScrollLayer()->ScrollBy(move);
- if (rootScrollLayer()->scrollbar_animation_controller())
- rootScrollLayer()->scrollbar_animation_controller()->didPinchGestureUpdate(base::TimeTicks::Now());
+ if (RootScrollLayer()->scrollbar_animation_controller()) {
+ RootScrollLayer()->scrollbar_animation_controller()->
+ didPinchGestureUpdate(base::TimeTicks::Now());
+ }
- m_client->setNeedsCommitOnImplThread();
- m_client->setNeedsRedrawOnImplThread();
- m_client->renewTreePriority();
+ client_->SetNeedsCommitOnImplThread();
+ client_->SetNeedsRedrawOnImplThread();
+ client_->RenewTreePriority();
}
-void LayerTreeHostImpl::pinchGestureEnd()
-{
- m_pinchGestureActive = false;
+void LayerTreeHostImpl::PinchGestureEnd() {
+ pinch_gesture_active_ = false;
- if (rootScrollLayer() && rootScrollLayer()->scrollbar_animation_controller())
- rootScrollLayer()->scrollbar_animation_controller()->didPinchGestureEnd(base::TimeTicks::Now());
+ if (RootScrollLayer() &&
+ RootScrollLayer()->scrollbar_animation_controller()) {
+ RootScrollLayer()->scrollbar_animation_controller()->
+ didPinchGestureEnd(base::TimeTicks::Now());
+ }
- m_client->setNeedsCommitOnImplThread();
+ client_->SetNeedsCommitOnImplThread();
}
-static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerImpl)
-{
- if (!layerImpl)
- return;
+static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,
+ LayerImpl* layer_impl) {
+ if (!layer_impl)
+ return;
- gfx::Vector2d scrollDelta = gfx::ToFlooredVector2d(layerImpl->scroll_delta());
- if (!scrollDelta.IsZero()) {
- LayerTreeHostCommon::ScrollUpdateInfo scroll;
- scroll.layerId = layerImpl->id();
- scroll.scrollDelta = scrollDelta;
- scrollInfo->scrolls.push_back(scroll);
- layerImpl->SetSentScrollDelta(scrollDelta);
- }
+ gfx::Vector2d scroll_delta =
+ gfx::ToFlooredVector2d(layer_impl->scroll_delta());
+ if (!scroll_delta.IsZero()) {
+ LayerTreeHostCommon::ScrollUpdateInfo scroll;
+ scroll.layerId = layer_impl->id();
+ scroll.scrollDelta = scroll_delta;
+ scroll_info->scrolls.push_back(scroll);
+ layer_impl->SetSentScrollDelta(scroll_delta);
+ }
- for (size_t i = 0; i < layerImpl->children().size(); ++i)
- collectScrollDeltas(scrollInfo, layerImpl->children()[i]);
+ for (size_t i = 0; i < layer_impl->children().size(); ++i)
+ CollectScrollDeltas(scroll_info, layer_impl->children()[i]);
}
-scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::processScrollDeltas()
-{
- scoped_ptr<ScrollAndScaleSet> scrollInfo(new ScrollAndScaleSet());
+scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
+ scoped_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet());
- collectScrollDeltas(scrollInfo.get(), rootLayer());
- scrollInfo->pageScaleDelta = activeTree()->page_scale_delta();
- activeTree()->set_sent_page_scale_delta(scrollInfo->pageScaleDelta);
+ CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer());
+ scroll_info->pageScaleDelta = active_tree_->page_scale_delta();
+ active_tree_->set_sent_page_scale_delta(scroll_info->pageScaleDelta);
- return scrollInfo.Pass();
+ return scroll_info.Pass();
}
-void LayerTreeHostImpl::SetFullRootLayerDamage()
-{
- if (rootLayer()) {
- RenderSurfaceImpl* renderSurface = rootLayer()->render_surface();
- if (renderSurface)
- renderSurface->damage_tracker()->ForceFullDamageNextUpdate();
- }
+void LayerTreeHostImpl::SetFullRootLayerDamage() {
+ if (active_tree_->root_layer()) {
+ RenderSurfaceImpl* render_surface =
+ active_tree_->root_layer()->render_surface();
+ if (render_surface)
+ render_surface->damage_tracker()->ForceFullDamageNextUpdate();
+ }
}
-void LayerTreeHostImpl::animatePageScale(base::TimeTicks time)
-{
- if (!m_pageScaleAnimation || !rootScrollLayer())
- return;
+void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks time) {
+ if (!page_scale_animation_ || !RootScrollLayer())
+ return;
- double monotonicTime = (time - base::TimeTicks()).InSecondsF();
- gfx::Vector2dF scrollTotal = rootScrollLayer()->scroll_offset() + rootScrollLayer()->scroll_delta();
+ double monotonic_time = (time - base::TimeTicks()).InSecondsF();
+ gfx::Vector2dF scroll_total = RootScrollLayer()->scroll_offset() +
+ RootScrollLayer()->scroll_delta();
- activeTree()->SetPageScaleDelta(m_pageScaleAnimation->PageScaleFactorAtTime(monotonicTime) / activeTree()->page_scale_factor());
- gfx::Vector2dF nextScroll = m_pageScaleAnimation->ScrollOffsetAtTime(monotonicTime);
+ active_tree_->SetPageScaleDelta(
+ page_scale_animation_->PageScaleFactorAtTime(monotonic_time) /
+ active_tree_->page_scale_factor());
+ gfx::Vector2dF next_scroll =
+ page_scale_animation_->ScrollOffsetAtTime(monotonic_time);
- rootScrollLayer()->ScrollBy(nextScroll - scrollTotal);
- m_client->setNeedsRedrawOnImplThread();
-
- if (m_pageScaleAnimation->IsAnimationCompleteAtTime(monotonicTime)) {
- m_pageScaleAnimation.reset();
- m_client->setNeedsCommitOnImplThread();
- m_client->renewTreePriority();
- }
+ RootScrollLayer()->ScrollBy(next_scroll - scroll_total);
+ client_->SetNeedsRedrawOnImplThread();
+
+ if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) {
+ page_scale_animation_.reset();
+ client_->SetNeedsCommitOnImplThread();
+ client_->RenewTreePriority();
+ }
}
-void LayerTreeHostImpl::animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime)
-{
- if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_animation_controllers().empty() || !rootLayer())
- return;
+void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time,
+ base::Time wall_clock_time) {
+ if (!settings_.acceleratedAnimationEnabled ||
+ animation_registrar_->active_animation_controllers().empty() ||
+ !active_tree_->root_layer())
+ return;
- TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers");
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers");
- m_lastAnimationTime = wallClockTime;
- double monotonicSeconds = (monotonicTime - base::TimeTicks()).InSecondsF();
+ last_animation_time_ = wall_clock_time;
+ double monotonic_seconds = (monotonic_time - base::TimeTicks()).InSecondsF();
- AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->active_animation_controllers();
- for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(); ++iter)
- (*iter).second->Animate(monotonicSeconds);
+ AnimationRegistrar::AnimationControllerMap copy =
+ animation_registrar_->active_animation_controllers();
+ for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
+ iter != copy.end();
+ ++iter)
+ (*iter).second->Animate(monotonic_seconds);
- m_client->setNeedsRedrawOnImplThread();
- setBackgroundTickingEnabled(!m_visible && !m_animationRegistrar->active_animation_controllers().empty());
+ client_->SetNeedsRedrawOnImplThread();
+ SetBackgroundTickingEnabled(
+ !visible_ &&
+ !animation_registrar_->active_animation_controllers().empty());
}
-void LayerTreeHostImpl::updateAnimationState()
-{
- if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_animation_controllers().empty() || !rootLayer())
- return;
-
- TRACE_EVENT0("cc", "LayerTreeHostImpl::updateAnimationState");
- scoped_ptr<AnimationEventsVector> events(make_scoped_ptr(new AnimationEventsVector));
- AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->active_animation_controllers();
- for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(); ++iter)
- (*iter).second->UpdateState(events.get());
-
- if (!events->empty())
- m_client->postAnimationEventsToMainThreadOnImplThread(events.Pass(), m_lastAnimationTime);
+void LayerTreeHostImpl::UpdateAnimationState() {
+ if (!settings_.acceleratedAnimationEnabled ||
+ animation_registrar_->active_animation_controllers().empty() ||
+ !active_tree_->root_layer())
+ return;
+
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::UpdateAnimationState");
+ scoped_ptr<AnimationEventsVector> events =
+ make_scoped_ptr(new AnimationEventsVector);
+ AnimationRegistrar::AnimationControllerMap copy =
+ animation_registrar_->active_animation_controllers();
+ for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
+ iter != copy.end();
+ ++iter)
+ (*iter).second->UpdateState(events.get());
+
+ if (!events->empty()) {
+ client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass(),
+ last_animation_time_);
+ }
+}
+
+base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const {
+ return base::TimeDelta::FromSeconds(1);
+}
+
+void LayerTreeHostImpl::SendDidLoseOutputSurfaceRecursive(LayerImpl* current) {
+ DCHECK(current);
+ current->DidLoseOutputSurface();
+ if (current->mask_layer())
+ SendDidLoseOutputSurfaceRecursive(current->mask_layer());
+ if (current->replica_layer())
+ SendDidLoseOutputSurfaceRecursive(current->replica_layer());
+ for (size_t i = 0; i < current->children().size(); ++i)
+ SendDidLoseOutputSurfaceRecursive(current->children()[i]);
+}
+
+void LayerTreeHostImpl::ClearRenderSurfaces() {
+ active_tree_->ClearRenderSurfaces();
+ if (pending_tree_)
+ pending_tree_->ClearRenderSurfaces();
+}
+
+std::string LayerTreeHostImpl::LayerTreeAsText() const {
+ std::string str;
+ if (active_tree_->root_layer()) {
+ str = active_tree_->root_layer()->LayerTreeAsText();
+ str += "RenderSurfaces:\n";
+ DumpRenderSurfaces(&str, 1, active_tree_->root_layer());
+ }
+ return str;
}
-base::TimeDelta LayerTreeHostImpl::lowFrequencyAnimationInterval() const
-{
- return base::TimeDelta::FromSeconds(1);
+std::string LayerTreeHostImpl::LayerTreeAsJson() const {
+ std::string str;
+ if (active_tree_->root_layer()) {
+ scoped_ptr<base::Value> json(active_tree_->root_layer()->LayerTreeAsJson());
+ base::JSONWriter::WriteWithOptions(
+ json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str);
+ }
+ return str;
}
-void LayerTreeHostImpl::sendDidLoseOutputSurfaceRecursive(LayerImpl* current)
-{
- DCHECK(current);
- current->DidLoseOutputSurface();
- if (current->mask_layer())
- sendDidLoseOutputSurfaceRecursive(current->mask_layer());
- if (current->replica_layer())
- sendDidLoseOutputSurfaceRecursive(current->replica_layer());
- for (size_t i = 0; i < current->children().size(); ++i)
- sendDidLoseOutputSurfaceRecursive(current->children()[i]);
+void LayerTreeHostImpl::DumpRenderSurfaces(std::string* str,
+ int indent,
+ const LayerImpl* layer) const {
+ if (layer->render_surface())
+ layer->render_surface()->DumpSurface(str, indent);
+
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ DumpRenderSurfaces(str, indent, layer->children()[i]);
}
-void LayerTreeHostImpl::clearRenderSurfaces()
-{
- activeTree()->ClearRenderSurfaces();
- if (pendingTree())
- pendingTree()->ClearRenderSurfaces();
+int LayerTreeHostImpl::SourceAnimationFrameNumber() const {
+ return fps_counter_->currentFrameNumber();
}
-std::string LayerTreeHostImpl::layerTreeAsText() const
-{
- std::string str;
- if (rootLayer()) {
- str = rootLayer()->LayerTreeAsText();
- str += "RenderSurfaces:\n";
- dumpRenderSurfaces(&str, 1, rootLayer());
- }
- return str;
+void LayerTreeHostImpl::CollectRenderingStats(RenderingStats* stats) const {
+ stats->numFramesSentToScreen = fps_counter_->currentFrameNumber();
+ stats->droppedFrameCount = fps_counter_->droppedFrameCount();
+ stats->numImplThreadScrolls = num_impl_thread_scrolls_;
+ stats->numMainThreadScrolls = num_main_thread_scrolls_;
+ stats->numLayersDrawn = cumulative_num_layers_drawn_;
+ stats->numMissingTiles = cumulative_num_missing_tiles_;
+
+ if (tile_manager_)
+ tile_manager_->GetRenderingStats(stats);
}
-std::string LayerTreeHostImpl::layerTreeAsJson() const
-{
- std::string str;
- if (rootLayer()) {
- scoped_ptr<base::Value> json(rootLayer()->LayerTreeAsJson());
- base::JSONWriter::WriteWithOptions(
- json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str);
- }
- return str;
-}
-
-void LayerTreeHostImpl::dumpRenderSurfaces(std::string* str, int indent, const LayerImpl* layer) const
-{
- if (layer->render_surface())
- layer->render_surface()->DumpSurface(str, indent);
-
- for (size_t i = 0; i < layer->children().size(); ++i)
- dumpRenderSurfaces(str, indent, layer->children()[i]);
-}
-
-int LayerTreeHostImpl::sourceAnimationFrameNumber() const
-{
- return fpsCounter()->currentFrameNumber();
-}
-
-void LayerTreeHostImpl::renderingStats(RenderingStats* stats) const
-{
- stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber();
- stats->droppedFrameCount = fpsCounter()->droppedFrameCount();
- stats->numImplThreadScrolls = m_numImplThreadScrolls;
- stats->numMainThreadScrolls = m_numMainThreadScrolls;
- stats->numLayersDrawn = m_cumulativeNumLayersDrawn;
- stats->numMissingTiles = m_cumulativeNumMissingTiles;
-
- if (m_tileManager)
- m_tileManager->GetRenderingStats(stats);
-}
-
-void LayerTreeHostImpl::sendManagedMemoryStats(
- size_t memoryVisibleBytes,
- size_t memoryVisibleAndNearbyBytes,
- size_t memoryUseBytes)
-{
- if (!renderer())
- return;
-
- // Round the numbers being sent up to the next 8MB, to throttle the rate
- // at which we spam the GPU process.
- static const size_t roundingStep = 8 * 1024 * 1024;
- memoryVisibleBytes = RoundUp(memoryVisibleBytes, roundingStep);
- memoryVisibleAndNearbyBytes = RoundUp(memoryVisibleAndNearbyBytes, roundingStep);
- memoryUseBytes = RoundUp(memoryUseBytes, roundingStep);
- if (m_lastSentMemoryVisibleBytes == memoryVisibleBytes &&
- m_lastSentMemoryVisibleAndNearbyBytes == memoryVisibleAndNearbyBytes &&
- m_lastSentMemoryUseBytes == memoryUseBytes) {
- return;
- }
- m_lastSentMemoryVisibleBytes = memoryVisibleBytes;
- m_lastSentMemoryVisibleAndNearbyBytes = memoryVisibleAndNearbyBytes;
- m_lastSentMemoryUseBytes = memoryUseBytes;
+void LayerTreeHostImpl::SendManagedMemoryStats(
+ size_t memory_visible_bytes,
+ size_t memory_visible_and_nearby_bytes,
+ size_t memory_use_bytes) {
+ if (!renderer_)
+ return;
- renderer()->SendManagedMemoryStats(m_lastSentMemoryVisibleBytes,
- m_lastSentMemoryVisibleAndNearbyBytes,
- m_lastSentMemoryUseBytes);
+ // Round the numbers being sent up to the next 8MB, to throttle the rate
+ // at which we spam the GPU process.
+ static const size_t rounding_step = 8 * 1024 * 1024;
+ memory_visible_bytes = RoundUp(memory_visible_bytes, rounding_step);
+ memory_visible_and_nearby_bytes = RoundUp(memory_visible_and_nearby_bytes,
+ rounding_step);
+ memory_use_bytes = RoundUp(memory_use_bytes, rounding_step);
+ if (last_sent_memory_visible_bytes_ == memory_visible_bytes &&
+ last_sent_memory_visible_and_nearby_bytes_ ==
+ memory_visible_and_nearby_bytes &&
+ last_sent_memory_use_bytes_ == memory_use_bytes) {
+ return;
+ }
+ last_sent_memory_visible_bytes_ = memory_visible_bytes;
+ last_sent_memory_visible_and_nearby_bytes_ = memory_visible_and_nearby_bytes;
+ last_sent_memory_use_bytes_ = memory_use_bytes;
+
+ renderer_->SendManagedMemoryStats(last_sent_memory_visible_bytes_,
+ last_sent_memory_visible_and_nearby_bytes_,
+ last_sent_memory_use_bytes_);
}
-void LayerTreeHostImpl::animateScrollbars(base::TimeTicks time)
-{
- animateScrollbarsRecursive(rootLayer(), time);
+void LayerTreeHostImpl::AnimateScrollbars(base::TimeTicks time) {
+ AnimateScrollbarsRecursive(active_tree_->root_layer(), time);
}
-void LayerTreeHostImpl::animateScrollbarsRecursive(LayerImpl* layer, base::TimeTicks time)
-{
- if (!layer)
- return;
+void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
+ base::TimeTicks time) {
+ if (!layer)
+ return;
- ScrollbarAnimationController* scrollbarController = layer->scrollbar_animation_controller();
- if (scrollbarController && scrollbarController->animate(time))
- m_client->setNeedsRedrawOnImplThread();
+ ScrollbarAnimationController* scrollbar_controller =
+ layer->scrollbar_animation_controller();
+ if (scrollbar_controller && scrollbar_controller->animate(time))
+ client_->SetNeedsRedrawOnImplThread();
- for (size_t i = 0; i < layer->children().size(); ++i)
- animateScrollbarsRecursive(layer->children()[i], time);
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ AnimateScrollbarsRecursive(layer->children()[i], time);
}
-void LayerTreeHostImpl::setTreePriority(TreePriority priority)
-{
- if (!m_tileManager)
- return;
+void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
+ if (!tile_manager_)
+ return;
- GlobalStateThatImpactsTilePriority new_state(m_tileManager->GlobalState());
- if (new_state.tree_priority == priority)
- return;
+ GlobalStateThatImpactsTilePriority new_state(tile_manager_->GlobalState());
+ if (new_state.tree_priority == priority)
+ return;
- new_state.tree_priority = priority;
- m_tileManager->SetGlobalState(new_state);
+ new_state.tree_priority = priority;
+ tile_manager_->SetGlobalState(new_state);
}
-void LayerTreeHostImpl::beginNextFrame()
-{
- m_currentFrameTime = base::TimeTicks();
+void LayerTreeHostImpl::BeginNextFrame() {
+ current_frame_time_ = base::TimeTicks();
}
-base::TimeTicks LayerTreeHostImpl::currentFrameTime()
-{
- if (m_currentFrameTime.is_null())
- m_currentFrameTime = base::TimeTicks::Now();
- return m_currentFrameTime;
+base::TimeTicks LayerTreeHostImpl::CurrentFrameTime() {
+ if (current_frame_time_.is_null())
+ current_frame_time_ = base::TimeTicks::Now();
+ return current_frame_time_;
}
-scoped_ptr<base::Value> LayerTreeHostImpl::asValue() const
-{
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
- state->Set("activation_state", activationStateAsValue().release());
- state->Set("frame_state", frameStateAsValue().release());
- return state.PassAs<base::Value>();
+scoped_ptr<base::Value> LayerTreeHostImpl::AsValue() const {
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ state->Set("activation_state", ActivationStateAsValue().release());
+ state->Set("frame_state", FrameStateAsValue().release());
+ return state.PassAs<base::Value>();
}
-scoped_ptr<base::Value> LayerTreeHostImpl::activationStateAsValue() const
-{
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
- state->SetString("lthi_id", StringPrintf("%p", this));
- state->SetBoolean("visible_resources_ready", pendingTree()->AreVisibleResourcesReady());
- state->Set("tile_manager", m_tileManager->BasicStateAsValue().release());
- return state.PassAs<base::Value>();
+scoped_ptr<base::Value> LayerTreeHostImpl::ActivationStateAsValue() const {
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ state->SetString("lthi_id", StringPrintf("%p", this));
+ state->SetBoolean("visible_resources_ready",
+ pending_tree_->AreVisibleResourcesReady());
+ state->Set("tile_manager", tile_manager_->BasicStateAsValue().release());
+ return state.PassAs<base::Value>();
}
-scoped_ptr<base::Value> LayerTreeHostImpl::frameStateAsValue() const
-{
- scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
- state->SetString("lthi_id", StringPrintf("%p", this));
- state->Set("device_viewport_size", MathUtil::asValue(m_deviceViewportSize).release());
- if (m_tileManager)
- state->Set("tiles", m_tileManager->AllTilesAsValue().release());
- state->Set("active_tree", activeTree()->AsValue().release());
- return state.PassAs<base::Value>();
+scoped_ptr<base::Value> LayerTreeHostImpl::FrameStateAsValue() const {
+ scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
+ state->SetString("lthi_id", StringPrintf("%p", this));
+ state->Set("device_viewport_size",
+ MathUtil::asValue(device_viewport_size_).release());
+ if (tile_manager_)
+ state->Set("tiles", tile_manager_->AllTilesAsValue().release());
+ state->Set("active_tree", active_tree_->AsValue().release());
+ return state.PassAs<base::Value>();
}
// static
-LayerImpl* LayerTreeHostImpl::getNonCompositedContentLayerRecursive(LayerImpl* layer)
-{
- if (!layer)
- return NULL;
-
- if (layer->DrawsContent())
- return layer;
-
- for (LayerImpl::LayerList::const_iterator it = layer->children().begin();
- it != layer->children().end(); ++it) {
- LayerImpl* nccr = getNonCompositedContentLayerRecursive(*it);
- if (nccr)
- return nccr;
- }
-
+LayerImpl* LayerTreeHostImpl::GetNonCompositedContentLayerRecursive(
+ LayerImpl* layer) {
+ if (!layer)
return NULL;
+
+ if (layer->DrawsContent())
+ return layer;
+
+ for (LayerImpl::LayerList::const_iterator it = layer->children().begin();
+ it != layer->children().end(); ++it) {
+ LayerImpl* nccr = GetNonCompositedContentLayerRecursive(*it);
+ if (nccr)
+ return nccr;
+ }
+
+ return NULL;
}
-skia::RefPtr<SkPicture> LayerTreeHostImpl::capturePicture()
-{
- LayerTreeImpl* tree = pendingTree() ? pendingTree() : activeTree();
- LayerImpl* layer = getNonCompositedContentLayerRecursive(tree->RootLayer());
- return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>();
+skia::RefPtr<SkPicture> LayerTreeHostImpl::CapturePicture() {
+ LayerTreeImpl* tree =
+ pending_tree_ ? pending_tree_.get() : active_tree_.get();
+ LayerImpl* layer = GetNonCompositedContentLayerRecursive(tree->root_layer());
+ return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>();
}
-void LayerTreeHostImpl::setDebugState(const LayerTreeDebugState& debugState)
-{
- if (m_debugState.continuousPainting != debugState.continuousPainting)
- m_paintTimeCounter->ClearHistory();
+void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
+ if (debug_state_.continuousPainting != debug_state.continuousPainting)
+ paint_time_counter_->ClearHistory();
- m_debugState = debugState;
+ debug_state_ = debug_state;
- if (m_tileManager)
- m_tileManager->SetRecordRenderingStats(m_debugState.recordRenderingStats());
+ if (tile_manager_)
+ tile_manager_->SetRecordRenderingStats(debug_state_.recordRenderingStats());
}
-void LayerTreeHostImpl::savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber)
-{
- DCHECK(m_debugState.continuousPainting);
- m_paintTimeCounter->SavePaintTime(totalPaintTime, commitNumber);
+void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time,
+ int commit_number) {
+ DCHECK(debug_state_.continuousPainting);
+ paint_time_counter_->SavePaintTime(total_paint_time, commit_number);
}
} // namespace cc
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index 23bf1ad..6e90e93 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -43,334 +43,402 @@ struct RenderingStats;
// LayerTreeHost->Proxy callback interface.
class LayerTreeHostImplClient {
-public:
- virtual void didLoseOutputSurfaceOnImplThread() = 0;
- virtual void onSwapBuffersCompleteOnImplThread() = 0;
- virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) = 0;
- virtual void onCanDrawStateChanged(bool canDraw) = 0;
- virtual void onHasPendingTreeStateChanged(bool hasPendingTree) = 0;
- virtual void setNeedsRedrawOnImplThread() = 0;
- virtual void didUploadVisibleHighResolutionTileOnImplThread() = 0;
- virtual void setNeedsCommitOnImplThread() = 0;
- virtual void setNeedsManageTilesOnImplThread() = 0;
- virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) = 0;
- // Returns true if resources were deleted by this call.
- virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) = 0;
- virtual void reduceWastedContentsTextureMemoryOnImplThread() = 0;
- virtual void sendManagedMemoryStats() = 0;
- virtual bool isInsideDraw() = 0;
- virtual void renewTreePriority() = 0;
+ public:
+ virtual void DidLoseOutputSurfaceOnImplThread() = 0;
+ virtual void OnSwapBuffersCompleteOnImplThread() = 0;
+ virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
+ base::TimeDelta interval) = 0;
+ virtual void OnCanDrawStateChanged(bool can_draw) = 0;
+ virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0;
+ virtual void SetNeedsRedrawOnImplThread() = 0;
+ virtual void DidUploadVisibleHighResolutionTileOnImplThread() = 0;
+ virtual void SetNeedsCommitOnImplThread() = 0;
+ virtual void SetNeedsManageTilesOnImplThread() = 0;
+ virtual void PostAnimationEventsToMainThreadOnImplThread(
+ scoped_ptr<AnimationEventsVector> events,
+ base::Time wall_clock_time) = 0;
+ // Returns true if resources were deleted by this call.
+ virtual bool ReduceContentsTextureMemoryOnImplThread(
+ size_t limit_bytes,
+ int priority_cutoff) = 0;
+ virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0;
+ virtual void SendManagedMemoryStats() = 0;
+ virtual bool IsInsideDraw() = 0;
+ virtual void RenewTreePriority() = 0;
};
-// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state
+// LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
+// state.
class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
public RendererClient,
public TileManagerClient,
public OutputSurfaceClient,
public TopControlsManagerClient {
- typedef std::vector<LayerImpl*> LayerList;
-
-public:
- static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
- virtual ~LayerTreeHostImpl();
-
- // InputHandlerClient implementation
- virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandlerClient::ScrollInputType) OVERRIDE;
- virtual bool scrollBy(const gfx::Point&, const gfx::Vector2dF&) OVERRIDE;
- virtual void scrollEnd() OVERRIDE;
- virtual void pinchGestureBegin() OVERRIDE;
- virtual void pinchGestureUpdate(float, gfx::Point) OVERRIDE;
- virtual void pinchGestureEnd() OVERRIDE;
- virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration) OVERRIDE;
- virtual void scheduleAnimation() OVERRIDE;
- virtual bool haveTouchEventHandlersAt(const gfx::Point&) OVERRIDE;
-
- // TopControlsManagerClient implementation.
- virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
- virtual void setNeedsRedraw() OVERRIDE;
- virtual bool haveRootScrollLayer() const OVERRIDE;
- virtual float rootScrollLayerTotalScrollY() const OVERRIDE;
-
- struct CC_EXPORT FrameData : public RenderPassSink {
- FrameData();
- ~FrameData();
-
- std::vector<gfx::Rect> occludingScreenSpaceRects;
- std::vector<gfx::Rect> nonOccludingScreenSpaceRects;
- RenderPassList renderPasses;
- RenderPassIdHashMap renderPassesById;
- const LayerList* renderSurfaceLayerList;
- LayerList willDrawLayers;
- bool containsIncompleteTile;
-
- // RenderPassSink implementation.
- virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE;
- };
-
- // Virtual for testing.
- virtual void beginCommit();
- virtual void commitComplete();
- virtual void animate(base::TimeTicks monotonicTime, base::Time wallClockTime);
- virtual void setVisible(bool);
-
- void manageTiles();
-
- // Returns false if problems occured preparing the frame, and we should try
- // to avoid displaying the frame. If prepareToDraw is called,
- // didDrawAllLayers must also be called, regardless of whether drawLayers is
- // called between the two.
- virtual bool prepareToDraw(FrameData&);
- virtual void drawLayers(FrameData&);
- // Must be called if and only if prepareToDraw was called.
- void didDrawAllLayers(const FrameData&);
-
- // RendererClient implementation
- virtual gfx::Size DeviceViewportSize() const OVERRIDE;
- virtual const LayerTreeSettings& Settings() const OVERRIDE;
- virtual void DidLoseOutputSurface() OVERRIDE;
- virtual void OnSwapBuffersComplete() OVERRIDE;
- virtual void SetFullRootLayerDamage() OVERRIDE;
- virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
- virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
- virtual bool HasImplThread() const OVERRIDE;
- virtual bool ShouldClearRootRenderPass() const OVERRIDE;
- virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
-
- // TileManagerClient implementation.
- virtual void ScheduleManageTiles() OVERRIDE;
- virtual void DidUploadVisibleHighResolutionTile() OVERRIDE;
-
- // OutputSurfaceClient implementation.
- virtual void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
- virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck&) OVERRIDE;
-
- // Called from LayerTreeImpl.
- void OnCanDrawStateChangedForTree(LayerTreeImpl*);
-
- // Implementation
- bool canDraw();
- OutputSurface* outputSurface() const;
-
- std::string layerTreeAsText() const;
- std::string layerTreeAsJson() const;
-
- void finishAllRendering();
- int sourceAnimationFrameNumber() const;
-
- virtual bool initializeRenderer(scoped_ptr<OutputSurface>);
- bool isContextLost();
- TileManager* tileManager() { return m_tileManager.get(); }
- Renderer* renderer() { return m_renderer.get(); }
- const RendererCapabilities& rendererCapabilities() const;
-
- bool swapBuffers();
-
- void readback(void* pixels, gfx::Rect rect_in_device_viewport);
-
- LayerTreeImpl* activeTree() { return m_activeTree.get(); }
- const LayerTreeImpl* activeTree() const { return m_activeTree.get(); }
- LayerTreeImpl* pendingTree() { return m_pendingTree.get(); }
- const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); }
- const LayerTreeImpl* recycleTree() const { return m_recycleTree.get(); }
- void createPendingTree();
- void checkForCompletedTileUploads();
- virtual bool activatePendingTreeIfNeeded();
-
- // Shortcuts to layers on the active tree.
- LayerImpl* rootLayer() const;
- LayerImpl* rootScrollLayer() const;
- LayerImpl* currentlyScrollingLayer() const;
+ typedef std::vector<LayerImpl*> LayerList;
+
+ public:
+ static scoped_ptr<LayerTreeHostImpl> Create(
+ const LayerTreeSettings& settings,
+ LayerTreeHostImplClient* client,
+ Proxy* proxy);
+ virtual ~LayerTreeHostImpl();
+
+ // InputHandlerClient implementation
+ virtual InputHandlerClient::ScrollStatus ScrollBegin(
+ gfx::Point viewport_point,
+ InputHandlerClient::ScrollInputType type) OVERRIDE;
+ virtual bool ScrollBy(gfx::Point viewport_point,
+ gfx::Vector2dF scroll_delta) OVERRIDE;
+ virtual void ScrollEnd() OVERRIDE;
+ virtual void PinchGestureBegin() OVERRIDE;
+ virtual void PinchGestureUpdate(float magnify_delta,
+ gfx::Point anchor) OVERRIDE;
+ virtual void PinchGestureEnd() OVERRIDE;
+ virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
+ bool anchor_point,
+ float page_scale,
+ base::TimeTicks start_time,
+ base::TimeDelta duration) OVERRIDE;
+ virtual void ScheduleAnimation() OVERRIDE;
+ virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE;
+
+ // TopControlsManagerClient implementation.
+ virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
+ virtual void setNeedsRedraw() OVERRIDE;
+ virtual bool haveRootScrollLayer() const OVERRIDE;
+ virtual float rootScrollLayerTotalScrollY() const OVERRIDE;
+
+ struct CC_EXPORT FrameData : public RenderPassSink {
+ FrameData();
+ ~FrameData();
+
+ std::vector<gfx::Rect> occluding_screen_space_rects;
+ std::vector<gfx::Rect> non_occluding_screen_space_rects;
+ RenderPassList render_passes;
+ RenderPassIdHashMap render_passes_by_id;
+ const LayerList* render_surface_layer_list;
+ LayerList will_draw_layers;
+ bool contains_incomplete_tile;
+
+ // RenderPassSink implementation.
+ virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE;
+ };
+
+ virtual void BeginCommit();
+ virtual void CommitComplete();
+ virtual void Animate(base::TimeTicks monotonic_time,
+ base::Time wall_clock_time);
+
+ void ManageTiles();
+
+ // Returns false if problems occured preparing the frame, and we should try
+ // to avoid displaying the frame. If prepareToDraw is called, DidDrawAllLayers
+ // must also be called, regardless of whether DrawLayers is called between the
+ // two.
+ virtual bool PrepareToDraw(FrameData* frame);
+ virtual void DrawLayers(FrameData* frame);
+ // Must be called if and only if PrepareToDraw was called.
+ void DidDrawAllLayers(const FrameData& frame);
+
+ const LayerTreeSettings& settings() const { return settings_; }
+
+ // RendererClient implementation
+ private:
+ virtual gfx::Size DeviceViewportSize() const OVERRIDE;
+ virtual const LayerTreeSettings& Settings() const OVERRIDE;
+ public:
+ virtual void DidLoseOutputSurface() OVERRIDE;
+ virtual void OnSwapBuffersComplete() OVERRIDE;
+ virtual void SetFullRootLayerDamage() OVERRIDE;
+ virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
+ OVERRIDE;
+ virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
+ OVERRIDE;
+ virtual bool HasImplThread() const OVERRIDE;
+ virtual bool ShouldClearRootRenderPass() const OVERRIDE;
+ virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
+
+ // TileManagerClient implementation.
+ virtual void ScheduleManageTiles() OVERRIDE;
+ virtual void DidUploadVisibleHighResolutionTile() OVERRIDE;
+
+ // OutputSurfaceClient implementation.
+ virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
+ base::TimeDelta interval) OVERRIDE;
+ virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
+ OVERRIDE;
+
+ // Called from LayerTreeImpl.
+ void OnCanDrawStateChangedForTree();
+
+ // Implementation
+ bool CanDraw();
+ OutputSurface* output_surface() const { return output_surface_.get(); }
+
+ std::string LayerTreeAsText() const;
+ std::string LayerTreeAsJson() const;
+
+ void FinishAllRendering();
+ int SourceAnimationFrameNumber() const;
+
+ virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
+ bool IsContextLost();
+ TileManager* tile_manager() { return tile_manager_.get(); }
+ Renderer* renderer() { return renderer_.get(); }
+ const RendererCapabilities& GetRendererCapabilities() const;
+
+ bool SwapBuffers();
+
+ void Readback(void* pixels, gfx::Rect rect_in_device_viewport);
+
+ LayerTreeImpl* active_tree() { return active_tree_.get(); }
+ const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
+ LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
+ const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
+ const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
+ void CreatePendingTree();
+ void CheckForCompletedTileUploads();
+ virtual bool ActivatePendingTreeIfNeeded();
+
+ // Shortcuts to layers on the active tree.
+ LayerImpl* RootLayer() const;
+ LayerImpl* RootScrollLayer() const;
+ LayerImpl* CurrentlyScrollingLayer() const;
+
+ virtual void SetVisible(bool visible);
+ bool visible() const { return visible_; }
+
+ size_t memory_allocation_limit_bytes() const {
+ return managed_memory_policy_.bytesLimitWhenVisible;
+ }
+
+ void SetViewportSize(gfx::Size layout_viewport_size,
+ gfx::Size device_viewport_size);
+ gfx::Size layout_viewport_size() const { return layout_viewport_size_; }
+ gfx::Size device_viewport_size() const { return device_viewport_size_; }
+
+ void SetDeviceScaleFactor(float device_scale_factor);
+ float device_scale_factor() const { return device_scale_factor_; }
+
+ scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
+
+ void StartPageScaleAnimation(gfx::Vector2d target_offset,
+ bool use_anchor,
+ float scale,
+ base::TimeDelta duration);
+
+ bool needs_animate_layers() const {
+ return !animation_registrar_->active_animation_controllers().empty();
+ }
+
+ void CollectRenderingStats(RenderingStats* stats) const;
+
+ void SendManagedMemoryStats(
+ size_t memory_visible_bytes,
+ size_t memory_visible_and_nearby_bytes,
+ size_t memoryUseBytes);
+
+ FrameRateCounter* fps_counter() {
+ return fps_counter_.get();
+ }
+ PaintTimeCounter* paint_time_counter() {
+ return paint_time_counter_.get();
+ }
+ MemoryHistory* memory_history() {
+ return memory_history_.get();
+ }
+ DebugRectHistory* debug_rect_history() {
+ return debug_rect_history_.get();
+ }
+ ResourceProvider* resource_provider() {
+ return resource_provider_.get();
+ }
+ TopControlsManager* top_controls_manager() {
+ return top_controls_manager_.get();
+ }
+
+ Proxy* proxy() const { return proxy_; }
+
+ AnimationRegistrar* animation_registrar() const {
+ return animation_registrar_.get();
+ }
+
+ void SetDebugState(const LayerTreeDebugState& debug_state);
+ const LayerTreeDebugState& debug_state() const { return debug_state_; }
+
+ void SavePaintTime(const base::TimeDelta& total_paint_time,
+ int commit_number);
+
+ class CC_EXPORT CullRenderPassesWithCachedTextures {
+ public:
+ bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
+ const FrameData& frame) const;
+
+ // Iterates from the root first, in order to remove the surfaces closest
+ // to the root with cached textures, and all surfaces that draw into
+ // them.
+ size_t RenderPassListBegin(const RenderPassList& list) const {
+ return list.size() - 1;
+ }
+ size_t RenderPassListEnd(const RenderPassList& list) const { return 0 - 1; }
+ size_t RenderPassListNext(size_t it) const { return it - 1; }
+
+ CullRenderPassesWithCachedTextures(Renderer& renderer)
+ : renderer_(renderer) {}
+ private:
+ Renderer& renderer_;
+ };
+
+ class CC_EXPORT CullRenderPassesWithNoQuads {
+ public:
+ bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
+ const FrameData& frame) const;
+
+ // Iterates in draw order, so that when a surface is removed, and its
+ // target becomes empty, then its target can be removed also.
+ size_t RenderPassListBegin(const RenderPassList& list) const { return 0; }
+ size_t RenderPassListEnd(const RenderPassList& list) const {
+ return list.size();
+ }
+ size_t RenderPassListNext(size_t it) const { return it + 1; }
+ };
+
+ template <typename RenderPassCuller>
+ static void RemoveRenderPasses(RenderPassCuller culler, FrameData* frame);
+
+ skia::RefPtr<SkPicture> CapturePicture();
+
+ bool pinch_gesture_active() const { return pinch_gesture_active_; }
+
+ void SetTreePriority(TreePriority priority);
+
+ void BeginNextFrame();
+ base::TimeTicks CurrentFrameTime();
+
+ scoped_ptr<base::Value> AsValue() const;
+ scoped_ptr<base::Value> ActivationStateAsValue() const;
+ scoped_ptr<base::Value> FrameStateAsValue() const;
+
+ bool page_scale_animation_active() const { return !!page_scale_animation_; }
+
+ protected:
+ LayerTreeHostImpl(const LayerTreeSettings& settings,
+ LayerTreeHostImplClient* client,
+ Proxy* proxy);
+ void ActivatePendingTree();
+
+ // Virtual for testing.
+ virtual void AnimateLayers(base::TimeTicks monotonic_time,
+ base::Time wall_clock_time);
+ virtual void UpdateAnimationState();
+
+ // Virtual for testing.
+ virtual base::TimeDelta LowFrequencyAnimationInterval() const;
+
+ const AnimationRegistrar::AnimationControllerMap&
+ active_animation_controllers() const {
+ return animation_registrar_->active_animation_controllers();
+ }
+
+ LayerTreeHostImplClient* client_;
+ Proxy* proxy_;
+
+ private:
+ void AnimatePageScale(base::TimeTicks monotonic_time);
+ void AnimateScrollbars(base::TimeTicks monotonic_time);
+
+ gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
+ LayerImpl* layerImpl,
+ float scaleFromViewportToScreenSpace,
+ gfx::PointF viewportPoint,
+ gfx::Vector2dF viewportDelta);
- bool visible() const { return m_visible; }
+ void UpdateMaxScrollOffset();
+ void TrackDamageForAllSurfaces(LayerImpl* root_draw_layer,
+ const LayerList& render_surface_layer_list);
- size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
+ // Returns false if the frame should not be displayed. This function should
+ // only be called from prepareToDraw, as didDrawAllLayers must be called
+ // if this helper function is called.
+ bool CalculateRenderPasses(FrameData* frame);
+ void SetBackgroundTickingEnabled(bool enabled);
- void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
- const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
+ void SendDidLoseOutputSurfaceRecursive(LayerImpl* current);
+ void ClearRenderSurfaces();
+ bool EnsureRenderSurfaceLayerList();
+ void ClearCurrentlyScrollingLayer();
- float deviceScaleFactor() const { return m_deviceScaleFactor; }
- void setDeviceScaleFactor(float);
+ void AnimateScrollbarsRecursive(LayerImpl* layer,
+ base::TimeTicks time);
- scoped_ptr<ScrollAndScaleSet> processScrollDeltas();
+ void DumpRenderSurfaces(std::string* str,
+ int indent,
+ const LayerImpl* layer) const;
- void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration);
+ static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer);
- bool needsAnimateLayers() const { return !m_animationRegistrar->active_animation_controllers().empty(); }
+ scoped_ptr<OutputSurface> output_surface_;
+ scoped_ptr<ResourceProvider> resource_provider_;
+ scoped_ptr<Renderer> renderer_;
+ scoped_ptr<TileManager> tile_manager_;
- void renderingStats(RenderingStats*) const;
+ // Tree currently being drawn.
+ scoped_ptr<LayerTreeImpl> active_tree_;
- void sendManagedMemoryStats(
- size_t memoryVisibleBytes,
- size_t memoryVisibleAndNearbyBytes,
- size_t memoryUseBytes);
+ // In impl-side painting mode, tree with possibly incomplete rasterized
+ // content. May be promoted to active by ActivatePendingTreeIfNeeded().
+ scoped_ptr<LayerTreeImpl> pending_tree_;
- FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
- PaintTimeCounter* paintTimeCounter() const { return m_paintTimeCounter.get(); }
- MemoryHistory* memoryHistory() const { return m_memoryHistory.get(); }
- DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
- ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
- TopControlsManager* topControlsManager() const { return m_topControlsManager.get(); }
+ // In impl-side painting mode, inert tree with layers that can be recycled
+ // by the next sync from the main thread.
+ scoped_ptr<LayerTreeImpl> recycle_tree_;
- Proxy* proxy() const { return m_proxy; }
+ bool did_lock_scrolling_layer_;
+ bool should_bubble_scrolls_;
+ bool wheel_scrolling_;
+ LayerTreeSettings settings_;
+ LayerTreeDebugState debug_state_;
+ gfx::Size layout_viewport_size_;
+ gfx::Size device_viewport_size_;
+ float device_scale_factor_;
+ bool visible_;
+ ManagedMemoryPolicy managed_memory_policy_;
- AnimationRegistrar* animationRegistrar() const { return m_animationRegistrar.get(); }
+ bool pinch_gesture_active_;
+ gfx::Point previous_pinch_anchor_;
- void setDebugState(const LayerTreeDebugState& debugState);
- const LayerTreeDebugState& debugState() const { return m_debugState; }
+ // This is set by AnimateLayers() and used by UpdateAnimationState()
+ // when sending animation events to the main thread.
+ base::Time last_animation_time_;
- void savePaintTime(const base::TimeDelta& totalPaintTime, int commitNumber);
+ scoped_ptr<TopControlsManager> top_controls_manager_;
- class CC_EXPORT CullRenderPassesWithCachedTextures {
- public:
- bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
+ scoped_ptr<PageScaleAnimation> page_scale_animation_;
- // Iterates from the root first, in order to remove the surfaces closest
- // to the root with cached textures, and all surfaces that draw into
- // them.
- size_t renderPassListBegin(const RenderPassList& list) const { return list.size() - 1; }
- size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; }
- size_t renderPassListNext(size_t it) const { return it - 1; }
+ // This is used for ticking animations slowly when hidden.
+ scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_;
- CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(renderer) { }
- private:
- Renderer& m_renderer;
- };
+ scoped_ptr<FrameRateCounter> fps_counter_;
+ scoped_ptr<PaintTimeCounter> paint_time_counter_;
+ scoped_ptr<MemoryHistory> memory_history_;
+ scoped_ptr<DebugRectHistory> debug_rect_history_;
- class CC_EXPORT CullRenderPassesWithNoQuads {
- public:
- bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
+ int64 num_impl_thread_scrolls_;
+ int64 num_main_thread_scrolls_;
- // Iterates in draw order, so that when a surface is removed, and its
- // target becomes empty, then its target can be removed also.
- size_t renderPassListBegin(const RenderPassList&) const { return 0; }
- size_t renderPassListEnd(const RenderPassList& list) const { return list.size(); }
- size_t renderPassListNext(size_t it) const { return it + 1; }
- };
+ int64 cumulative_num_layers_drawn_;
- template<typename RenderPassCuller>
- static void removeRenderPasses(RenderPassCuller, FrameData&);
+ int64 cumulative_num_missing_tiles_;
- skia::RefPtr<SkPicture> capturePicture();
+ size_t last_sent_memory_visible_bytes_;
+ size_t last_sent_memory_visible_and_nearby_bytes_;
+ size_t last_sent_memory_use_bytes_;
- bool pinchGestureActive() const { return m_pinchGestureActive; }
+ base::TimeTicks current_frame_time_;
- void setTreePriority(TreePriority priority);
+ scoped_ptr<AnimationRegistrar> animation_registrar_;
- void beginNextFrame();
- base::TimeTicks currentFrameTime();
-
- scoped_ptr<base::Value> asValue() const;
- scoped_ptr<base::Value> activationStateAsValue() const;
- scoped_ptr<base::Value> frameStateAsValue() const;
-
- bool pageScaleAnimationActive() const { return !!m_pageScaleAnimation; }
-
-protected:
- LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
- void activatePendingTree();
-
- // Virtual for testing.
- virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime);
- virtual void updateAnimationState();
-
- // Virtual for testing.
- virtual base::TimeDelta lowFrequencyAnimationInterval() const;
-
- const AnimationRegistrar::AnimationControllerMap& activeAnimationControllers() const { return m_animationRegistrar->active_animation_controllers(); }
-
- LayerTreeHostImplClient* m_client;
- Proxy* m_proxy;
-
-private:
- void animatePageScale(base::TimeTicks monotonicTime);
- void animateScrollbars(base::TimeTicks monotonicTime);
-
- void setPageScaleDelta(float);
- gfx::Vector2dF scrollLayerWithViewportSpaceDelta(LayerImpl* layerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx::Vector2dF viewportDelta);
-
- void updateMaxScrollOffset();
- void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList);
-
- // Returns false if the frame should not be displayed. This function should
- // only be called from prepareToDraw, as didDrawAllLayers must be called
- // if this helper function is called.
- bool calculateRenderPasses(FrameData&);
- void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base::Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
- void setBackgroundTickingEnabled(bool);
-
- void sendDidLoseOutputSurfaceRecursive(LayerImpl*);
- void clearRenderSurfaces();
- bool ensureRenderSurfaceLayerList();
- void clearCurrentlyScrollingLayer();
-
- void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime);
-
- void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const;
-
- static LayerImpl* getNonCompositedContentLayerRecursive(LayerImpl* layer);
-
- scoped_ptr<OutputSurface> m_outputSurface;
- scoped_ptr<ResourceProvider> m_resourceProvider;
- scoped_ptr<Renderer> m_renderer;
- scoped_ptr<TileManager> m_tileManager;
-
- // Tree currently being drawn.
- scoped_ptr<LayerTreeImpl> m_activeTree;
-
- // In impl-side painting mode, tree with possibly incomplete rasterized
- // content. May be promoted to active by activatePendingTreeIfNeeded().
- scoped_ptr<LayerTreeImpl> m_pendingTree;
-
- // In impl-side painting mode, inert tree with layers that can be recycled
- // by the next sync from the main thread.
- scoped_ptr<LayerTreeImpl> m_recycleTree;
-
- bool m_didLockScrollingLayer;
- bool m_shouldBubbleScrolls;
- bool m_wheelScrolling;
- LayerTreeSettings m_settings;
- LayerTreeDebugState m_debugState;
- gfx::Size m_layoutViewportSize;
- gfx::Size m_deviceViewportSize;
- float m_deviceScaleFactor;
- bool m_visible;
- ManagedMemoryPolicy m_managedMemoryPolicy;
-
- bool m_pinchGestureActive;
- gfx::Point m_previousPinchAnchor;
-
- // This is set by animateLayers() and used by updateAnimationState()
- // when sending animation events to the main thread.
- base::Time m_lastAnimationTime;
-
- scoped_ptr<TopControlsManager> m_topControlsManager;
-
- scoped_ptr<PageScaleAnimation> m_pageScaleAnimation;
-
- // This is used for ticking animations slowly when hidden.
- scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
-
- scoped_ptr<FrameRateCounter> m_fpsCounter;
- scoped_ptr<PaintTimeCounter> m_paintTimeCounter;
- scoped_ptr<MemoryHistory> m_memoryHistory;
- scoped_ptr<DebugRectHistory> m_debugRectHistory;
-
- int64 m_numImplThreadScrolls;
- int64 m_numMainThreadScrolls;
-
- int64 m_cumulativeNumLayersDrawn;
-
- int64 m_cumulativeNumMissingTiles;
-
- size_t m_lastSentMemoryVisibleBytes;
- size_t m_lastSentMemoryVisibleAndNearbyBytes;
- size_t m_lastSentMemoryUseBytes;
-
- base::TimeTicks m_currentFrameTime;
-
- scoped_ptr<AnimationRegistrar> m_animationRegistrar;
-
- DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
+ DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
};
} // namespace cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index d9dc92d..1d3bcbe 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -78,30 +78,30 @@ public:
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
- m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
- m_hostImpl->initializeRenderer(createOutputSurface());
- m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
+ m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
+ m_hostImpl->InitializeRenderer(createOutputSurface());
+ m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
}
virtual void TearDown()
{
}
- virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { }
- virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
- virtual void onVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVERRIDE { }
- virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; }
- virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_hasPendingTree = hasPendingTree; }
- virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
- virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { m_didUploadVisibleHighResolutionTile = true; }
- virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
- virtual void setNeedsManageTilesOnImplThread() OVERRIDE { }
- virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) OVERRIDE { }
- virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; }
- virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE { }
- virtual void sendManagedMemoryStats() OVERRIDE { }
- virtual bool isInsideDraw() OVERRIDE { return false; }
- virtual void renewTreePriority() OVERRIDE { }
+ virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE { }
+ virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE { }
+ virtual void OnVSyncParametersChanged(base::TimeTicks, base::TimeDelta) OVERRIDE { }
+ virtual void OnCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; }
+ virtual void OnHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_hasPendingTree = hasPendingTree; }
+ virtual void SetNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
+ virtual void DidUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { m_didUploadVisibleHighResolutionTile = true; }
+ virtual void SetNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
+ virtual void SetNeedsManageTilesOnImplThread() OVERRIDE { }
+ virtual void PostAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) OVERRIDE { }
+ virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE { return m_reduceMemoryResult; }
+ virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE { }
+ virtual void SendManagedMemoryStats() OVERRIDE { }
+ virtual bool IsInsideDraw() OVERRIDE { return false; }
+ virtual void RenewTreePriority() OVERRIDE { }
void setReduceMemoryResult(bool reduceMemoryResult) { m_reduceMemoryResult = reduceMemoryResult; }
@@ -111,10 +111,10 @@ public:
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.partialSwapEnabled = partialSwap;
- m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
- m_hostImpl->initializeRenderer(outputSurface.Pass());
- m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
+ m_hostImpl->InitializeRenderer(outputSurface.Pass());
+ m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
}
void setupRootLayerImpl(scoped_ptr<LayerImpl> root)
@@ -125,7 +125,7 @@ public:
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
}
static void expectClearedScrollDeltasRecursive(LayerImpl* layer)
@@ -164,7 +164,7 @@ public:
void setupScrollAndContentsLayers(const gfx::Size& contentSize)
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetScrollable(true);
root->SetScrollOffset(gfx::Vector2d(0, 0));
root->SetMaxScrollOffset(gfx::Vector2d(contentSize.width(), contentSize.height()));
@@ -173,20 +173,20 @@ public:
root->SetPosition(gfx::PointF(0, 0));
root->SetAnchorPoint(gfx::PointF(0, 0));
- scoped_ptr<LayerImpl> contents = LayerImpl::Create(m_hostImpl->activeTree(), 2);
+ scoped_ptr<LayerImpl> contents = LayerImpl::Create(m_hostImpl->active_tree(), 2);
contents->SetDrawsContent(true);
contents->SetBounds(contentSize);
contents->SetContentBounds(contentSize);
contents->SetPosition(gfx::PointF(0, 0));
contents->SetAnchorPoint(gfx::PointF(0, 0));
root->AddChild(contents.Pass());
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
}
scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size)
{
- scoped_ptr<LayerImpl> layer = LayerImpl::Create(m_hostImpl->activeTree(), id);
+ scoped_ptr<LayerImpl> layer = LayerImpl::Create(m_hostImpl->active_tree(), id);
layer->SetScrollable(true);
layer->SetDrawsContent(true);
layer->SetBounds(size);
@@ -197,11 +197,11 @@ public:
void initializeRendererAndDrawFrame()
{
- m_hostImpl->initializeRenderer(createOutputSurface());
+ m_hostImpl->InitializeRenderer(createOutputSurface());
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
void pinchZoomPanViewportForcesCommitRedraw(const float deviceScaleFactor);
@@ -214,8 +214,8 @@ protected:
void drawOneFrame() {
LayerTreeHostImpl::FrameData frameData;
- m_hostImpl->prepareToDraw(frameData);
- m_hostImpl->didDrawAllLayers(frameData);
+ m_hostImpl->PrepareToDraw(&frameData);
+ m_hostImpl->DidDrawAllLayers(frameData);
}
FakeProxy m_proxy;
@@ -241,33 +241,33 @@ TEST_F(LayerTreeHostImplTest, notifyIfCanDrawChanged)
// Note: It is not possible to disable the renderer once it has been set,
// so we do not need to test that disabling the renderer notifies us
// that canDraw changed.
- EXPECT_FALSE(m_hostImpl->canDraw());
+ EXPECT_FALSE(m_hostImpl->CanDraw());
m_onCanDrawStateChangedCalled = false;
setupScrollAndContentsLayers(gfx::Size(100, 100));
- EXPECT_TRUE(m_hostImpl->canDraw());
+ EXPECT_TRUE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
// Toggle the root layer to make sure it toggles canDraw
- m_hostImpl->activeTree()->SetRootLayer(scoped_ptr<LayerImpl>());
- EXPECT_FALSE(m_hostImpl->canDraw());
+ m_hostImpl->active_tree()->SetRootLayer(scoped_ptr<LayerImpl>());
+ EXPECT_FALSE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
setupScrollAndContentsLayers(gfx::Size(100, 100));
- EXPECT_TRUE(m_hostImpl->canDraw());
+ EXPECT_TRUE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
// Toggle the device viewport size to make sure it toggles canDraw.
- m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(0, 0));
- EXPECT_FALSE(m_hostImpl->canDraw());
+ m_hostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(0, 0));
+ EXPECT_FALSE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
- m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
- EXPECT_TRUE(m_hostImpl->canDraw());
+ m_hostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ EXPECT_TRUE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
@@ -275,55 +275,55 @@ TEST_F(LayerTreeHostImplTest, notifyIfCanDrawChanged)
// and make sure that it does not change canDraw.
setReduceMemoryResult(false);
m_hostImpl->SetManagedMemoryPolicy(ManagedMemoryPolicy(
- m_hostImpl->memoryAllocationLimitBytes() - 1));
- EXPECT_TRUE(m_hostImpl->canDraw());
+ m_hostImpl->memory_allocation_limit_bytes() - 1));
+ EXPECT_TRUE(m_hostImpl->CanDraw());
EXPECT_FALSE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
// Toggle contents textures purged to make sure it toggles canDraw.
setReduceMemoryResult(true);
m_hostImpl->SetManagedMemoryPolicy(ManagedMemoryPolicy(
- m_hostImpl->memoryAllocationLimitBytes() - 1));
- EXPECT_FALSE(m_hostImpl->canDraw());
+ m_hostImpl->memory_allocation_limit_bytes() - 1));
+ EXPECT_FALSE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
- m_hostImpl->activeTree()->ResetContentsTexturesPurged();
- EXPECT_TRUE(m_hostImpl->canDraw());
+ m_hostImpl->active_tree()->ResetContentsTexturesPurged();
+ EXPECT_TRUE(m_hostImpl->CanDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
}
TEST_F(LayerTreeHostImplTest, scrollDeltaNoLayers)
{
- ASSERT_FALSE(m_hostImpl->rootLayer());
+ ASSERT_FALSE(m_hostImpl->active_tree()->root_layer());
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
ASSERT_EQ(scrollInfo->scrolls.size(), 0u);
}
TEST_F(LayerTreeHostImplTest, scrollDeltaTreeButNoChanges)
{
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
- root->AddChild(LayerImpl::Create(m_hostImpl->activeTree(), 2));
- root->AddChild(LayerImpl::Create(m_hostImpl->activeTree(), 3));
- root->children()[1]->AddChild(LayerImpl::Create(m_hostImpl->activeTree(), 4));
- root->children()[1]->AddChild(LayerImpl::Create(m_hostImpl->activeTree(), 5));
- root->children()[1]->children()[0]->AddChild(LayerImpl::Create(m_hostImpl->activeTree(), 6));
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
+ root->AddChild(LayerImpl::Create(m_hostImpl->active_tree(), 2));
+ root->AddChild(LayerImpl::Create(m_hostImpl->active_tree(), 3));
+ root->children()[1]->AddChild(LayerImpl::Create(m_hostImpl->active_tree(), 4));
+ root->children()[1]->AddChild(LayerImpl::Create(m_hostImpl->active_tree(), 5));
+ root->children()[1]->children()[0]->AddChild(LayerImpl::Create(m_hostImpl->active_tree(), 6));
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
}
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
expectClearedScrollDeltasRecursive(root);
scoped_ptr<ScrollAndScaleSet> scrollInfo;
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
ASSERT_EQ(scrollInfo->scrolls.size(), 0u);
expectClearedScrollDeltasRecursive(root);
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
ASSERT_EQ(scrollInfo->scrolls.size(), 0u);
expectClearedScrollDeltasRecursive(root);
}
@@ -333,43 +333,43 @@ TEST_F(LayerTreeHostImplTest, scrollDeltaRepeatedScrolls)
gfx::Vector2d scrollOffset(20, 30);
gfx::Vector2d scrollDelta(11, -15);
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetScrollOffset(scrollOffset);
root->SetScrollable(true);
root->SetMaxScrollOffset(gfx::Vector2d(100, 100));
root->ScrollBy(scrollDelta);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
}
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
scoped_ptr<ScrollAndScaleSet> scrollInfo;
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
ASSERT_EQ(scrollInfo->scrolls.size(), 1u);
EXPECT_VECTOR_EQ(root->sent_scroll_delta(), scrollDelta);
expectContains(*scrollInfo, root->id(), scrollDelta);
gfx::Vector2d scrollDelta2(-5, 27);
root->ScrollBy(scrollDelta2);
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
ASSERT_EQ(scrollInfo->scrolls.size(), 1u);
EXPECT_VECTOR_EQ(root->sent_scroll_delta(), scrollDelta + scrollDelta2);
expectContains(*scrollInfo, root->id(), scrollDelta + scrollDelta2);
root->ScrollBy(gfx::Vector2d());
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(root->sent_scroll_delta(), scrollDelta + scrollDelta2);
}
TEST_F(LayerTreeHostImplTest, scrollRootCallsCommitAndRedraw)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ m_hostImpl->ScrollEnd();
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
}
@@ -377,22 +377,22 @@ TEST_F(LayerTreeHostImplTest, scrollRootCallsCommitAndRedraw)
TEST_F(LayerTreeHostImplTest, scrollWithoutRootLayer)
{
// We should not crash when trying to scroll an empty layer tree.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
}
TEST_F(LayerTreeHostImplTest, scrollWithoutRenderer)
{
LayerTreeSettings settings;
- m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
// Initialization will fail here.
- m_hostImpl->initializeRenderer(FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new TestWebGraphicsContext3DMakeCurrentFails)).PassAs<OutputSurface>());
- m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
+ m_hostImpl->InitializeRenderer(FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new TestWebGraphicsContext3DMakeCurrentFails)).PassAs<OutputSurface>());
+ m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
setupScrollAndContentsLayers(gfx::Size(100, 100));
// We should not crash when trying to scroll after the renderer initialization fails.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
}
TEST_F(LayerTreeHostImplTest, replaceTreeWhileScrolling)
@@ -400,96 +400,96 @@ TEST_F(LayerTreeHostImplTest, replaceTreeWhileScrolling)
const int scrollLayerId = 1;
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
// We should not crash if the tree is replaced while we are scrolling.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->activeTree()->DetachLayerTree();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->active_tree()->DetachLayerTree();
setupScrollAndContentsLayers(gfx::Size(100, 100));
// We should still be scrolling, because the scrolled layer also exists in the new tree.
gfx::Vector2d scrollDelta(0, 10);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
expectContains(*scrollInfo, scrollLayerId, scrollDelta);
}
TEST_F(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
// We should be able to scroll even if the root layer loses its render surface after the most
// recent render.
- m_hostImpl->rootLayer()->ClearRenderSurface();
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->active_tree()->root_layer()->ClearRenderSurface();
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
}
TEST_F(LayerTreeHostImplTest, wheelEventHandlers)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
root->SetHaveWheelEventHandlers(true);
// With registered event handlers, wheel scrolls have to go to the main thread.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
// But gesture scrolls can still be handled.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
}
TEST_F(LayerTreeHostImplTest, shouldScrollOnMainThread)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
root->SetShouldScrollOnMainThread(true);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread);
}
TEST_F(LayerTreeHostImplTest, nonFastScrollableRegionBasic)
{
setupScrollAndContentsLayers(gfx::Size(200, 200));
- m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ m_hostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
root->SetContentsScale(2, 2);
root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
initializeRendererAndDrawFrame();
// All scroll types inside the non-fast scrollable region should fail.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(25, 25), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(25, 25), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(25, 25), InputHandlerClient::Gesture), InputHandlerClient::ScrollOnMainThread);
// All scroll types outside this region should succeed.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- m_hostImpl->scrollEnd();
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(75, 75), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(75, 75), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ m_hostImpl->ScrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(75, 75), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ m_hostImpl->ScrollEnd();
}
TEST_F(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
{
setupScrollAndContentsLayers(gfx::Size(200, 200));
- m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ m_hostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
root->SetContentsScale(2, 2);
root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
root->SetPosition(gfx::PointF(-25, 0));
@@ -497,69 +497,69 @@ TEST_F(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
initializeRendererAndDrawFrame();
// This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(40, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 1));
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(40, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1));
+ m_hostImpl->ScrollEnd();
// This point is still inside the non-fast region.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(10, 10), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
}
TEST_F(LayerTreeHostImplTest, scrollByReturnsCorrectValue)
{
setupScrollAndContentsLayers(gfx::Size(200, 200));
- m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ m_hostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
initializeRendererAndDrawFrame();
EXPECT_EQ(InputHandlerClient::ScrollStarted,
- m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
+ m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
// Trying to scroll to the left/top will not succeed.
- EXPECT_FALSE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
- EXPECT_FALSE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, -10)));
- EXPECT_FALSE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, -10)));
+ EXPECT_FALSE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
+ EXPECT_FALSE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10)));
+ EXPECT_FALSE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10)));
// Scrolling to the right/bottom will succeed.
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 0)));
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10)));
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, 10)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(10, 10)));
// Scrolling to left/top will now succeed.
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, -10)));
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, -10)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10)));
// Scrolling diagonally against an edge will succeed.
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(10, -10)));
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(-10, 10)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(10, -10)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 10)));
// Trying to scroll more than the available space will also succeed.
- EXPECT_TRUE(m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(5000, 5000)));
+ EXPECT_TRUE(m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(5000, 5000)));
}
TEST_F(LayerTreeHostImplTest, clearRootRenderSurfaceAndHitTestTouchHandlerRegion)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
// We should be able to hit test for touch event handlers even if the root layer loses
// its render surface after the most recent render.
- m_hostImpl->rootLayer()->ClearRenderSurface();
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->active_tree()->root_layer()->ClearRenderSurface();
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
- EXPECT_EQ(m_hostImpl->haveTouchEventHandlersAt(gfx::Point(0, 0)), false);
+ EXPECT_EQ(m_hostImpl->HaveTouchEventHandlersAt(gfx::Point(0, 0)), false);
}
TEST_F(LayerTreeHostImplTest, implPinchZoom)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
+ LayerImpl* scrollLayer = m_hostImpl->RootScrollLayer();
DCHECK(scrollLayer);
const float minPageScale = 1, maxPageScale = 4;
@@ -567,54 +567,54 @@ TEST_F(LayerTreeHostImplTest, implPinchZoom)
// The impl-based pinch zoom should adjust the max scroll position.
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
- m_hostImpl->activeTree()->SetPageScaleDelta(1);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleDelta(1);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
float pageScaleDelta = 2;
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(50, 50));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(50, 50));
+ m_hostImpl->PinchGestureEnd();
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
- EXPECT_EQ(gfx::Vector2d(75, 75), m_hostImpl->rootLayer()->max_scroll_offset());
+ EXPECT_EQ(gfx::Vector2d(75, 75), m_hostImpl->active_tree()->root_layer()->max_scroll_offset());
}
// Scrolling after a pinch gesture should always be in local space. The scroll deltas do not
// have the page scale factor applied.
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
- m_hostImpl->activeTree()->SetPageScaleDelta(1);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleDelta(1);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
float pageScaleDelta = 2;
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(0, 0));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(0, 0));
+ m_hostImpl->PinchGestureEnd();
gfx::Vector2d scrollDelta(0, 10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), scrollDelta);
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), scrollDelta);
}
}
TEST_F(LayerTreeHostImplTest, pinchGesture)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
+ LayerImpl* scrollLayer = m_hostImpl->RootScrollLayer();
DCHECK(scrollLayer);
const float minPageScale = 1;
@@ -623,49 +623,49 @@ TEST_F(LayerTreeHostImplTest, pinchGesture)
// Basic pinch zoom in gesture
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
float pageScaleDelta = 2;
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(50, 50));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(50, 50));
+ m_hostImpl->PinchGestureEnd();
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
}
// Zoom-in clamping
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
float pageScaleDelta = 10;
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(50, 50));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(50, 50));
+ m_hostImpl->PinchGestureEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, maxPageScale);
}
// Zoom-out clamping
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
scrollLayer->SetScrollOffset(gfx::Vector2d(50, 50));
float pageScaleDelta = 0.1f;
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(0, 0));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(0, 0));
+ m_hostImpl->PinchGestureEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
EXPECT_TRUE(scrollInfo->scrolls.empty());
@@ -673,39 +673,39 @@ TEST_F(LayerTreeHostImplTest, pinchGesture)
// Two-finger panning should not happen based on pinch events only
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
scrollLayer->SetScrollOffset(gfx::Vector2d(20, 20));
float pageScaleDelta = 1;
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(10, 10));
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(20, 20));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(10, 10));
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(20, 20));
+ m_hostImpl->PinchGestureEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
EXPECT_TRUE(scrollInfo->scrolls.empty());
}
// Two-finger panning should work with interleaved scroll events
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollDelta(gfx::Vector2d());
scrollLayer->SetScrollOffset(gfx::Vector2d(20, 20));
float pageScaleDelta = 1;
- m_hostImpl->scrollBegin(gfx::Point(10, 10), InputHandlerClient::Wheel);
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(10, 10));
- m_hostImpl->scrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10));
- m_hostImpl->pinchGestureUpdate(pageScaleDelta, gfx::Point(20, 20));
- m_hostImpl->pinchGestureEnd();
- m_hostImpl->scrollEnd();
-
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ m_hostImpl->ScrollBegin(gfx::Point(10, 10), InputHandlerClient::Wheel);
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(10, 10));
+ m_hostImpl->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10));
+ m_hostImpl->PinchGestureUpdate(pageScaleDelta, gfx::Point(20, 20));
+ m_hostImpl->PinchGestureEnd();
+ m_hostImpl->ScrollEnd();
+
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, pageScaleDelta);
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(-10, -10));
}
@@ -714,10 +714,10 @@ TEST_F(LayerTreeHostImplTest, pinchGesture)
TEST_F(LayerTreeHostImplTest, pageScaleAnimation)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
+ LayerImpl* scrollLayer = m_hostImpl->RootScrollLayer();
DCHECK(scrollLayer);
const float minPageScale = 0.5;
@@ -730,33 +730,33 @@ TEST_F(LayerTreeHostImplTest, pageScaleAnimation)
// Non-anchor zoom-in
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollOffset(gfx::Vector2d(50, 50));
- m_hostImpl->startPageScaleAnimation(gfx::Vector2d(0, 0), false, 2, startTime, duration);
- m_hostImpl->animate(halfwayThroughAnimation, base::Time());
+ m_hostImpl->StartPageScaleAnimation(gfx::Vector2d(0, 0), false, 2, startTime, duration);
+ m_hostImpl->Animate(halfwayThroughAnimation, base::Time());
EXPECT_TRUE(m_didRequestRedraw);
- m_hostImpl->animate(endTime, base::Time());
+ m_hostImpl->Animate(endTime, base::Time());
EXPECT_TRUE(m_didRequestCommit);
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, 2);
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(-50, -50));
}
// Anchor zoom-out
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollOffset(gfx::Vector2d(50, 50));
- m_hostImpl->startPageScaleAnimation(gfx::Vector2d(25, 25), true, minPageScale, startTime, duration);
- m_hostImpl->animate(endTime, base::Time());
+ m_hostImpl->StartPageScaleAnimation(gfx::Vector2d(25, 25), true, minPageScale, startTime, duration);
+ m_hostImpl->Animate(endTime, base::Time());
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
// Pushed to (0,0) via clamping against contents layer size.
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(-50, -50));
@@ -766,10 +766,10 @@ TEST_F(LayerTreeHostImplTest, pageScaleAnimation)
TEST_F(LayerTreeHostImplTest, pageScaleAnimationNoOp)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
- LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
+ LayerImpl* scrollLayer = m_hostImpl->RootScrollLayer();
DCHECK(scrollLayer);
const float minPageScale = 0.5;
@@ -782,17 +782,17 @@ TEST_F(LayerTreeHostImplTest, pageScaleAnimationNoOp)
// Anchor zoom with unchanged page scale should not change scroll or scale.
{
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
scrollLayer->SetImplTransform(identityScaleTransform);
scrollLayer->SetScrollOffset(gfx::Vector2d(50, 50));
- m_hostImpl->startPageScaleAnimation(gfx::Vector2d(0, 0), true, 1, startTime, duration);
- m_hostImpl->animate(halfwayThroughAnimation, base::Time());
+ m_hostImpl->StartPageScaleAnimation(gfx::Vector2d(0, 0), true, 1, startTime, duration);
+ m_hostImpl->Animate(halfwayThroughAnimation, base::Time());
EXPECT_TRUE(m_didRequestRedraw);
- m_hostImpl->animate(endTime, base::Time());
+ m_hostImpl->Animate(endTime, base::Time());
EXPECT_TRUE(m_didRequestCommit);
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, 1);
expectNone(*scrollInfo, scrollLayer->id());
}
@@ -801,8 +801,8 @@ TEST_F(LayerTreeHostImplTest, pageScaleAnimationNoOp)
TEST_F(LayerTreeHostImplTest, compositorFrameMetadata)
{
setupScrollAndContentsLayers(gfx::Size(100, 100));
- m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1.0f, 0.5f, 4.0f);
+ m_hostImpl->SetViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1.0f, 0.5f, 4.0f);
initializeRendererAndDrawFrame();
{
@@ -816,13 +816,13 @@ TEST_F(LayerTreeHostImplTest, compositorFrameMetadata)
}
// Scrolling should update metadata immediately.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
{
CompositorFrameMetadata metadata = m_hostImpl->MakeCompositorFrameMetadata();
EXPECT_EQ(gfx::Vector2dF(0.0f, 10.0f), metadata.root_scroll_offset);
}
- m_hostImpl->scrollEnd();
+ m_hostImpl->ScrollEnd();
{
CompositorFrameMetadata metadata = m_hostImpl->MakeCompositorFrameMetadata();
@@ -830,9 +830,9 @@ TEST_F(LayerTreeHostImplTest, compositorFrameMetadata)
}
// Page scale should update metadata correctly (shrinking only the viewport).
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(2.0f, gfx::Point(0, 0));
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(2.0f, gfx::Point(0, 0));
+ m_hostImpl->PinchGestureEnd();
{
CompositorFrameMetadata metadata = m_hostImpl->MakeCompositorFrameMetadata();
@@ -845,9 +845,9 @@ TEST_F(LayerTreeHostImplTest, compositorFrameMetadata)
}
// Likewise if set from the main thread.
- m_hostImpl->processScrollDeltas();
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(4.0f, 0.5f, 4.0f);
- m_hostImpl->activeTree()->SetPageScaleDelta(1.0f);
+ m_hostImpl->ProcessScrollDeltas();
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(4.0f, 0.5f, 4.0f);
+ m_hostImpl->active_tree()->SetPageScaleDelta(1.0f);
{
CompositorFrameMetadata metadata = m_hostImpl->MakeCompositorFrameMetadata();
EXPECT_EQ(gfx::Vector2dF(0.0f, 10.0f), metadata.root_scroll_offset);
@@ -909,11 +909,11 @@ TEST_F(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
{
// The root layer is always drawn, so run this test on a child layer that
// will be masked out by the root layer's bounds.
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 1));
- DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 1));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
root->SetMasksToBounds(true);
- root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 2));
+ root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 2));
DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0]);
// Ensure visibleContentRect for layer is empty
layer->SetPosition(gfx::PointF(100, 100));
@@ -925,9 +925,9 @@ TEST_F(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
EXPECT_FALSE(layer->willDrawCalled());
EXPECT_FALSE(layer->didDrawCalled());
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
EXPECT_FALSE(layer->willDrawCalled());
EXPECT_FALSE(layer->didDrawCalled());
@@ -940,9 +940,9 @@ TEST_F(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
EXPECT_FALSE(layer->willDrawCalled());
EXPECT_FALSE(layer->didDrawCalled());
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
EXPECT_TRUE(layer->willDrawCalled());
EXPECT_TRUE(layer->didDrawCalled());
@@ -953,15 +953,15 @@ TEST_F(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
TEST_F(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer)
{
gfx::Size bigSize(1000, 1000);
- m_hostImpl->setViewportSize(bigSize, bigSize);
+ m_hostImpl->SetViewportSize(bigSize, bigSize);
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 1));
- DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 1));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
- root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 2));
+ root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 2));
DidDrawCheckLayer* occludedLayer = static_cast<DidDrawCheckLayer*>(root->children()[0]);
- root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 3));
+ root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 3));
DidDrawCheckLayer* topLayer = static_cast<DidDrawCheckLayer*>(root->children()[1]);
// This layer covers the occludedLayer above. Make this layer large so it can occlude.
topLayer->SetBounds(bigSize);
@@ -975,9 +975,9 @@ TEST_F(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer)
EXPECT_FALSE(topLayer->willDrawCalled());
EXPECT_FALSE(topLayer->didDrawCalled());
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
EXPECT_FALSE(occludedLayer->willDrawCalled());
EXPECT_FALSE(occludedLayer->didDrawCalled());
@@ -987,13 +987,13 @@ TEST_F(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer)
TEST_F(LayerTreeHostImplTest, didDrawCalledOnAllLayers)
{
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 1));
- DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 1));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
- root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 2));
+ root->AddChild(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 2));
DidDrawCheckLayer* layer1 = static_cast<DidDrawCheckLayer*>(root->children()[0]);
- layer1->AddChild(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 3));
+ layer1->AddChild(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 3));
DidDrawCheckLayer* layer2 = static_cast<DidDrawCheckLayer*>(layer1->children()[0]);
layer1->SetOpacity(0.3f);
@@ -1004,9 +1004,9 @@ TEST_F(LayerTreeHostImplTest, didDrawCalledOnAllLayers)
EXPECT_FALSE(layer2->didDrawCalled());
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
EXPECT_TRUE(root->didDrawCalled());
EXPECT_TRUE(layer1->didDrawCalled());
@@ -1044,53 +1044,53 @@ private:
TEST_F(LayerTreeHostImplTest, prepareToDrawFailsWhenAnimationUsesCheckerboard)
{
// When the texture is not missing, we draw as usual.
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 1));
- DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
- root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->activeTree(), 2, false, false, true, m_hostImpl->resourceProvider()));
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 1));
+ DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
+ root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->active_tree(), 2, false, false, true, m_hostImpl->resource_provider()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// When a texture is missing and we're not animating, we draw as usual with checkerboarding.
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 3));
- root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
- root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->activeTree(), 4, true, false, false, m_hostImpl->resourceProvider()));
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 3));
+ root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
+ root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->active_tree(), 4, true, false, false, m_hostImpl->resource_provider()));
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// When a texture is missing and we're animating, we don't want to draw anything.
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 5));
- root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
- root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->activeTree(), 6, true, false, true, m_hostImpl->resourceProvider()));
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 5));
+ root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
+ root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->active_tree(), 6, true, false, true, m_hostImpl->resource_provider()));
- EXPECT_FALSE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_FALSE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// When the layer skips draw and we're animating, we still draw the frame.
- m_hostImpl->activeTree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->activeTree(), 7));
- root = static_cast<DidDrawCheckLayer*>(m_hostImpl->rootLayer());
- root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->activeTree(), 8, false, true, true, m_hostImpl->resourceProvider()));
+ m_hostImpl->active_tree()->SetRootLayer(DidDrawCheckLayer::Create(m_hostImpl->active_tree(), 7));
+ root = static_cast<DidDrawCheckLayer*>(m_hostImpl->active_tree()->root_layer());
+ root->AddChild(MissingTextureAnimatingLayer::Create(m_hostImpl->active_tree(), 8, false, true, true, m_hostImpl->resource_provider()));
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
TEST_F(LayerTreeHostImplTest, scrollRootIgnored)
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetScrollable(false);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
initializeRendererAndDrawFrame();
// Scroll event is ignored because layer is not scrollable.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
EXPECT_FALSE(m_didRequestRedraw);
EXPECT_FALSE(m_didRequestCommit);
}
@@ -1101,30 +1101,30 @@ TEST_F(LayerTreeHostImplTest, scrollNonScrollableRootWithTopControls)
settings.calculateTopControlsPosition = true;
settings.topControlsHeight = 50;
- m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
- m_hostImpl->initializeRenderer(createOutputSurface());
- m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
+ m_hostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
+ m_hostImpl->InitializeRenderer(createOutputSurface());
+ m_hostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
gfx::Size layerSize(5, 5);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetScrollable(true);
root->SetMaxScrollOffset(gfx::Vector2d(layerSize.width(), layerSize.height()));
root->SetBounds(layerSize);
root->SetContentBounds(layerSize);
root->SetPosition(gfx::PointF(0, 0));
root->SetAnchorPoint(gfx::PointF(0, 0));
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->FindRootScrollLayer();
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->FindRootScrollLayer();
initializeRendererAndDrawFrame();
- EXPECT_EQ(InputHandlerClient::ScrollIgnored, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
+ EXPECT_EQ(InputHandlerClient::ScrollIgnored, m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
- m_hostImpl->topControlsManager()->ScrollBegin();
- m_hostImpl->topControlsManager()->ScrollBy(gfx::Vector2dF(0, 50));
- m_hostImpl->topControlsManager()->ScrollEnd();
- EXPECT_EQ(m_hostImpl->topControlsManager()->content_top_offset(), 0.f);
+ m_hostImpl->top_controls_manager()->ScrollBegin();
+ m_hostImpl->top_controls_manager()->ScrollBy(gfx::Vector2dF(0, 50));
+ m_hostImpl->top_controls_manager()->ScrollEnd();
+ EXPECT_EQ(m_hostImpl->top_controls_manager()->content_top_offset(), 0.f);
- EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
+ EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture));
}
TEST_F(LayerTreeHostImplTest, scrollNonCompositedRoot)
@@ -1133,7 +1133,7 @@ TEST_F(LayerTreeHostImplTest, scrollNonCompositedRoot)
// scrollable outer layer.
gfx::Size surfaceSize(10, 10);
- scoped_ptr<LayerImpl> contentLayer = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> contentLayer = LayerImpl::Create(m_hostImpl->active_tree(), 1);
contentLayer->SetDrawsContent(true);
contentLayer->SetPosition(gfx::PointF(0, 0));
contentLayer->SetAnchorPoint(gfx::PointF(0, 0));
@@ -1141,7 +1141,7 @@ TEST_F(LayerTreeHostImplTest, scrollNonCompositedRoot)
contentLayer->SetContentBounds(gfx::Size(surfaceSize.width() * 2, surfaceSize.height() * 2));
contentLayer->SetContentsScale(2, 2);
- scoped_ptr<LayerImpl> scrollLayer = LayerImpl::Create(m_hostImpl->activeTree(), 2);
+ scoped_ptr<LayerImpl> scrollLayer = LayerImpl::Create(m_hostImpl->active_tree(), 2);
scrollLayer->SetScrollable(true);
scrollLayer->SetMaxScrollOffset(gfx::Vector2d(surfaceSize.width(), surfaceSize.height()));
scrollLayer->SetBounds(surfaceSize);
@@ -1150,13 +1150,13 @@ TEST_F(LayerTreeHostImplTest, scrollNonCompositedRoot)
scrollLayer->SetAnchorPoint(gfx::PointF(0, 0));
scrollLayer->AddChild(contentLayer.Pass());
- m_hostImpl->activeTree()->SetRootLayer(scrollLayer.Pass());
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(scrollLayer.Pass());
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ m_hostImpl->ScrollEnd();
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
}
@@ -1164,17 +1164,17 @@ TEST_F(LayerTreeHostImplTest, scrollNonCompositedRoot)
TEST_F(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
{
gfx::Size surfaceSize(10, 10);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetBounds(surfaceSize);
root->SetContentBounds(surfaceSize);
root->AddChild(createScrollableLayer(2, surfaceSize));
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ m_hostImpl->ScrollEnd();
EXPECT_TRUE(m_didRequestRedraw);
EXPECT_TRUE(m_didRequestCommit);
}
@@ -1182,14 +1182,14 @@ TEST_F(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
TEST_F(LayerTreeHostImplTest, scrollMissesChild)
{
gfx::Size surfaceSize(10, 10);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->AddChild(createScrollableLayer(2, surfaceSize));
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
// Scroll event is ignored because the input coordinate is outside the layer boundaries.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(15, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(15, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
EXPECT_FALSE(m_didRequestRedraw);
EXPECT_FALSE(m_didRequestCommit);
}
@@ -1197,9 +1197,9 @@ TEST_F(LayerTreeHostImplTest, scrollMissesChild)
TEST_F(LayerTreeHostImplTest, scrollMissesBackfacingChild)
{
gfx::Size surfaceSize(10, 10);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize);
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
gfx::Transform matrix;
matrix.RotateAboutXAxis(180);
@@ -1207,12 +1207,12 @@ TEST_F(LayerTreeHostImplTest, scrollMissesBackfacingChild)
child->SetDoubleSided(false);
root->AddChild(child.Pass());
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
initializeRendererAndDrawFrame();
// Scroll event is ignored because the scrollable layer is not facing the viewer and there is
// nothing scrollable behind it.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
EXPECT_FALSE(m_didRequestRedraw);
EXPECT_FALSE(m_didRequestCommit);
}
@@ -1227,12 +1227,12 @@ TEST_F(LayerTreeHostImplTest, scrollBlockedByContentLayer)
scoped_ptr<LayerImpl> scrollLayer = createScrollableLayer(2, surfaceSize);
scrollLayer->AddChild(contentLayer.Pass());
- m_hostImpl->activeTree()->SetRootLayer(scrollLayer.Pass());
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(scrollLayer.Pass());
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
// Scrolling fails because the content layer is asking to be scrolled on the main thread.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollOnMainThread);
}
TEST_F(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
@@ -1240,48 +1240,48 @@ TEST_F(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
gfx::Size surfaceSize(10, 10);
float pageScale = 2;
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
gfx::Vector2d scrollDelta(0, 10);
gfx::Vector2d expectedScrollDelta(scrollDelta);
- gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->max_scroll_offset());
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ gfx::Vector2d expectedMaxScroll(m_hostImpl->active_tree()->root_layer()->max_scroll_offset());
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
// Set new page scale from main thread.
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(pageScale, pageScale, pageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(pageScale, pageScale, pageScale);
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScrollDelta);
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), expectedScrollDelta);
// The scroll range should also have been updated.
- EXPECT_EQ(m_hostImpl->rootLayer()->max_scroll_offset(), expectedMaxScroll);
+ EXPECT_EQ(m_hostImpl->active_tree()->root_layer()->max_scroll_offset(), expectedMaxScroll);
// The page scale delta remains constant because the impl thread did not scale.
// TODO: If possible, use gfx::Transform() or Skia equality functions. At
// the moment we avoid that because skia does exact bit-wise equality
// checking that does not consider -0 == +0.
// http://code.google.com/p/chromium/issues/detail?id=162747
- EXPECT_EQ(1.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(0, 0));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(0, 1));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(0, 2));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(0, 3));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(1, 0));
- EXPECT_EQ(1.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(1, 1));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(1, 2));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(1, 3));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(2, 0));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(2, 1));
- EXPECT_EQ(1.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(2, 2));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(2, 3));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(3, 0));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(3, 1));
- EXPECT_EQ(0.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(3, 2));
- EXPECT_EQ(1.0, m_hostImpl->rootLayer()->impl_transform().matrix().getDouble(3, 3));
+ EXPECT_EQ(1.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(0, 0));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(0, 1));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(0, 2));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(0, 3));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(1, 0));
+ EXPECT_EQ(1.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(1, 1));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(1, 2));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(1, 3));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(2, 0));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(2, 1));
+ EXPECT_EQ(1.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(2, 2));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(2, 3));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(3, 0));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(3, 1));
+ EXPECT_EQ(0.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(3, 2));
+ EXPECT_EQ(1.0, m_hostImpl->active_tree()->root_layer()->impl_transform().matrix().getDouble(3, 3));
}
TEST_F(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
@@ -1289,36 +1289,36 @@ TEST_F(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
gfx::Size surfaceSize(10, 10);
float pageScale = 2;
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(1, 1, pageScale);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(1, 1, pageScale);
initializeRendererAndDrawFrame();
gfx::Vector2d scrollDelta(0, 10);
gfx::Vector2d expectedScrollDelta(scrollDelta);
- gfx::Vector2d expectedMaxScroll(m_hostImpl->rootLayer()->max_scroll_offset());
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ gfx::Vector2d expectedMaxScroll(m_hostImpl->active_tree()->root_layer()->max_scroll_offset());
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
// Set new page scale on impl thread by pinching.
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(pageScale, gfx::Point());
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(pageScale, gfx::Point());
+ m_hostImpl->PinchGestureEnd();
drawOneFrame();
// The scroll delta is not scaled because the main thread did not scale.
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedScrollDelta);
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), expectedScrollDelta);
// The scroll range should also have been updated.
- EXPECT_EQ(m_hostImpl->rootLayer()->max_scroll_offset(), expectedMaxScroll);
+ EXPECT_EQ(m_hostImpl->active_tree()->root_layer()->max_scroll_offset(), expectedMaxScroll);
// The page scale delta should match the new scale on the impl side.
gfx::Transform expectedScale;
expectedScale.Scale(pageScale, pageScale);
- EXPECT_EQ(m_hostImpl->rootLayer()->impl_transform(), expectedScale);
+ EXPECT_EQ(m_hostImpl->active_tree()->root_layer()->impl_transform(), expectedScale);
}
TEST_F(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
@@ -1333,7 +1333,7 @@ TEST_F(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
// Create a normal scrollable root layer and another scrollable child layer.
setupScrollAndContentsLayers(surfaceSize);
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
LayerImpl* child = root->children()[0];
scoped_ptr<LayerImpl> scrollableChild = createScrollableLayer(3, surfaceSize);
@@ -1341,9 +1341,9 @@ TEST_F(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
LayerImpl* grandChild = child->children()[0];
// Set new page scale on impl thread by pinching.
- m_hostImpl->pinchGestureBegin();
- m_hostImpl->pinchGestureUpdate(newPageScale, gfx::Point());
- m_hostImpl->pinchGestureEnd();
+ m_hostImpl->PinchGestureBegin();
+ m_hostImpl->PinchGestureUpdate(newPageScale, gfx::Point());
+ m_hostImpl->PinchGestureEnd();
drawOneFrame();
// The page scale delta should only be applied to the scrollable root layer.
@@ -1354,9 +1354,9 @@ TEST_F(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
// Make sure all the layers are drawn with the page scale delta applied, i.e., the page scale
// delta on the root layer is applied hierarchically.
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
EXPECT_EQ(root->draw_transform().matrix().getDouble(0, 0), newPageScale);
EXPECT_EQ(root->draw_transform().matrix().getDouble(1, 1), newPageScale);
@@ -1369,33 +1369,33 @@ TEST_F(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
TEST_F(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
{
gfx::Size surfaceSize(10, 10);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetBounds(surfaceSize);
root->SetContentBounds(surfaceSize);
// Also mark the root scrollable so it becomes the root scroll layer.
root->SetScrollable(true);
int scrollLayerId = 2;
root->AddChild(createScrollableLayer(scrollLayerId, surfaceSize));
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
- LayerImpl* child = m_hostImpl->rootLayer()->children()[0];
+ LayerImpl* child = m_hostImpl->active_tree()->root_layer()->children()[0];
gfx::Vector2d scrollDelta(0, 10);
gfx::Vector2d expectedScrollDelta(scrollDelta);
gfx::Vector2d expectedMaxScroll(child->max_scroll_offset());
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
float pageScale = 2;
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(pageScale, 1, pageScale);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(pageScale, 1, pageScale);
drawOneFrame();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
expectContains(*scrollInfo.get(), scrollLayerId, expectedScrollDelta);
// The scroll range should not have changed.
@@ -1422,20 +1422,20 @@ TEST_F(LayerTreeHostImplTest, scrollChildBeyondLimit)
child->AddChild(grandChild.Pass());
root->AddChild(child.Pass());
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
{
gfx::Vector2d scrollDelta(-8, -7);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
// The grand child should have scrolled up to its limit.
- LayerImpl* child = m_hostImpl->rootLayer()->children()[0];
+ LayerImpl* child = m_hostImpl->active_tree()->root_layer()->children()[0];
LayerImpl* grandChild = child->children()[0];
expectContains(*scrollInfo.get(), grandChild->id(), gfx::Vector2d(0, -5));
@@ -1459,20 +1459,20 @@ TEST_F(LayerTreeHostImplTest, scrollWithoutBubbling)
child->AddChild(grandChild.Pass());
root->AddChild(child.Pass());
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
{
gfx::Vector2d scrollDelta(0, -10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::NonBubblingGesture), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::NonBubblingGesture), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
// The grand child should have scrolled up to its limit.
- LayerImpl* child = m_hostImpl->rootLayer()->children()[0];
+ LayerImpl* child = m_hostImpl->active_tree()->root_layer()->children()[0];
LayerImpl* grandChild = child->children()[0];
expectContains(*scrollInfo.get(), grandChild->id(), gfx::Vector2d(0, -2));
@@ -1481,13 +1481,13 @@ TEST_F(LayerTreeHostImplTest, scrollWithoutBubbling)
// The next time we scroll we should only scroll the parent.
scrollDelta = gfx::Vector2d(0, -3);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::NonBubblingGesture), InputHandlerClient::ScrollStarted);
- EXPECT_EQ(m_hostImpl->currentlyScrollingLayer(), grandChild);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- EXPECT_EQ(m_hostImpl->currentlyScrollingLayer(), child);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::NonBubblingGesture), InputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->CurrentlyScrollingLayer(), grandChild);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ EXPECT_EQ(m_hostImpl->CurrentlyScrollingLayer(), child);
+ m_hostImpl->ScrollEnd();
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
// The child should have scrolled up to its limit.
expectContains(*scrollInfo.get(), child->id(), gfx::Vector2d(0, -3));
@@ -1498,13 +1498,13 @@ TEST_F(LayerTreeHostImplTest, scrollWithoutBubbling)
// After scrolling the parent, another scroll on the opposite direction
// should still scroll the child.
scrollDelta = gfx::Vector2d(0, 7);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::NonBubblingGesture), InputHandlerClient::ScrollStarted);
- EXPECT_EQ(m_hostImpl->currentlyScrollingLayer(), grandChild);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- EXPECT_EQ(m_hostImpl->currentlyScrollingLayer(), grandChild);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::NonBubblingGesture), InputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->CurrentlyScrollingLayer(), grandChild);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ EXPECT_EQ(m_hostImpl->CurrentlyScrollingLayer(), grandChild);
+ m_hostImpl->ScrollEnd();
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
// The grand child should have scrolled.
expectContains(*scrollInfo.get(), grandChild->id(), gfx::Vector2d(0, 5));
@@ -1514,19 +1514,19 @@ TEST_F(LayerTreeHostImplTest, scrollWithoutBubbling)
// Scrolling should be adjusted from viewport space.
- m_hostImpl->activeTree()->SetPageScaleFactorAndLimits(2, 2, 2);
- m_hostImpl->activeTree()->SetPageScaleDelta(1);
+ m_hostImpl->active_tree()->SetPageScaleFactorAndLimits(2, 2, 2);
+ m_hostImpl->active_tree()->SetPageScaleDelta(1);
gfx::Transform scaleTransform;
scaleTransform.Scale(2, 2);
- m_hostImpl->activeTree()->RootLayer()->SetImplTransform(scaleTransform);
+ m_hostImpl->active_tree()->root_layer()->SetImplTransform(scaleTransform);
scrollDelta = gfx::Vector2d(0, -2);
- EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->scrollBegin(gfx::Point(1, 1), InputHandlerClient::NonBubblingGesture));
- EXPECT_EQ(grandChild, m_hostImpl->currentlyScrollingLayer());
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(InputHandlerClient::ScrollStarted, m_hostImpl->ScrollBegin(gfx::Point(1, 1), InputHandlerClient::NonBubblingGesture));
+ EXPECT_EQ(grandChild, m_hostImpl->CurrentlyScrollingLayer());
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
- scrollInfo = m_hostImpl->processScrollDeltas();
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
// Should have scrolled by half the amount in layer space (5 - 2/2)
expectContains(*scrollInfo.get(), grandChild->id(), gfx::Vector2d(0, 4));
@@ -1545,39 +1545,39 @@ TEST_F(LayerTreeHostImplTest, scrollEventBubbling)
child->SetScrollable(false);
root->AddChild(child.Pass());
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
- m_hostImpl->activeTree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->DidBecomeActive();
initializeRendererAndDrawFrame();
{
gfx::Vector2d scrollDelta(0, 4);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
// Only the root should have scrolled.
ASSERT_EQ(scrollInfo->scrolls.size(), 1u);
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), scrollDelta);
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), scrollDelta);
}
}
TEST_F(LayerTreeHostImplTest, scrollBeforeRedraw)
{
gfx::Size surfaceSize(10, 10);
- m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(1, surfaceSize));
- m_hostImpl->activeTree()->DidBecomeActive();
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->active_tree()->SetRootLayer(createScrollableLayer(1, surfaceSize));
+ m_hostImpl->active_tree()->DidBecomeActive();
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
// Draw one frame and then immediately rebuild the layer tree to mimic a tree synchronization.
initializeRendererAndDrawFrame();
- m_hostImpl->activeTree()->DetachLayerTree();
- m_hostImpl->activeTree()->SetRootLayer(createScrollableLayer(2, surfaceSize));
- m_hostImpl->activeTree()->DidBecomeActive();
+ m_hostImpl->active_tree()->DetachLayerTree();
+ m_hostImpl->active_tree()->SetRootLayer(createScrollableLayer(2, surfaceSize));
+ m_hostImpl->active_tree()->DidBecomeActive();
// Scrolling should still work even though we did not draw yet.
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(5, 5), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
}
TEST_F(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer)
@@ -1587,32 +1587,32 @@ TEST_F(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer)
// Rotate the root layer 90 degrees counter-clockwise about its center.
gfx::Transform rotateTransform;
rotateTransform.Rotate(-90);
- m_hostImpl->rootLayer()->SetTransform(rotateTransform);
+ m_hostImpl->active_tree()->root_layer()->SetTransform(rotateTransform);
gfx::Size surfaceSize(50, 50);
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
// Scroll to the right in screen coordinates with a gesture.
gfx::Vector2d gestureScrollDelta(10, 0);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gestureScrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gestureScrollDelta);
+ m_hostImpl->ScrollEnd();
// The layer should have scrolled down in its local coordinates.
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), gfx::Vector2d(0, gestureScrollDelta.x()));
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), gfx::Vector2d(0, gestureScrollDelta.x()));
// Reset and scroll down with the wheel.
- m_hostImpl->rootLayer()->SetScrollDelta(gfx::Vector2dF());
+ m_hostImpl->active_tree()->root_layer()->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d wheelScrollDelta(0, 10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), wheelScrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), wheelScrollDelta);
+ m_hostImpl->ScrollEnd();
// The layer should have scrolled down in its local coordinates.
- scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScrollDelta);
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), wheelScrollDelta);
}
TEST_F(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
@@ -1622,7 +1622,7 @@ TEST_F(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
float childLayerAngle = -20;
// Create a child layer that is rotated to a non-axis-aligned angle.
- scoped_ptr<LayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->rootLayer()->content_bounds());
+ scoped_ptr<LayerImpl> child = createScrollableLayer(childLayerId, m_hostImpl->active_tree()->root_layer()->content_bounds());
gfx::Transform rotateTransform;
rotateTransform.Translate(-50, -50);
rotateTransform.Rotate(childLayerAngle);
@@ -1631,23 +1631,23 @@ TEST_F(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
// Only allow vertical scrolling.
child->SetMaxScrollOffset(gfx::Vector2d(0, child->content_bounds().height()));
- m_hostImpl->rootLayer()->AddChild(child.Pass());
+ m_hostImpl->active_tree()->root_layer()->AddChild(child.Pass());
gfx::Size surfaceSize(50, 50);
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
{
// Scroll down in screen coordinates with a gesture.
gfx::Vector2d gestureScrollDelta(0, 10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gestureScrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gestureScrollDelta);
+ m_hostImpl->ScrollEnd();
// The child layer should have scrolled down in its local coordinates an amount proportional to
// the angle between it and the input scroll delta.
gfx::Vector2d expectedScrollDelta(0, gestureScrollDelta.y() * std::cos(MathUtil::Deg2Rad(childLayerAngle)));
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
expectContains(*scrollInfo.get(), childLayerId, expectedScrollDelta);
// The root layer should not have scrolled, because the input delta was close to the layer's
@@ -1657,22 +1657,22 @@ TEST_F(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
{
// Now reset and scroll the same amount horizontally.
- m_hostImpl->rootLayer()->children()[1]->SetScrollDelta(gfx::Vector2dF());
+ m_hostImpl->active_tree()->root_layer()->children()[1]->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d gestureScrollDelta(10, 0);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), gestureScrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), gestureScrollDelta);
+ m_hostImpl->ScrollEnd();
// The child layer should have scrolled down in its local coordinates an amount proportional to
// the angle between it and the input scroll delta.
gfx::Vector2d expectedScrollDelta(0, -gestureScrollDelta.x() * std::sin(MathUtil::Deg2Rad(childLayerAngle)));
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
expectContains(*scrollInfo.get(), childLayerId, expectedScrollDelta);
// The root layer should have scrolled more, since the input scroll delta was mostly
// orthogonal to the child layer's vertical scroll axis.
gfx::Vector2d expectedRootScrollDelta(gestureScrollDelta.x() * std::pow(std::cos(MathUtil::Deg2Rad(childLayerAngle)), 2), 0);
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), expectedRootScrollDelta);
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), expectedRootScrollDelta);
}
}
@@ -1684,32 +1684,32 @@ TEST_F(LayerTreeHostImplTest, scrollScaledLayer)
int scale = 2;
gfx::Transform scaleTransform;
scaleTransform.Scale(scale, scale);
- m_hostImpl->rootLayer()->SetTransform(scaleTransform);
+ m_hostImpl->active_tree()->root_layer()->SetTransform(scaleTransform);
gfx::Size surfaceSize(50, 50);
- m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
+ m_hostImpl->SetViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
// Scroll down in screen coordinates with a gesture.
gfx::Vector2d scrollDelta(0, 10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), scrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Gesture), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), scrollDelta);
+ m_hostImpl->ScrollEnd();
// The layer should have scrolled down in its local coordinates, but half he amount.
- scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), gfx::Vector2d(0, scrollDelta.y() / scale));
+ scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), gfx::Vector2d(0, scrollDelta.y() / scale));
// Reset and scroll down with the wheel.
- m_hostImpl->rootLayer()->SetScrollDelta(gfx::Vector2dF());
+ m_hostImpl->active_tree()->root_layer()->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d wheelScrollDelta(0, 10);
- EXPECT_EQ(m_hostImpl->scrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
- m_hostImpl->scrollBy(gfx::Point(), wheelScrollDelta);
- m_hostImpl->scrollEnd();
+ EXPECT_EQ(m_hostImpl->ScrollBegin(gfx::Point(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
+ m_hostImpl->ScrollBy(gfx::Point(), wheelScrollDelta);
+ m_hostImpl->ScrollEnd();
// The scale should not have been applied to the scroll delta.
- scrollInfo = m_hostImpl->processScrollDeltas();
- expectContains(*scrollInfo.get(), m_hostImpl->rootLayer()->id(), wheelScrollDelta);
+ scrollInfo = m_hostImpl->ProcessScrollDeltas();
+ expectContains(*scrollInfo.get(), m_hostImpl->active_tree()->root_layer()->id(), wheelScrollDelta);
}
class BlendStateTrackerContext: public TestWebGraphicsContext3D {
@@ -1799,16 +1799,16 @@ private:
TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
{
{
- scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetAnchorPoint(gfx::PointF(0, 0));
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(root->bounds());
root->SetDrawsContent(false);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
}
- LayerImpl* root = m_hostImpl->rootLayer();
+ LayerImpl* root = m_hostImpl->active_tree()->root_layer();
- root->AddChild(BlendStateCheckLayer::Create(m_hostImpl->activeTree(), 2, m_hostImpl->resourceProvider()));
+ root->AddChild(BlendStateCheckLayer::Create(m_hostImpl->active_tree(), 2, m_hostImpl->resource_provider()));
BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0]);
layer1->SetPosition(gfx::PointF(2, 2));
@@ -1817,38 +1817,38 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
// Opaque layer, drawn without blending.
layer1->SetContentsOpaque(true);
layer1->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with translucent content and painting, so drawn with blending.
layer1->SetContentsOpaque(false);
layer1->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with translucent opacity, drawn with blending.
layer1->SetContentsOpaque(true);
layer1->SetOpacity(0.5);
layer1->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with translucent opacity and painting, drawn with blending.
layer1->SetContentsOpaque(true);
layer1->SetOpacity(0.5);
layer1->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
- layer1->AddChild(BlendStateCheckLayer::Create(m_hostImpl->activeTree(), 3, m_hostImpl->resourceProvider()));
+ layer1->AddChild(BlendStateCheckLayer::Create(m_hostImpl->active_tree(), 3, m_hostImpl->resource_provider()));
BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
layer2->SetPosition(gfx::PointF(4, 4));
@@ -1859,33 +1859,33 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer2->SetContentsOpaque(true);
layer2->SetOpacity(1);
layer2->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Parent layer with translucent content, drawn with blending.
// Child layer with opaque content, drawn without blending.
layer1->SetContentsOpaque(false);
layer1->setExpectation(true, false);
layer2->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Parent layer with translucent content but opaque painting, drawn without blending.
// Child layer with opaque content, drawn without blending.
layer1->SetContentsOpaque(true);
layer1->setExpectation(false, false);
layer2->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Parent layer with translucent opacity and opaque content. Since it has a
// drawing child, it's drawn to a render surface which carries the opacity,
@@ -1896,11 +1896,11 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer1->SetOpacity(0.5);
layer1->setExpectation(false, true);
layer2->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Draw again, but with child non-opaque, to make sure
// layer1 not culled.
@@ -1910,11 +1910,11 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer2->SetContentsOpaque(true);
layer2->SetOpacity(0.5);
layer2->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// A second way of making the child non-opaque.
layer1->SetContentsOpaque(true);
@@ -1923,11 +1923,11 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer2->SetContentsOpaque(false);
layer2->SetOpacity(1);
layer2->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// And when the layer says its not opaque but is painted opaque, it is not blended.
layer1->SetContentsOpaque(true);
@@ -1936,11 +1936,11 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer2->SetContentsOpaque(true);
layer2->SetOpacity(1);
layer2->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
EXPECT_TRUE(layer2->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with partially opaque contents, drawn with blending.
layer1->SetContentsOpaque(false);
@@ -1948,10 +1948,10 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer1->setQuadVisibleRect(gfx::Rect(5, 5, 5, 5));
layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with partially opaque contents partially culled, drawn with blending.
layer1->SetContentsOpaque(false);
@@ -1959,10 +1959,10 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer1->setQuadVisibleRect(gfx::Rect(5, 5, 5, 2));
layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with partially opaque contents culled, drawn with blending.
layer1->SetContentsOpaque(false);
@@ -1970,10 +1970,10 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer1->setQuadVisibleRect(gfx::Rect(7, 5, 3, 5));
layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(true, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
// Layer with partially opaque contents and translucent contents culled, drawn without blending.
layer1->SetContentsOpaque(false);
@@ -1981,24 +1981,24 @@ TEST_F(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer1->setQuadVisibleRect(gfx::Rect(5, 5, 2, 5));
layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(false, false);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(layer1->quadsAppended());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
TEST_F(LayerTreeHostImplTest, viewportCovered)
{
- m_hostImpl->initializeRenderer(createOutputSurface());
- m_hostImpl->activeTree()->set_background_color(SK_ColorGRAY);
+ m_hostImpl->InitializeRenderer(createOutputSurface());
+ m_hostImpl->active_tree()->set_background_color(SK_ColorGRAY);
gfx::Size viewportSize(1000, 1000);
- m_hostImpl->setViewportSize(viewportSize, viewportSize);
+ m_hostImpl->SetViewportSize(viewportSize, viewportSize);
- m_hostImpl->activeTree()->SetRootLayer(LayerImpl::Create(m_hostImpl->activeTree(), 1));
- m_hostImpl->rootLayer()->AddChild(BlendStateCheckLayer::Create(m_hostImpl->activeTree(), 2, m_hostImpl->resourceProvider()));
- BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>(m_hostImpl->rootLayer()->children()[0]);
+ m_hostImpl->active_tree()->SetRootLayer(LayerImpl::Create(m_hostImpl->active_tree(), 1));
+ m_hostImpl->active_tree()->root_layer()->AddChild(BlendStateCheckLayer::Create(m_hostImpl->active_tree(), 2, m_hostImpl->resource_provider()));
+ BlendStateCheckLayer* child = static_cast<BlendStateCheckLayer*>(m_hostImpl->active_tree()->root_layer()->children()[0]);
child->setExpectation(false, false);
child->SetContentsOpaque(true);
@@ -2012,17 +2012,17 @@ TEST_F(LayerTreeHostImplTest, viewportCovered)
child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ ASSERT_EQ(1u, frame.render_passes.size());
size_t numGutterQuads = 0;
- for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i)
- numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
+ for (size_t i = 0; i < frame.render_passes[0]->quad_list.size(); ++i)
+ numGutterQuads += (frame.render_passes[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
EXPECT_EQ(0u, numGutterQuads);
- EXPECT_EQ(1u, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size());
- LayerTestCommon::verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize));
- m_hostImpl->didDrawAllLayers(frame);
+ LayerTestCommon::verifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize));
+ m_hostImpl->DidDrawAllLayers(frame);
}
// Empty visible content area (fullscreen gutter rect)
@@ -2035,17 +2035,17 @@ TEST_F(LayerTreeHostImplTest, viewportCovered)
child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ ASSERT_EQ(1u, frame.render_passes.size());
size_t numGutterQuads = 0;
- for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i)
- numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
+ for (size_t i = 0; i < frame.render_passes[0]->quad_list.size(); ++i)
+ numGutterQuads += (frame.render_passes[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
EXPECT_EQ(1u, numGutterQuads);
- EXPECT_EQ(1u, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size());
- LayerTestCommon::verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize));
- m_hostImpl->didDrawAllLayers(frame);
+ LayerTestCommon::verifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize));
+ m_hostImpl->DidDrawAllLayers(frame);
}
// Content area in middle of clip rect (four surrounding gutter rects)
@@ -2058,17 +2058,17 @@ TEST_F(LayerTreeHostImplTest, viewportCovered)
child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ ASSERT_EQ(1u, frame.render_passes.size());
size_t numGutterQuads = 0;
- for (size_t i = 0; i < frame.renderPasses[0]->quad_list.size(); ++i)
- numGutterQuads += (frame.renderPasses[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
+ for (size_t i = 0; i < frame.render_passes[0]->quad_list.size(); ++i)
+ numGutterQuads += (frame.render_passes[0]->quad_list[i]->material == DrawQuad::SOLID_COLOR) ? 1 : 0;
EXPECT_EQ(4u, numGutterQuads);
- EXPECT_EQ(5u, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(5u, frame.render_passes[0]->quad_list.size());
- LayerTestCommon::verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize));
- m_hostImpl->didDrawAllLayers(frame);
+ LayerTestCommon::verifyQuadsExactlyCoverRect(frame.render_passes[0]->quad_list, gfx::Rect(gfx::Point(), viewportSize));
+ m_hostImpl->DidDrawAllLayers(frame);
}
}
@@ -2103,20 +2103,20 @@ TEST_F(LayerTreeHostImplTest, reshapeNotCalledUntilDraw)
{
scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new ReshapeTrackerContext)).PassAs<OutputSurface>();
ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(outputSurface->context3d());
- m_hostImpl->initializeRenderer(outputSurface.Pass());
+ m_hostImpl->InitializeRenderer(outputSurface.Pass());
- scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetAnchorPoint(gfx::PointF(0, 0));
root->SetBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
EXPECT_FALSE(reshapeTracker->reshapeCalled());
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
EXPECT_TRUE(reshapeTracker->reshapeCalled());
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
class PartialSwapTrackerContext : public TestWebGraphicsContext3D {
@@ -2151,12 +2151,12 @@ TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
// that we can force partial swap enabled.
LayerTreeSettings settings;
settings.partialSwapEnabled = true;
- scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
- layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
- layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500));
+ scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
+ layerTreeHostImpl->InitializeRenderer(outputSurface.Pass());
+ layerTreeHostImpl->SetViewportSize(gfx::Size(500, 500), gfx::Size(500, 500));
- scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(layerTreeHostImpl->activeTree(), 1);
- scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::Create(layerTreeHostImpl->activeTree(), 2);
+ scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(layerTreeHostImpl->active_tree(), 1);
+ scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::Create(layerTreeHostImpl->active_tree(), 2);
child->SetPosition(gfx::PointF(12, 13));
child->SetAnchorPoint(gfx::PointF(0, 0));
child->SetBounds(gfx::Size(14, 15));
@@ -2167,15 +2167,15 @@ TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
root->SetContentBounds(gfx::Size(500, 500));
root->SetDrawsContent(true);
root->AddChild(child.Pass());
- layerTreeHostImpl->activeTree()->SetRootLayer(root.Pass());
+ layerTreeHostImpl->active_tree()->SetRootLayer(root.Pass());
LayerTreeHostImpl::FrameData frame;
// First frame, the entire screen should get swapped.
- EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
- layerTreeHostImpl->drawLayers(frame);
- layerTreeHostImpl->didDrawAllLayers(frame);
- layerTreeHostImpl->swapBuffers();
+ EXPECT_TRUE(layerTreeHostImpl->PrepareToDraw(&frame));
+ layerTreeHostImpl->DrawLayers(&frame);
+ layerTreeHostImpl->DidDrawAllLayers(frame);
+ layerTreeHostImpl->SwapBuffers();
gfx::Rect actualSwapRect = partialSwapTracker->partialSwapRect();
gfx::Rect expectedSwapRect = gfx::Rect(gfx::Point(), gfx::Size(500, 500));
EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
@@ -2187,11 +2187,11 @@ TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
// of old and new child rects.
// expected damage rect: gfx::Rect(gfx::Point(), gfx::Size(26, 28));
// expected swap rect: vertically flipped, with origin at bottom left corner.
- layerTreeHostImpl->rootLayer()->children()[0]->SetPosition(gfx::PointF(0, 0));
- EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
- layerTreeHostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
- layerTreeHostImpl->swapBuffers();
+ layerTreeHostImpl->active_tree()->root_layer()->children()[0]->SetPosition(gfx::PointF(0, 0));
+ EXPECT_TRUE(layerTreeHostImpl->PrepareToDraw(&frame));
+ layerTreeHostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
+ layerTreeHostImpl->SwapBuffers();
actualSwapRect = partialSwapTracker->partialSwapRect();
expectedSwapRect = gfx::Rect(gfx::Point(0, 500-28), gfx::Size(26, 28));
EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
@@ -2202,12 +2202,12 @@ TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
// Make sure that partial swap is constrained to the viewport dimensions
// expected damage rect: gfx::Rect(gfx::Point(), gfx::Size(500, 500));
// expected swap rect: flipped damage rect, but also clamped to viewport
- layerTreeHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
- layerTreeHostImpl->rootLayer()->SetOpacity(0.7f); // this will damage everything
- EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
- layerTreeHostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
- layerTreeHostImpl->swapBuffers();
+ layerTreeHostImpl->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
+ layerTreeHostImpl->active_tree()->root_layer()->SetOpacity(0.7f); // this will damage everything
+ EXPECT_TRUE(layerTreeHostImpl->PrepareToDraw(&frame));
+ layerTreeHostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
+ layerTreeHostImpl->SwapBuffers();
actualSwapRect = partialSwapTracker->partialSwapRect();
expectedSwapRect = gfx::Rect(gfx::Point(), gfx::Size(10, 10));
EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
@@ -2218,8 +2218,8 @@ TEST_F(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
TEST_F(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface)
{
- scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(m_hostImpl->activeTree(), 1);
- scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::Create(m_hostImpl->activeTree(), 2);
+ scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::Create(m_hostImpl->active_tree(), 1);
+ scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::Create(m_hostImpl->active_tree(), 2);
child->SetAnchorPoint(gfx::PointF(0, 0));
child->SetBounds(gfx::Size(10, 10));
child->SetContentBounds(gfx::Size(10, 10));
@@ -2231,14 +2231,14 @@ TEST_F(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface)
root->SetOpacity(0.7f);
root->AddChild(child.Pass());
- m_hostImpl->activeTree()->SetRootLayer(root.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(root.Pass());
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- EXPECT_EQ(1u, frame.renderSurfaceLayerList->size());
- EXPECT_EQ(1u, frame.renderPasses.size());
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ EXPECT_EQ(1u, frame.render_surface_layer_list->size());
+ EXPECT_EQ(1u, frame.render_passes.size());
+ m_hostImpl->DidDrawAllLayers(frame);
}
class FakeLayerWithQuads : public LayerImpl {
@@ -2360,28 +2360,28 @@ TEST_F(LayerTreeHostImplTest, noPartialSwap)
// Run test case
createLayerTreeHost(false, outputSurface.Pass());
- setupRootLayerImpl(FakeLayerWithQuads::Create(m_hostImpl->activeTree(), 1));
+ setupRootLayerImpl(FakeLayerWithQuads::Create(m_hostImpl->active_tree(), 1));
// without partial swap, and no clipping, no scissor is set.
harness.mustDrawSolidQuad();
harness.mustSetNoScissor();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
Mock::VerifyAndClearExpectations(&mockContext);
// without partial swap, but a layer does clip its subtree, one scissor is set.
- m_hostImpl->rootLayer()->SetMasksToBounds(true);
+ m_hostImpl->active_tree()->root_layer()->SetMasksToBounds(true);
harness.mustDrawSolidQuad();
harness.mustSetScissor(0, 0, 10, 10);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
Mock::VerifyAndClearExpectations(&mockContext);
}
@@ -2393,30 +2393,30 @@ TEST_F(LayerTreeHostImplTest, partialSwap)
MockContextHarness harness(mockContext);
createLayerTreeHost(true, outputSurface.Pass());
- setupRootLayerImpl(FakeLayerWithQuads::Create(m_hostImpl->activeTree(), 1));
+ setupRootLayerImpl(FakeLayerWithQuads::Create(m_hostImpl->active_tree(), 1));
// The first frame is not a partially-swapped one.
harness.mustSetScissor(0, 0, 10, 10);
harness.mustDrawSolidQuad();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
Mock::VerifyAndClearExpectations(&mockContext);
// Damage a portion of the frame.
- m_hostImpl->rootLayer()->set_update_rect(gfx::Rect(0, 0, 2, 3));
+ m_hostImpl->active_tree()->root_layer()->set_update_rect(gfx::Rect(0, 0, 2, 3));
// The second frame will be partially-swapped (the y coordinates are flipped).
harness.mustSetScissor(0, 7, 2, 3);
harness.mustDrawSolidQuad();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
Mock::VerifyAndClearExpectations(&mockContext);
}
@@ -2449,9 +2449,9 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
LayerTreeSettings settings;
settings.partialSwapEnabled = partialSwap;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client, proxy);
- myHostImpl->initializeRenderer(outputSurface.Pass());
- myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, client, proxy);
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
+ myHostImpl->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
/*
Layers are created as follows:
@@ -2471,9 +2471,9 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
Layers 1, 2 have render surfaces
*/
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
- scoped_ptr<LayerImpl> child = LayerImpl::Create(myHostImpl->activeTree(), 2);
- scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::Create(myHostImpl->activeTree(), 3);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
+ scoped_ptr<LayerImpl> child = LayerImpl::Create(myHostImpl->active_tree(), 2);
+ scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::Create(myHostImpl->active_tree(), 3);
gfx::Rect rootRect(0, 0, 100, 100);
gfx::Rect childRect(10, 10, 50, 50);
@@ -2507,7 +2507,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
child->AddChild(grandChild.Pass());
root->AddChild(child.Pass());
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
return myHostImpl.Pass();
}
@@ -2517,17 +2517,17 @@ TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorPartialSwap)
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Verify all quads have been computed
- ASSERT_EQ(2U, frame.renderPasses.size());
- ASSERT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(1U, frame.renderPasses[1]->quad_list.size());
- EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.renderPasses[0]->quad_list[0]->material);
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
-
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ ASSERT_EQ(2U, frame.render_passes.size());
+ ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
+ EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->material);
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -2537,17 +2537,17 @@ TEST_F(LayerTreeHostImplTest, contributingLayerEmptyScissorNoPartialSwap)
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Verify all quads have been computed
- ASSERT_EQ(2U, frame.renderPasses.size());
- ASSERT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(1U, frame.renderPasses[1]->quad_list.size());
- EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.renderPasses[0]->quad_list[0]->material);
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
-
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ ASSERT_EQ(2U, frame.render_passes.size());
+ ASSERT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(1U, frame.render_passes[1]->quad_list.size());
+ EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->material);
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -2613,9 +2613,9 @@ TEST_F(LayerTreeHostImplTest, layersFreeTextures)
TestWebGraphicsContext3D* context3d = context.get();
scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(
context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
- m_hostImpl->initializeRenderer(outputSurface.Pass());
+ m_hostImpl->InitializeRenderer(outputSurface.Pass());
- scoped_ptr<LayerImpl> rootLayer(LayerImpl::Create(m_hostImpl->activeTree(), 1));
+ scoped_ptr<LayerImpl> rootLayer(LayerImpl::Create(m_hostImpl->active_tree(), 1));
rootLayer->SetBounds(gfx::Size(10, 10));
rootLayer->SetAnchorPoint(gfx::PointF());
@@ -2623,14 +2623,14 @@ TEST_F(LayerTreeHostImplTest, layersFreeTextures)
gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()));
FakeVideoFrameProvider provider;
provider.set_frame(softwareFrame);
- scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::Create(m_hostImpl->activeTree(), 4, &provider);
+ scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::Create(m_hostImpl->active_tree(), 4, &provider);
videoLayer->SetBounds(gfx::Size(10, 10));
videoLayer->SetAnchorPoint(gfx::PointF(0, 0));
videoLayer->SetContentBounds(gfx::Size(10, 10));
videoLayer->SetDrawsContent(true);
rootLayer->AddChild(videoLayer.PassAs<LayerImpl>());
- scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::Create(m_hostImpl->activeTree(), 5);
+ scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::Create(m_hostImpl->active_tree(), 5);
ioSurfaceLayer->SetBounds(gfx::Size(10, 10));
ioSurfaceLayer->SetAnchorPoint(gfx::PointF(0, 0));
ioSurfaceLayer->SetContentBounds(gfx::Size(10, 10));
@@ -2638,20 +2638,20 @@ TEST_F(LayerTreeHostImplTest, layersFreeTextures)
ioSurfaceLayer->setIOSurfaceProperties(1, gfx::Size(10, 10));
rootLayer->AddChild(ioSurfaceLayer.PassAs<LayerImpl>());
- m_hostImpl->activeTree()->SetRootLayer(rootLayer.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(rootLayer.Pass());
EXPECT_EQ(0u, context3d->NumTextures());
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
- m_hostImpl->swapBuffers();
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
+ m_hostImpl->SwapBuffers();
EXPECT_GT(context3d->NumTextures(), 0u);
// Kill the layer tree.
- m_hostImpl->activeTree()->SetRootLayer(LayerImpl::Create(m_hostImpl->activeTree(), 100));
+ m_hostImpl->active_tree()->SetRootLayer(LayerImpl::Create(m_hostImpl->active_tree(), 100));
// There should be no textures left in use after.
EXPECT_EQ(0u, context3d->NumTextures());
}
@@ -2669,26 +2669,26 @@ TEST_F(LayerTreeHostImplTest, hasTransparentBackground)
// Run test case
createLayerTreeHost(false, outputSurface.Pass());
- setupRootLayerImpl(LayerImpl::Create(m_hostImpl->activeTree(), 1));
- m_hostImpl->activeTree()->set_background_color(SK_ColorWHITE);
+ setupRootLayerImpl(LayerImpl::Create(m_hostImpl->active_tree(), 1));
+ m_hostImpl->active_tree()->set_background_color(SK_ColorWHITE);
// Verify one quad is drawn when transparent background set is not set.
- m_hostImpl->activeTree()->set_has_transparent_background(false);
+ m_hostImpl->active_tree()->set_has_transparent_background(false);
EXPECT_CALL(*mockContext, useProgram(_))
.Times(1);
EXPECT_CALL(*mockContext, drawElements(_, _, _, _))
.Times(1);
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
Mock::VerifyAndClearExpectations(&mockContext);
// Verify no quads are drawn when transparent background is set.
- m_hostImpl->activeTree()->set_has_transparent_background(true);
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->active_tree()->set_has_transparent_background(true);
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
Mock::VerifyAndClearExpectations(&mockContext);
}
@@ -2711,10 +2711,10 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L
{
scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
- layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
- layerTreeHostImpl->setViewportSize(rootSize, rootSize);
+ layerTreeHostImpl->InitializeRenderer(outputSurface.Pass());
+ layerTreeHostImpl->SetViewportSize(rootSize, rootSize);
- scoped_ptr<LayerImpl> root = LayerImpl::Create(layerTreeHostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(layerTreeHostImpl->active_tree(), 1);
rootPtr = root.get();
root->SetAnchorPoint(gfx::PointF(0, 0));
@@ -2722,7 +2722,7 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L
root->SetBounds(rootSize);
root->SetContentBounds(rootSize);
root->SetDrawsContent(true);
- layerTreeHostImpl->activeTree()->SetRootLayer(root.Pass());
+ layerTreeHostImpl->active_tree()->SetRootLayer(root.Pass());
addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr);
intermediateLayerPtr->SetDrawsContent(false); // only children draw content
@@ -2748,7 +2748,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
// Layers are structure as follows:
//
@@ -2772,10 +2772,10 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
gfx::Size rootSize(1000, 1000);
- myHostImpl->initializeRenderer(outputSurface.Pass());
- myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
+ myHostImpl->SetViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
rootPtr = root.get();
root->SetAnchorPoint(gfx::PointF(0, 0));
@@ -2784,7 +2784,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
root->SetContentBounds(rootSize);
root->SetDrawsContent(true);
root->SetMasksToBounds(true);
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
addDrawingLayerTo(rootPtr, 2, gfx::Rect(300, 300, 300, 300), &layerS1Ptr);
layerS1Ptr->SetForceRenderSurface(true);
@@ -2800,18 +2800,18 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
// Initial draw - must receive all quads
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 3 render passes.
// For Root, there are 2 quads; for S1, there are 2 quads (1 is occluded); for S2, there is 2 quads.
- ASSERT_EQ(3U, frame.renderPasses.size());
+ ASSERT_EQ(3U, frame.render_passes.size());
- EXPECT_EQ(2U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[1]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[2]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[1]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[2]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Unocclude" surface S1 and repeat draw.
@@ -2822,19 +2822,19 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 2 render passes.
// For Root, there are 2 quads
// For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive.
// For S2, there is no render pass
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_GT(frame.renderPasses[0]->quad_list.size(), 0U);
- EXPECT_EQ(2U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_GT(frame.render_passes[0]->quad_list.size(), 0U);
+ EXPECT_EQ(2U, frame.render_passes[1]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Re-occlude" surface S1 and repeat draw.
@@ -2845,15 +2845,15 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusion)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 1 render pass - for the root.
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(2U, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[0]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -2863,7 +2863,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
// Layers are structure as follows:
//
@@ -2884,10 +2884,10 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
gfx::Size rootSize(1000, 1000);
- myHostImpl->initializeRenderer(outputSurface.Pass());
- myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
+ myHostImpl->SetViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
rootPtr = root.get();
root->SetAnchorPoint(gfx::PointF(0, 0));
@@ -2896,7 +2896,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
root->SetContentBounds(rootSize);
root->SetDrawsContent(true);
root->SetMasksToBounds(true);
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 800, 800), &layerS1Ptr);
layerS1Ptr->SetForceRenderSurface(true);
@@ -2914,20 +2914,20 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
// Initial draw - must receive all quads
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 3 render passes.
// For Root, there are 2 quads; for S1, there are 3 quads; for S2, there is 1 quad.
- ASSERT_EQ(3U, frame.renderPasses.size());
+ ASSERT_EQ(3U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
// L14 is culled, so only 3 quads.
- EXPECT_EQ(3U, frame.renderPasses[1]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[2]->quad_list.size());
+ EXPECT_EQ(3U, frame.render_passes[1]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[2]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Unocclude" surface S1 and repeat draw.
@@ -2938,19 +2938,19 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 2 render passes.
// For Root, there are 2 quads
// For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive.
// For S2, there is no render pass
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_GT(frame.renderPasses[0]->quad_list.size(), 0U);
- EXPECT_EQ(2U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_GT(frame.render_passes[0]->quad_list.size(), 0U);
+ EXPECT_EQ(2U, frame.render_passes[1]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Re-occlude" surface S1 and repeat draw.
@@ -2961,15 +2961,15 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 1 render pass - for the root.
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(2U, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[0]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -2978,7 +2978,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
// Layers are structured as follows:
//
@@ -2997,10 +2997,10 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
gfx::Size rootSize(1000, 1000);
- myHostImpl->initializeRenderer(outputSurface.Pass());
- myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
+ myHostImpl->SetViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
rootPtr = root.get();
root->SetAnchorPoint(gfx::PointF(0, 0));
@@ -3009,7 +3009,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
root->SetContentBounds(rootSize);
root->SetDrawsContent(true);
root->SetMasksToBounds(true);
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 400, 400), &layerS1Ptr);
layerS1Ptr->SetForceRenderSurface(true);
@@ -3023,18 +3023,18 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
// Initial draw - must receive all quads
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 3 render passes.
// For Root, there are 2 quads; for S1, there are 3 quads; for S2, there is 1 quad.
- ASSERT_EQ(3U, frame.renderPasses.size());
+ ASSERT_EQ(3U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(3U, frame.renderPasses[1]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[2]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(3U, frame.render_passes[1]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[2]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Unocclude" surface S1 and repeat draw.
@@ -3045,19 +3045,19 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 2 render passes.
// For Root, there are 2 quads
// For S1, the number of quads depends on what got unoccluded, so not asserted beyond being positive.
// For S2, there is no render pass
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_GT(frame.renderPasses[0]->quad_list.size(), 0U);
- EXPECT_EQ(2U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_GT(frame.render_passes[0]->quad_list.size(), 0U);
+ EXPECT_EQ(2U, frame.render_passes[1]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -3065,7 +3065,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
{
LayerTreeSettings settings;
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
// Layers are structured as follows:
//
@@ -3079,10 +3079,10 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
gfx::Size rootSize(1000, 1000);
- myHostImpl->initializeRenderer(outputSurface.Pass());
- myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
+ myHostImpl->SetViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
rootPtr = root.get();
root->SetAnchorPoint(gfx::PointF(0, 0));
@@ -3091,7 +3091,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
root->SetContentBounds(rootSize);
root->SetDrawsContent(true);
root->SetMasksToBounds(true);
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 400, 400), &layerS1Ptr);
layerS1Ptr->SetForceRenderSurface(true);
@@ -3106,31 +3106,31 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
// Initial draw - must receive all quads
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 2 render passes.
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_EQ(2U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(1U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[1]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change opacity and draw. Verify we used cached texture.
layerS1Ptr->SetOpacity(0.2f);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// One render pass must be gone due to cached texture.
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -3140,7 +3140,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.partialSwapEnabled = true;
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
// Layers are structure as follows:
//
@@ -3164,10 +3164,10 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
gfx::Size rootSize(1000, 1000);
- myHostImpl->initializeRenderer(outputSurface.Pass());
- myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
+ myHostImpl->SetViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
rootPtr = root.get();
root->SetAnchorPoint(gfx::PointF(0, 0));
@@ -3176,7 +3176,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
root->SetContentBounds(rootSize);
root->SetDrawsContent(true);
root->SetMasksToBounds(true);
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
addDrawingLayerTo(rootPtr, 2, gfx::Rect(300, 300, 300, 300), &layerS1Ptr);
layerS1Ptr->SetForceRenderSurface(true);
@@ -3192,18 +3192,18 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
// Initial draw - must receive all quads
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 3 render passes.
// For Root, there are 2 quads; for S1, there are 2 quads (one is occluded); for S2, there is 2 quads.
- ASSERT_EQ(3U, frame.renderPasses.size());
+ ASSERT_EQ(3U, frame.render_passes.size());
- EXPECT_EQ(2U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[1]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[2]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[1]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[2]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Unocclude" surface S1 and repeat draw.
@@ -3214,19 +3214,19 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive 2 render passes.
// For Root, there are 2 quads.
// For S1, there are 2 quads.
// For S2, there is no render pass
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_EQ(2U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(2U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(2U, frame.render_passes[1]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// "Re-occlude" surface S1 and repeat draw.
@@ -3237,13 +3237,13 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
layerS2Ptr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Root render pass only.
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -3252,7 +3252,7 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithScissor)
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
/*
Layers are created as follows:
@@ -3272,16 +3272,16 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithScissor)
Layers 1, 2 have render surfaces
*/
- scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->activeTree(), 1);
- scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::Create(myHostImpl->activeTree(), 2);
- scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(myHostImpl->activeTree(), 3);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(myHostImpl->active_tree(), 1);
+ scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::Create(myHostImpl->active_tree(), 2);
+ scoped_ptr<LayerImpl> grandChild = LayerImpl::Create(myHostImpl->active_tree(), 3);
gfx::Rect rootRect(0, 0, 100, 100);
gfx::Rect childRect(10, 10, 50, 50);
gfx::Rect grandChildRect(5, 5, 150, 150);
scoped_ptr<OutputSurface> outputSurface = FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<OutputSurface>();
- myHostImpl->initializeRenderer(outputSurface.Pass());
+ myHostImpl->InitializeRenderer(outputSurface.Pass());
root->SetAnchorPoint(gfx::PointF(0, 0));
root->SetPosition(gfx::PointF(rootRect.x(), rootRect.y()));
@@ -3314,16 +3314,16 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithScissor)
child->AddChild(grandChild.Pass());
root->AddChild(child.PassAs<LayerImpl>());
- myHostImpl->activeTree()->SetRootLayer(root.Pass());
- myHostImpl->setViewportSize(rootRect.size(), rootRect.size());
+ myHostImpl->active_tree()->SetRootLayer(root.Pass());
+ myHostImpl->SetViewportSize(rootRect.size(), rootRect.size());
EXPECT_FALSE(myHostImpl->renderer()->HaveCachedResourcesForRenderPassId(childPassId));
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// We should have cached textures for surface 2.
@@ -3331,9 +3331,9 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithScissor)
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// We should still have cached textures for surface 2 after drawing with no damage.
@@ -3344,9 +3344,9 @@ TEST_F(LayerTreeHostImplTest, textureCachingWithScissor)
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// We should have a cached texture for surface 2 again even though it was damaged.
@@ -3359,7 +3359,7 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCaching)
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.partialSwapEnabled = true;
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
LayerImpl* rootPtr;
LayerImpl* intermediateLayerPtr;
@@ -3370,78 +3370,78 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCaching)
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive two render passes, each with one quad
- ASSERT_EQ(2U, frame.renderPasses.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(1U, frame.renderPasses[1]->quad_list.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[1]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[1]->quad_list[0]);
- RenderPass* targetPass = frame.renderPassesById[quad->render_pass_id];
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[1]->quad_list[0]);
+ RenderPass* targetPass = frame.render_passes_by_id[quad->render_pass_id];
ASSERT_TRUE(targetPass);
EXPECT_FALSE(targetPass->damage_rect.IsEmpty());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Draw without any change
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive one render pass, as the other one should be culled
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
- EXPECT_TRUE(frame.renderPassesById.find(quad->render_pass_id) == frame.renderPassesById.end());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
+ EXPECT_TRUE(frame.render_passes_by_id.find(quad->render_pass_id) == frame.render_passes_by_id.end());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change opacity and draw
surfaceLayerPtr->SetOpacity(0.6f);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive one render pass, as the other one should be culled
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
- EXPECT_TRUE(frame.renderPassesById.find(quad->render_pass_id) == frame.renderPassesById.end());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
+ EXPECT_TRUE(frame.render_passes_by_id.find(quad->render_pass_id) == frame.render_passes_by_id.end());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change less benign property and draw - should have contents changed flag
surfaceLayerPtr->SetStackingOrderChanged(true);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive two render passes, each with one quad
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.renderPasses[0]->quad_list[0]->material);
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->material);
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[1]->quad_list[0]);
- RenderPass* targetPass = frame.renderPassesById[quad->render_pass_id];
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[1]->quad_list[0]);
+ RenderPass* targetPass = frame.render_passes_by_id[quad->render_pass_id];
ASSERT_TRUE(targetPass);
EXPECT_FALSE(targetPass->damage_rect.IsEmpty());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change opacity again, and evict the cached surface texture.
@@ -3452,44 +3452,44 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCaching)
surfaceLayerPtr->SetOpacity(0.6f);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive two render passes
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
// Even though not enough properties changed, the entire thing must be
// redrawn as we don't have cached textures
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(1U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[1]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[1]->quad_list[0]);
- RenderPass* targetPass = frame.renderPassesById[quad->render_pass_id];
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[1]->quad_list[0]);
+ RenderPass* targetPass = frame.render_passes_by_id[quad->render_pass_id];
ASSERT_TRUE(targetPass);
EXPECT_TRUE(targetPass->damage_rect.IsEmpty());
// Was our surface evicted?
EXPECT_FALSE(myHostImpl->renderer()->HaveCachedResourcesForRenderPassId(targetPass->id));
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Draw without any change, to make sure the state is clear
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive one render pass, as the other one should be culled
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
- EXPECT_TRUE(frame.renderPassesById.find(quad->render_pass_id) == frame.renderPassesById.end());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
+ EXPECT_TRUE(frame.render_passes_by_id.find(quad->render_pass_id) == frame.render_passes_by_id.end());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change location of the intermediate layer
@@ -3498,18 +3498,18 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCaching)
intermediateLayerPtr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive one render pass, as the other one should be culled.
- ASSERT_EQ(1U, frame.renderPasses.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
- EXPECT_TRUE(frame.renderPassesById.find(quad->render_pass_id) == frame.renderPassesById.end());
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
+ EXPECT_TRUE(frame.render_passes_by_id.find(quad->render_pass_id) == frame.render_passes_by_id.end());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -3518,7 +3518,7 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
settings.cacheRenderPassContents = true;
- scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
+ scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::Create(settings, this, &m_proxy);
LayerImpl* rootPtr;
LayerImpl* intermediateLayerPtr;
@@ -3529,83 +3529,83 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive two render passes, each with one quad
- ASSERT_EQ(2U, frame.renderPasses.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(1U, frame.renderPasses[1]->quad_list.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[1]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[1]->quad_list[0]);
- RenderPass* targetPass = frame.renderPassesById[quad->render_pass_id];
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[1]->quad_list[0]);
+ RenderPass* targetPass = frame.render_passes_by_id[quad->render_pass_id];
EXPECT_FALSE(targetPass->damage_rect.IsEmpty());
- EXPECT_FALSE(frame.renderPasses[0]->damage_rect.IsEmpty());
- EXPECT_FALSE(frame.renderPasses[1]->damage_rect.IsEmpty());
+ EXPECT_FALSE(frame.render_passes[0]->damage_rect.IsEmpty());
+ EXPECT_FALSE(frame.render_passes[1]->damage_rect.IsEmpty());
- EXPECT_FALSE(frame.renderPasses[0]->has_occlusion_from_outside_target_surface);
- EXPECT_FALSE(frame.renderPasses[1]->has_occlusion_from_outside_target_surface);
+ EXPECT_FALSE(frame.render_passes[0]->has_occlusion_from_outside_target_surface);
+ EXPECT_FALSE(frame.render_passes[1]->has_occlusion_from_outside_target_surface);
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Draw without any change
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Even though there was no change, we set the damage to entire viewport.
// One of the passes should be culled as a result, since contents didn't change
// and we have cached texture.
- ASSERT_EQ(1U, frame.renderPasses.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
- EXPECT_TRUE(frame.renderPasses[0]->damage_rect.IsEmpty());
+ EXPECT_TRUE(frame.render_passes[0]->damage_rect.IsEmpty());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change opacity and draw
surfaceLayerPtr->SetOpacity(0.6f);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive one render pass, as the other one should be culled
- ASSERT_EQ(1U, frame.renderPasses.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
- EXPECT_TRUE(frame.renderPassesById.find(quad->render_pass_id) == frame.renderPassesById.end());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
+ EXPECT_TRUE(frame.render_passes_by_id.find(quad->render_pass_id) == frame.render_passes_by_id.end());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change less benign property and draw - should have contents changed flag
surfaceLayerPtr->SetStackingOrderChanged(true);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive two render passes, each with one quad
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.renderPasses[0]->quad_list[0]->material);
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.render_passes[0]->quad_list[0]->material);
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[1]->quad_list[0]);
- RenderPass* targetPass = frame.renderPassesById[quad->render_pass_id];
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[1]->quad_list[0]);
+ RenderPass* targetPass = frame.render_passes_by_id[quad->render_pass_id];
ASSERT_TRUE(targetPass);
EXPECT_FALSE(targetPass->damage_rect.IsEmpty());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change opacity again, and evict the cached surface texture.
@@ -3616,42 +3616,42 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
surfaceLayerPtr->SetOpacity(0.6f);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive two render passes
- ASSERT_EQ(2U, frame.renderPasses.size());
+ ASSERT_EQ(2U, frame.render_passes.size());
// Even though not enough properties changed, the entire thing must be
// redrawn as we don't have cached textures
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
- EXPECT_EQ(1U, frame.renderPasses[1]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
+ EXPECT_EQ(1U, frame.render_passes[1]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[1]->quad_list[0]);
- RenderPass* targetPass = frame.renderPassesById[quad->render_pass_id];
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[1]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[1]->quad_list[0]);
+ RenderPass* targetPass = frame.render_passes_by_id[quad->render_pass_id];
ASSERT_TRUE(targetPass);
EXPECT_TRUE(targetPass->damage_rect.IsEmpty());
// Was our surface evicted?
EXPECT_FALSE(myHostImpl->renderer()->HaveCachedResourcesForRenderPassId(targetPass->id));
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Draw without any change, to make sure the state is clear
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Even though there was no change, we set the damage to entire viewport.
// One of the passes should be culled as a result, since contents didn't change
// and we have cached texture.
- ASSERT_EQ(1U, frame.renderPasses.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
// Change location of the intermediate layer
@@ -3660,18 +3660,18 @@ TEST_F(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
intermediateLayerPtr->SetTransform(transform);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(myHostImpl->PrepareToDraw(&frame));
// Must receive one render pass, as the other one should be culled.
- ASSERT_EQ(1U, frame.renderPasses.size());
- EXPECT_EQ(1U, frame.renderPasses[0]->quad_list.size());
+ ASSERT_EQ(1U, frame.render_passes.size());
+ EXPECT_EQ(1U, frame.render_passes[0]->quad_list.size());
- EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
- EXPECT_TRUE(frame.renderPassesById.find(quad->render_pass_id) == frame.renderPassesById.end());
+ EXPECT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
+ EXPECT_TRUE(frame.render_passes_by_id.find(quad->render_pass_id) == frame.render_passes_by_id.end());
- myHostImpl->drawLayers(frame);
- myHostImpl->didDrawAllLayers(frame);
+ myHostImpl->DrawLayers(&frame);
+ myHostImpl->DidDrawAllLayers(frame);
}
}
@@ -3684,7 +3684,7 @@ TEST_F(LayerTreeHostImplTest, releaseContentsTextureShouldTriggerCommit)
// drawing something different than before.
setReduceMemoryResult(false);
m_hostImpl->SetManagedMemoryPolicy(ManagedMemoryPolicy(
- m_hostImpl->memoryAllocationLimitBytes() - 1));
+ m_hostImpl->memory_allocation_limit_bytes() - 1));
EXPECT_TRUE(m_didRequestCommit);
m_didRequestCommit = false;
@@ -3692,14 +3692,14 @@ TEST_F(LayerTreeHostImplTest, releaseContentsTextureShouldTriggerCommit)
// to re-commit.
setReduceMemoryResult(true);
m_hostImpl->SetManagedMemoryPolicy(ManagedMemoryPolicy(
- m_hostImpl->memoryAllocationLimitBytes() - 1));
+ m_hostImpl->memory_allocation_limit_bytes() - 1));
EXPECT_TRUE(m_didRequestCommit);
m_didRequestCommit = false;
// But if we set it to the same value that it was before, we shouldn't
// re-commit.
m_hostImpl->SetManagedMemoryPolicy(ManagedMemoryPolicy(
- m_hostImpl->memoryAllocationLimitBytes()));
+ m_hostImpl->memory_allocation_limit_bytes()));
EXPECT_FALSE(m_didRequestCommit);
}
@@ -3830,8 +3830,8 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
renderPass->AppendQuad(quad.PassAs<DrawQuad>());
}
}
- testData.renderPassesById[renderPassId] = renderPass.get();
- testData.renderPasses.insert(testData.renderPasses.begin(), renderPass.PassAs<RenderPass>());
+ testData.render_passes_by_id[renderPassId] = renderPass.get();
+ testData.render_passes.insert(testData.render_passes.begin(), renderPass.PassAs<RenderPass>());
if (*currentChar)
currentChar++;
}
@@ -3840,7 +3840,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buffer)
{
char* pos = buffer;
- for (RenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) {
+ for (RenderPassList::const_reverse_iterator it = testData.render_passes.rbegin(); it != testData.render_passes.rend(); ++it) {
const RenderPass* currentPass = *it;
*pos = currentPass->id.layer_id;
pos++;
@@ -4035,7 +4035,7 @@ TEST_F(LayerTreeHostImplTest, testRemoveRenderPasses)
while (removeRenderPassesCases[testCaseIndex].name) {
RenderPassRemovalTestData testData;
configureRenderPassTestData(removeRenderPassesCases[testCaseIndex].initScript, testData, renderer.get());
- LayerTreeHostImpl::removeRenderPasses(LayerTreeHostImpl::CullRenderPassesWithCachedTextures(*renderer), testData);
+ LayerTreeHostImpl::RemoveRenderPasses(LayerTreeHostImpl::CullRenderPassesWithCachedTextures(*renderer), &testData);
verifyRenderPassTestData(removeRenderPassesCases[testCaseIndex], testData);
testCaseIndex++;
}
@@ -4052,35 +4052,35 @@ protected:
void drawFrameAndTestDamage(const gfx::RectF& expectedDamage) {
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
+ ASSERT_EQ(1u, frame.render_passes.size());
// Verify the damage rect for the root render pass.
- const RenderPass* rootRenderPass = frame.renderPasses.back();
+ const RenderPass* rootRenderPass = frame.render_passes.back();
EXPECT_RECT_EQ(expectedDamage, rootRenderPass->damage_rect);
// Verify the root layer's quad is generated and not being culled.
ASSERT_EQ(1u, rootRenderPass->quad_list.size());
- gfx::Rect expectedVisibleRect(m_hostImpl->rootLayer()->content_bounds());
+ gfx::Rect expectedVisibleRect(m_hostImpl->active_tree()->root_layer()->content_bounds());
EXPECT_RECT_EQ(expectedVisibleRect, rootRenderPass->quad_list[0]->visible_rect);
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
};
TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect)
{
- scoped_ptr<SolidColorLayerImpl> root = SolidColorLayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<SolidColorLayerImpl> root = SolidColorLayerImpl::Create(m_hostImpl->active_tree(), 1);
root->SetAnchorPoint(gfx::PointF(0.f, 0.f));
root->SetPosition(gfx::PointF(0.f, 0.f));
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
- m_hostImpl->activeTree()->SetRootLayer(root.PassAs<LayerImpl>());
+ m_hostImpl->active_tree()->SetRootLayer(root.PassAs<LayerImpl>());
// Draw a frame. In the first frame, the entire viewport should be damaged.
- gfx::Rect fullFrameDamage = gfx::Rect(m_hostImpl->DeviceViewportSize());
+ gfx::Rect fullFrameDamage = gfx::Rect(m_hostImpl->device_viewport_size());
drawFrameAndTestDamage(fullFrameDamage);
// The second frame should have no damage, but the quads should still be generated.
@@ -4109,19 +4109,19 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithScaling)
// |
// +-- Content Layer
// +--Mask
- scoped_ptr<LayerImpl> scopedRoot = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> scopedRoot = LayerImpl::Create(m_hostImpl->active_tree(), 1);
LayerImpl* root = scopedRoot.get();
- m_hostImpl->activeTree()->SetRootLayer(scopedRoot.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(scopedRoot.Pass());
- scoped_ptr<LayerImpl> scopedScalingLayer = LayerImpl::Create(m_hostImpl->activeTree(), 2);
+ scoped_ptr<LayerImpl> scopedScalingLayer = LayerImpl::Create(m_hostImpl->active_tree(), 2);
LayerImpl* scalingLayer = scopedScalingLayer.get();
root->AddChild(scopedScalingLayer.Pass());
- scoped_ptr<LayerImpl> scopedContentLayer = LayerImpl::Create(m_hostImpl->activeTree(), 3);
+ scoped_ptr<LayerImpl> scopedContentLayer = LayerImpl::Create(m_hostImpl->active_tree(), 3);
LayerImpl* contentLayer = scopedContentLayer.get();
scalingLayer->AddChild(scopedContentLayer.Pass());
- scoped_ptr<FakeMaskLayerImpl> scopedMaskLayer = FakeMaskLayerImpl::Create(m_hostImpl->activeTree(), 4);
+ scoped_ptr<FakeMaskLayerImpl> scopedMaskLayer = FakeMaskLayerImpl::Create(m_hostImpl->active_tree(), 4);
FakeMaskLayerImpl* maskLayer = scopedMaskLayer.get();
contentLayer->SetMaskLayer(scopedMaskLayer.PassAs<LayerImpl>());
@@ -4156,21 +4156,21 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithScaling)
// Check that the tree scaling is correctly taken into account for the mask,
// that should fully map onto the quad.
float deviceScaleFactor = 1.f;
- m_hostImpl->setViewportSize(rootSize, rootSize);
- m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
+ m_hostImpl->SetViewportSize(rootSize, rootSize);
+ m_hostImpl->SetDeviceScaleFactor(deviceScaleFactor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
@@ -4178,22 +4178,22 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithScaling)
// which part of the mask is used.
deviceScaleFactor = 2.f;
gfx::Size deviceViewport(gfx::ToFlooredSize(gfx::ScaleSize(rootSize, deviceScaleFactor)));
- m_hostImpl->setViewportSize(rootSize, deviceViewport);
- m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->SetViewportSize(rootSize, deviceViewport);
+ m_hostImpl->SetDeviceScaleFactor(deviceScaleFactor);
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
@@ -4204,20 +4204,20 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithScaling)
contentLayer->SetContentsScale(deviceScaleFactor, deviceScaleFactor);
maskLayer->SetContentBounds(contentsBounds);
maskLayer->SetContentsScale(deviceScaleFactor, deviceScaleFactor);
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 200, 200).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
}
@@ -4225,15 +4225,15 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithDifferentBounds)
{
// The mask layer has bounds 100x100 but is attached to a layer with bounds 50x50.
- scoped_ptr<LayerImpl> scopedRoot = LayerImpl::Create(m_hostImpl->activeTree(), 1);
+ scoped_ptr<LayerImpl> scopedRoot = LayerImpl::Create(m_hostImpl->active_tree(), 1);
LayerImpl* root = scopedRoot.get();
- m_hostImpl->activeTree()->SetRootLayer(scopedRoot.Pass());
+ m_hostImpl->active_tree()->SetRootLayer(scopedRoot.Pass());
- scoped_ptr<LayerImpl> scopedContentLayer = LayerImpl::Create(m_hostImpl->activeTree(), 3);
+ scoped_ptr<LayerImpl> scopedContentLayer = LayerImpl::Create(m_hostImpl->active_tree(), 3);
LayerImpl* contentLayer = scopedContentLayer.get();
root->AddChild(scopedContentLayer.Pass());
- scoped_ptr<FakeMaskLayerImpl> scopedMaskLayer = FakeMaskLayerImpl::Create(m_hostImpl->activeTree(), 4);
+ scoped_ptr<FakeMaskLayerImpl> scopedMaskLayer = FakeMaskLayerImpl::Create(m_hostImpl->active_tree(), 4);
FakeMaskLayerImpl* maskLayer = scopedMaskLayer.get();
contentLayer->SetMaskLayer(scopedMaskLayer.PassAs<LayerImpl>());
@@ -4260,21 +4260,21 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithDifferentBounds)
// Check that the mask fills the surface.
float deviceScaleFactor = 1.f;
- m_hostImpl->setViewportSize(rootSize, rootSize);
- m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
+ m_hostImpl->SetViewportSize(rootSize, rootSize);
+ m_hostImpl->SetDeviceScaleFactor(deviceScaleFactor);
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
@@ -4282,22 +4282,22 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithDifferentBounds)
// which part of the mask is used.
deviceScaleFactor = 2.f;
gfx::Size deviceViewport(gfx::ToFlooredSize(gfx::ScaleSize(rootSize, deviceScaleFactor)));
- m_hostImpl->setViewportSize(rootSize, deviceViewport);
- m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->SetViewportSize(rootSize, deviceViewport);
+ m_hostImpl->SetDeviceScaleFactor(deviceScaleFactor);
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
@@ -4309,40 +4309,40 @@ TEST_F(LayerTreeHostImplTest, maskLayerWithDifferentBounds)
gfx::Size maskSizeLarge(gfx::ToRoundedSize(gfx::ScaleSize(maskSize, deviceScaleFactor)));
maskLayer->SetContentBounds(maskSizeLarge);
maskLayer->SetContentsScale(deviceScaleFactor, deviceScaleFactor);
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
// Applying a different contents scale to the mask layer will still result
// in the mask covering the owning layer.
maskLayer->SetContentBounds(maskSize);
maskLayer->SetContentsScale(deviceScaleFactor, deviceScaleFactor);
- m_hostImpl->activeTree()->set_needs_update_draw_properties();
+ m_hostImpl->active_tree()->set_needs_update_draw_properties();
{
LayerTreeHostImpl::FrameData frame;
- EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+ EXPECT_TRUE(m_hostImpl->PrepareToDraw(&frame));
- ASSERT_EQ(1u, frame.renderPasses.size());
- ASSERT_EQ(1u, frame.renderPasses[0]->quad_list.size());
- ASSERT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quad_list[0]->material);
- const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.renderPasses[0]->quad_list[0]);
+ ASSERT_EQ(1u, frame.render_passes.size());
+ ASSERT_EQ(1u, frame.render_passes[0]->quad_list.size());
+ ASSERT_EQ(DrawQuad::RENDER_PASS, frame.render_passes[0]->quad_list[0]->material);
+ const RenderPassDrawQuad* renderPassQuad = RenderPassDrawQuad::MaterialCast(frame.render_passes[0]->quad_list[0]);
EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), renderPassQuad->rect.ToString());
EXPECT_EQ(gfx::RectF(0.f, 0.f, 1.f, 1.f).ToString(), renderPassQuad->mask_uv_rect.ToString());
- m_hostImpl->drawLayers(frame);
- m_hostImpl->didDrawAllLayers(frame);
+ m_hostImpl->DrawLayers(&frame);
+ m_hostImpl->DidDrawAllLayers(frame);
}
}
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index ed6c727..a1c74c2 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -170,7 +170,7 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
m_numDraws++;
- if (!impl->activeTree()->source_frame_number())
+ if (!impl->active_tree()->source_frame_number())
endTest();
}
@@ -212,9 +212,9 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- if (impl->activeTree()->source_frame_number() == 0)
+ if (impl->active_tree()->source_frame_number() == 0)
postSetNeedsCommitToMainThread();
- else if (impl->activeTree()->source_frame_number() == 1)
+ else if (impl->active_tree()->source_frame_number() == 1)
endTest();
}
@@ -256,7 +256,7 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- EXPECT_EQ(0, impl->activeTree()->source_frame_number());
+ EXPECT_EQ(0, impl->active_tree()->source_frame_number());
if (!m_numDraws)
postSetNeedsRedrawToMainThread(); // Redraw again to verify that the second redraw doesn't commit.
else
@@ -428,8 +428,8 @@ public:
if (m_done)
return;
// Only the initial draw should bring us here.
- EXPECT_TRUE(impl->canDraw());
- EXPECT_EQ(0, impl->activeTree()->source_frame_number());
+ EXPECT_TRUE(impl->CanDraw());
+ EXPECT_EQ(0, impl->active_tree()->source_frame_number());
}
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
@@ -438,7 +438,7 @@ public:
return;
if (m_numCommits >= 1) {
// After the first commit, we should not be able to draw.
- EXPECT_FALSE(impl->canDraw());
+ EXPECT_FALSE(impl->CanDraw());
}
}
@@ -647,9 +647,9 @@ public:
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- EXPECT_EQ(gfx::Size(20, 20), impl->layoutViewportSize());
- EXPECT_EQ(SK_ColorGRAY, impl->activeTree()->background_color());
- EXPECT_EQ(5, impl->activeTree()->page_scale_factor());
+ EXPECT_EQ(gfx::Size(20, 20), impl->layout_viewport_size());
+ EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color());
+ EXPECT_EQ(5, impl->active_tree()->page_scale_factor());
endTest();
}
@@ -687,9 +687,9 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- impl->rootLayer()->SetScrollable(true);
- impl->rootLayer()->SetScrollOffset(gfx::Vector2d());
- impl->activeTree()->SetPageScaleFactorAndLimits(impl->activeTree()->page_scale_factor(), 0.5, 2);
+ impl->active_tree()->root_layer()->SetScrollable(true);
+ impl->active_tree()->root_layer()->SetScrollOffset(gfx::Vector2d());
+ impl->active_tree()->SetPageScaleFactorAndLimits(impl->active_tree()->page_scale_factor(), 0.5, 2);
// We request animation only once.
if (!m_animationRequested) {
@@ -707,10 +707,10 @@ public:
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- impl->processScrollDeltas();
+ impl->ProcessScrollDeltas();
// We get one commit before the first draw, and the animation doesn't happen until the second draw.
- if (impl->activeTree()->source_frame_number() == 1) {
- EXPECT_EQ(1.25, impl->activeTree()->page_scale_factor());
+ if (impl->active_tree()->source_frame_number() == 1) {
+ EXPECT_EQ(1.25, impl->active_tree()->page_scale_factor());
endTest();
} else
postSetNeedsRedrawToMainThread();
@@ -928,19 +928,19 @@ public:
MockLayerTreeHostImpl* mockImpl = static_cast<MockLayerTreeHostImpl*>(impl);
// Should only do one commit.
- EXPECT_EQ(0, impl->activeTree()->source_frame_number());
+ EXPECT_EQ(0, impl->active_tree()->source_frame_number());
// Device scale factor should come over to impl.
- EXPECT_NEAR(impl->deviceScaleFactor(), 1.5, 0.00001);
+ EXPECT_NEAR(impl->device_scale_factor(), 1.5, 0.00001);
// Both layers are on impl.
- ASSERT_EQ(1u, impl->rootLayer()->children().size());
+ ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size());
// Device viewport is scaled.
- EXPECT_EQ(gfx::Size(40, 40), impl->layoutViewportSize());
- EXPECT_EQ(gfx::Size(60, 60), impl->DeviceViewportSize());
+ EXPECT_EQ(gfx::Size(40, 40), impl->layout_viewport_size());
+ EXPECT_EQ(gfx::Size(60, 60), impl->device_viewport_size());
- LayerImpl* root = impl->rootLayer();
- LayerImpl* child = impl->rootLayer()->children()[0];
+ LayerImpl* root = impl->active_tree()->root_layer();
+ LayerImpl* child = impl->active_tree()->root_layer()->children()[0];
// Positions remain in layout pixels.
EXPECT_EQ(gfx::Point(0, 0), root->position());
@@ -948,11 +948,11 @@ public:
// Compute all the layer transforms for the frame.
LayerTreeHostImpl::FrameData frameData;
- mockImpl->prepareToDraw(frameData);
- mockImpl->didDrawAllLayers(frameData);
+ mockImpl->PrepareToDraw(&frameData);
+ mockImpl->DidDrawAllLayers(frameData);
const MockLayerTreeHostImpl::LayerList& renderSurfaceLayerList =
- *frameData.renderSurfaceLayerList;
+ *frameData.render_surface_layer_list;
// Both layers should be drawing into the root render surface.
ASSERT_EQ(1u, renderSurfaceLayerList.size());
@@ -967,7 +967,7 @@ public:
EXPECT_EQ(childBoundsScaled, child->content_bounds());
gfx::Transform scaleTransform;
- scaleTransform.Scale(impl->deviceScaleFactor(), impl->deviceScaleFactor());
+ scaleTransform.Scale(impl->device_scale_factor(), impl->device_scale_factor());
// The root layer is scaled by 2x.
gfx::Transform rootScreenSpaceTransform = scaleTransform;
@@ -1042,9 +1042,9 @@ public:
{
ASSERT_EQ(0u, m_layerTreeHost->settings().maxPartialTextureUpdates);
- TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->outputSurface()->context3d());
+ TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->output_surface()->context3d());
- switch (impl->activeTree()->source_frame_number()) {
+ switch (impl->active_tree()->source_frame_number()) {
case 0:
// Number of textures should be one for each layer
ASSERT_EQ(2, context->NumTextures());
@@ -1084,7 +1084,7 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->outputSurface()->context3d());
+ TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->output_surface()->context3d());
// Number of textures used for draw should always be one for each layer.
EXPECT_EQ(2, context->NumUsedTextures());
@@ -1174,9 +1174,9 @@ public:
{
ASSERT_EQ(1u, m_layerTreeHost->settings().maxPartialTextureUpdates);
- TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->outputSurface()->context3d());
+ TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->output_surface()->context3d());
- switch (impl->activeTree()->source_frame_number()) {
+ switch (impl->active_tree()->source_frame_number()) {
case 0:
// Number of textures should be one for each layer.
ASSERT_EQ(4, context->NumTextures());
@@ -1259,11 +1259,11 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->outputSurface()->context3d());
+ TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>(impl->output_surface()->context3d());
// Number of textures used for drawing should one per layer except for
// frame 3 where the viewport only contains one layer.
- if (impl->activeTree()->source_frame_number() == 3)
+ if (impl->active_tree()->source_frame_number() == 3)
EXPECT_EQ(1, context->NumUsedTextures());
else
EXPECT_EQ(4, context->NumUsedTextures());
@@ -1437,10 +1437,10 @@ public:
virtual void drawLayersOnThread(LayerTreeHostImpl* hostImpl) OVERRIDE
{
Renderer* renderer = hostImpl->renderer();
- RenderPass::Id surface1RenderPassId = hostImpl->rootLayer()->children()[0]->render_surface()->RenderPassId();
- RenderPass::Id surface2RenderPassId = hostImpl->rootLayer()->children()[0]->children()[0]->render_surface()->RenderPassId();
+ RenderPass::Id surface1RenderPassId = hostImpl->active_tree()->root_layer()->children()[0]->render_surface()->RenderPassId();
+ RenderPass::Id surface2RenderPassId = hostImpl->active_tree()->root_layer()->children()[0]->children()[0]->render_surface()->RenderPassId();
- switch (hostImpl->activeTree()->source_frame_number()) {
+ switch (hostImpl->active_tree()->source_frame_number()) {
case 0:
EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId(surface1RenderPassId));
EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId(surface2RenderPassId));
@@ -2142,7 +2142,7 @@ public:
m_layerTreeHost->contents_texture_manager()->memoryUseBytes());
// Make sure that contents textures are marked as having been
// purged.
- EXPECT_TRUE(hostImpl->activeTree()->ContentsTexturesPurged());
+ EXPECT_TRUE(hostImpl->active_tree()->ContentsTexturesPurged());
// End the test in this state.
endTest();
}
diff --git a/cc/layer_tree_host_unittest_animation.cc b/cc/layer_tree_host_unittest_animation.cc
index 6bfa36e..837e8cb 100644
--- a/cc/layer_tree_host_unittest_animation.cc
+++ b/cc/layer_tree_host_unittest_animation.cc
@@ -185,7 +185,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws :
virtual bool prepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData& frame,
+ LayerTreeHostImpl::FrameData* frame,
bool result) OVERRIDE {
return false;
}
@@ -271,7 +271,7 @@ public:
EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time));
LayerAnimationController* controller_impl =
- host_impl->rootLayer()->layer_animation_controller();
+ host_impl->RootLayer()->layer_animation_controller();
Animation* animation_impl =
controller_impl->GetAnimation(0, Animation::Opacity);
@@ -316,7 +316,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes :
LayerTreeHostImpl* impl_host,
bool hasUnfinishedAnimation) OVERRIDE {
LayerAnimationController* controller =
- impl_host->rootLayer()->layer_animation_controller();
+ impl_host->RootLayer()->layer_animation_controller();
Animation* animation =
controller->GetAnimation(0, Animation::Opacity);
if (!animation)
diff --git a/cc/layer_tree_host_unittest_context.cc b/cc/layer_tree_host_unittest_context.cc
index 551dc7c..dee96c5 100644
--- a/cc/layer_tree_host_unittest_context.cc
+++ b/cc/layer_tree_host_unittest_context.cc
@@ -148,8 +148,9 @@ class LayerTreeHostContextTest : public ThreadedTest {
return offscreen_contexts_compositor_thread_;
}
- virtual bool prepareToDrawOnThread(
- LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result)
+ virtual bool prepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ bool result)
OVERRIDE {
EXPECT_TRUE(result);
if (!times_to_lose_during_draw_)
@@ -423,14 +424,14 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent :
virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>(
- host_impl->rootLayer()->children()[0]);
+ host_impl->active_tree()->root_layer()->children()[0]);
// Even though the context was lost, we should have a resource. The
// TestWebGraphicsContext3D ensures that this resource is created with
// the active context.
EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0));
cc::ContextProvider* contexts =
- host_impl->resourceProvider()->offscreen_context_provider();
+ host_impl->resource_provider()->offscreen_context_provider();
if (use_surface_) {
EXPECT_TRUE(contexts->Context3d());
// TODO(danakj): Make a fake GrContext.
@@ -519,7 +520,7 @@ class LayerTreeHostContextTestOffscreenContextFails
virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
cc::ContextProvider* contexts =
- host_impl->resourceProvider()->offscreen_context_provider();
+ host_impl->resource_provider()->offscreen_context_provider();
EXPECT_FALSE(contexts);
endTest();
}
@@ -558,16 +559,16 @@ class LayerTreeHostContextTestLostContextFails :
++num_commits_;
if (num_commits_ == 1) {
// When the context is ok, we should have these things.
- EXPECT_TRUE(host_impl->outputSurface());
+ EXPECT_TRUE(host_impl->output_surface());
EXPECT_TRUE(host_impl->renderer());
- EXPECT_TRUE(host_impl->resourceProvider());
+ EXPECT_TRUE(host_impl->resource_provider());
return;
}
// When context recreation fails we shouldn't be left with any of them.
- EXPECT_FALSE(host_impl->outputSurface());
+ EXPECT_FALSE(host_impl->output_surface());
EXPECT_FALSE(host_impl->renderer());
- EXPECT_FALSE(host_impl->resourceProvider());
+ EXPECT_FALSE(host_impl->resource_provider());
}
virtual void afterTest() OVERRIDE {}
@@ -576,42 +577,48 @@ class LayerTreeHostContextTestLostContextFails :
int num_commits_;
};
-TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_SingleThread) {
+TEST_F(LayerTreeHostContextTestLostContextFails,
+ FailReinitialize100_SingleThread) {
times_to_fail_reinitialize_ = 100;
times_to_fail_recreate_ = 0;
times_to_lose_on_recreate_ = 0;
runTest(false);
}
-TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_MultiThread) {
+TEST_F(LayerTreeHostContextTestLostContextFails,
+ FailReinitialize100_MultiThread) {
times_to_fail_reinitialize_ = 100;
times_to_fail_recreate_ = 0;
times_to_lose_on_recreate_ = 0;
runTest(true);
}
-TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_SingleThread) {
+TEST_F(LayerTreeHostContextTestLostContextFails,
+ FailRecreate100_SingleThread) {
times_to_fail_reinitialize_ = 0;
times_to_fail_recreate_ = 100;
times_to_lose_on_recreate_ = 0;
runTest(false);
}
-TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_MultiThread) {
+TEST_F(LayerTreeHostContextTestLostContextFails,
+ FailRecreate100_MultiThread) {
times_to_fail_reinitialize_ = 0;
times_to_fail_recreate_ = 100;
times_to_lose_on_recreate_ = 0;
runTest(true);
}
-TEST_F(LayerTreeHostContextTestLostContextFails, LoseOnRecreate100_SingleThread) {
+TEST_F(LayerTreeHostContextTestLostContextFails,
+ LoseOnRecreate100_SingleThread) {
times_to_fail_reinitialize_ = 0;
times_to_fail_recreate_ = 0;
times_to_lose_on_recreate_ = 100;
runTest(false);
}
-TEST_F(LayerTreeHostContextTestLostContextFails, LoseOnRecreate100_MultiThread) {
+TEST_F(LayerTreeHostContextTestLostContextFails,
+ LoseOnRecreate100_MultiThread) {
times_to_fail_reinitialize_ = 0;
times_to_fail_recreate_ = 0;
times_to_lose_on_recreate_ = 100;
@@ -824,7 +831,7 @@ class LayerTreeHostContextTestLayersNotified :
LayerTreeHostContextTest::commitCompleteOnThread(host_impl);
FakeContentLayerImpl* root = static_cast<FakeContentLayerImpl*>(
- host_impl->rootLayer());
+ host_impl->active_tree()->root_layer());
FakeContentLayerImpl* child = static_cast<FakeContentLayerImpl*>(
root->children()[0]);
FakeContentLayerImpl* grandchild = static_cast<FakeContentLayerImpl*>(
@@ -982,9 +989,9 @@ class LayerTreeHostContextTestDontUseLostResources :
virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
LayerTreeHostContextTest::commitCompleteOnThread(host_impl);
- ResourceProvider* resource_provider = host_impl->resourceProvider();
+ ResourceProvider* resource_provider = host_impl->resource_provider();
- if (host_impl->activeTree()->source_frame_number() == 0) {
+ if (host_impl->active_tree()->source_frame_number() == 0) {
// Set up impl resources on the first commit.
scoped_ptr<TestRenderPass> pass_for_quad = TestRenderPass::Create();
@@ -1010,7 +1017,7 @@ class LayerTreeHostContextTestDontUseLostResources :
// First child is the delegated layer.
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(
- host_impl->rootLayer()->children()[0]);
+ host_impl->active_tree()->root_layer()->children()[0]);
delegated_impl->SetFrameDataForRenderPasses(&pass_list);
EXPECT_TRUE(pass_list.empty());
@@ -1037,7 +1044,7 @@ class LayerTreeHostContextTestDontUseLostResources :
return;
}
- if (host_impl->activeTree()->source_frame_number() == 3) {
+ if (host_impl->active_tree()->source_frame_number() == 3) {
// On the third commit we're recovering from context loss. Hardware
// video frames should not be reused by the VideoFrameProvider, but
// software frames can be.
@@ -1048,9 +1055,9 @@ class LayerTreeHostContextTestDontUseLostResources :
virtual bool prepareToDrawOnThread(
LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData& frame,
+ LayerTreeHostImpl::FrameData* frame,
bool result) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() == 2) {
+ if (host_impl->active_tree()->source_frame_number() == 2) {
// Lose the context during draw on the second commit. This will cause
// a third commit to recover.
if (context3d_)
diff --git a/cc/layer_tree_host_unittest_delegated.cc b/cc/layer_tree_host_unittest_delegated.cc
index e856e6d..ecec114 100644
--- a/cc/layer_tree_host_unittest_delegated.cc
+++ b/cc/layer_tree_host_unittest_delegated.cc
@@ -110,7 +110,7 @@ class LayerTreeHostDelegatedTestCreateChildId
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
@@ -120,7 +120,7 @@ class LayerTreeHostDelegatedTestCreateChildId
EXPECT_TRUE(delegated_impl->ChildId());
EXPECT_FALSE(did_reset_child_id_);
- host_impl->resourceProvider()->GraphicsContext3D()->loseContextCHROMIUM(
+ host_impl->resource_provider()->GraphicsContext3D()->loseContextCHROMIUM(
GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
break;
case 3:
@@ -138,7 +138,7 @@ class LayerTreeHostDelegatedTestCreateChildId
if (num_activates_ < 2)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
@@ -242,16 +242,16 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage
}
virtual bool prepareToDrawOnThread(LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData& frame,
+ LayerTreeHostImpl::FrameData* frame,
bool result) {
EXPECT_TRUE(result);
if (!first_draw_for_source_frame_)
return result;
- gfx::RectF damage_rect = frame.renderPasses.back()->damage_rect;
+ gfx::RectF damage_rect = frame->render_passes.back()->damage_rect;
- switch (host_impl->activeTree()->source_frame_number()) {
+ switch (host_impl->active_tree()->source_frame_number()) {
case 0:
// Before the layer has a frame to display it should not
// be visible at all, and not damage anything.
@@ -351,12 +351,12 @@ class LayerTreeHostDelegatedTestMergeResources
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
// Both frames' resources should be in the parent's resource provider.
@@ -393,12 +393,12 @@ class LayerTreeHostDelegatedTestRemapResourcesInQuads
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
// The frame's resource should be in the parent's resource provider.
@@ -619,15 +619,15 @@ class LayerTreeHostDelegatedTestFrameBeforeAck
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() != 3)
+ if (host_impl->active_tree()->source_frame_number() != 3)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
// The bad frame should be dropped. So we should only have one quad (the
@@ -716,15 +716,15 @@ class LayerTreeHostDelegatedTestFrameBeforeTakeResources
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() != 3)
+ if (host_impl->active_tree()->source_frame_number() != 3)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
// The third frame has all of the resources in it again, the delegated
@@ -822,18 +822,18 @@ class LayerTreeHostDelegatedTestBadFrame
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() < 1)
+ if (host_impl->active_tree()->source_frame_number() < 1)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
- switch (host_impl->activeTree()->source_frame_number()) {
+ switch (host_impl->active_tree()->source_frame_number()) {
case 1: {
// We have the first good frame with just 990 and 555 in it.
// layer.
@@ -933,15 +933,15 @@ class LayerTreeHostDelegatedTestUnnamedResource
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() != 1)
+ if (host_impl->active_tree()->source_frame_number() != 1)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
// The layer only held on to the resource that was used.
@@ -996,15 +996,15 @@ class LayerTreeHostDelegatedTestDontLeakResource
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() != 1)
+ if (host_impl->active_tree()->source_frame_number() != 1)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
// The layer only held on to the resource that was used.
@@ -1073,18 +1073,18 @@ class LayerTreeHostDelegatedTestResourceSentToParent
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() < 1)
+ if (host_impl->active_tree()->source_frame_number() < 1)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
- switch (host_impl->activeTree()->source_frame_number()) {
+ switch (host_impl->active_tree()->source_frame_number()) {
case 1: {
EXPECT_EQ(2u, map.size());
EXPECT_EQ(1u, map.count(999));
@@ -1098,7 +1098,7 @@ class LayerTreeHostDelegatedTestResourceSentToParent
ResourceProvider::ResourceIdArray resources_for_parent;
resources_for_parent.push_back(map.find(999)->second);
TransferableResourceArray transferable_resources;
- host_impl->resourceProvider()->PrepareSendToParent(
+ host_impl->resource_provider()->PrepareSendToParent(
resources_for_parent, &transferable_resources);
break;
}
@@ -1116,7 +1116,7 @@ class LayerTreeHostDelegatedTestResourceSentToParent
resource.id = map.find(999)->second;
TransferableResourceArray transferable_resources;
transferable_resources.push_back(resource);
- host_impl->resourceProvider()->ReceiveFromParent(
+ host_impl->resource_provider()->ReceiveFromParent(
transferable_resources);
break;
}
@@ -1188,18 +1188,18 @@ class LayerTreeHostDelegatedTestCommitWithoutTake
}
virtual void treeActivatedOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
- if (host_impl->activeTree()->source_frame_number() < 1)
+ if (host_impl->active_tree()->source_frame_number() < 1)
return;
- LayerImpl* root_impl = host_impl->activeTree()->RootLayer();
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
FakeDelegatedRendererLayerImpl* delegated_impl =
static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
const ResourceProvider::ResourceIdMap& map =
- host_impl->resourceProvider()->GetChildToParentMap(
+ host_impl->resource_provider()->GetChildToParentMap(
delegated_impl->ChildId());
- switch (host_impl->activeTree()->source_frame_number()) {
+ switch (host_impl->active_tree()->source_frame_number()) {
case 1:
EXPECT_EQ(3u, map.size());
EXPECT_EQ(1u, map.count(999));
diff --git a/cc/layer_tree_host_unittest_scroll.cc b/cc/layer_tree_host_unittest_scroll.cc
index 28fd4fb..896e646 100644
--- a/cc/layer_tree_host_unittest_scroll.cc
+++ b/cc/layer_tree_host_unittest_scroll.cc
@@ -49,14 +49,14 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest {
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- LayerImpl* root = impl->rootLayer();
+ LayerImpl* root = impl->active_tree()->root_layer();
EXPECT_VECTOR_EQ(gfx::Vector2d(), root->scroll_delta());
root->SetScrollable(true);
root->SetMaxScrollOffset(gfx::Vector2d(100, 100));
root->ScrollBy(scroll_amount_);
- switch (impl->activeTree()->source_frame_number()) {
+ switch (impl->active_tree()->source_frame_number()) {
case 0:
EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset());
EXPECT_VECTOR_EQ(scroll_amount_, root->scroll_delta());
@@ -124,12 +124,12 @@ class LayerTreeHostScrollTestScrollMultipleRedraw :
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- LayerImpl* root = impl->rootLayer();
+ LayerImpl* root = impl->active_tree()->root_layer();
root->SetScrollable(true);
root->SetMaxScrollOffset(gfx::Vector2d(100, 100));
- if (impl->activeTree()->source_frame_number() == 0 &&
- impl->sourceAnimationFrameNumber() == 1) {
+ if (impl->active_tree()->source_frame_number() == 0 &&
+ impl->SourceAnimationFrameNumber() == 1) {
// First draw after first commit.
EXPECT_VECTOR_EQ(root->scroll_delta(), gfx::Vector2d());
root->ScrollBy(scroll_amount_);
@@ -137,8 +137,8 @@ class LayerTreeHostScrollTestScrollMultipleRedraw :
EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_);
postSetNeedsRedrawToMainThread();
- } else if (impl->activeTree()->source_frame_number() == 0 &&
- impl->sourceAnimationFrameNumber() == 2) {
+ } else if (impl->active_tree()->source_frame_number() == 0 &&
+ impl->SourceAnimationFrameNumber() == 2) {
// Second draw after first commit.
EXPECT_EQ(root->scroll_delta(), scroll_amount_);
root->ScrollBy(scroll_amount_);
@@ -146,9 +146,9 @@ class LayerTreeHostScrollTestScrollMultipleRedraw :
EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_);
postSetNeedsCommitToMainThread();
- } else if (impl->activeTree()->source_frame_number() == 1) {
+ } else if (impl->active_tree()->source_frame_number() == 1) {
// Third or later draw after second commit.
- EXPECT_GE(impl->sourceAnimationFrameNumber(), 3);
+ EXPECT_GE(impl->SourceAnimationFrameNumber(), 3);
EXPECT_VECTOR_EQ(root->scroll_delta(), gfx::Vector2d());
EXPECT_VECTOR_EQ(
root->scroll_offset(),
@@ -187,12 +187,12 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest {
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- LayerImpl* root = impl->rootLayer();
+ LayerImpl* root = impl->active_tree()->root_layer();
root->SetMaxScrollOffset(gfx::Vector2d(100, 100));
// Check that a fractional scroll delta is correctly accumulated over
// multiple commits.
- switch (impl->activeTree()->source_frame_number()) {
+ switch (impl->active_tree()->source_frame_number()) {
case 0:
EXPECT_VECTOR_EQ(root->scroll_offset(), gfx::Vector2d(0, 0));
EXPECT_VECTOR_EQ(root->scroll_delta(), gfx::Vector2d(0, 0));
@@ -336,7 +336,7 @@ class LayerTreeHostScrollTestCaseWithChild :
}
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- LayerImpl* root_impl = impl->rootLayer();
+ LayerImpl* root_impl = impl->active_tree()->root_layer();
LayerImpl* root_scroll_layer_impl = root_impl->children()[0];
LayerImpl* child_layer_impl = root_scroll_layer_impl->children()[0];
@@ -366,17 +366,17 @@ class LayerTreeHostScrollTestCaseWithChild :
gfx::ScaleSize(child_layer_impl->bounds(), device_scale_factor_));
EXPECT_SIZE_EQ(expected_content_bounds, child_layer_->content_bounds());
- switch (impl->activeTree()->source_frame_number()) {
+ switch (impl->active_tree()->source_frame_number()) {
case 0: {
// Gesture scroll on impl thread.
- InputHandlerClient::ScrollStatus status = impl->scrollBegin(
+ InputHandlerClient::ScrollStatus status = impl->ScrollBegin(
gfx::ToCeiledPoint(
expected_scroll_layer_impl->position() +
gfx::Vector2dF(0.5f, 0.5f)),
InputHandlerClient::Gesture);
EXPECT_EQ(InputHandlerClient::ScrollStarted, status);
- impl->scrollBy(gfx::Point(), scroll_amount_);
- impl->scrollEnd();
+ impl->ScrollBy(gfx::Point(), scroll_amount_);
+ impl->ScrollEnd();
// Check the scroll is applied as a delta.
EXPECT_VECTOR_EQ(
@@ -389,14 +389,14 @@ class LayerTreeHostScrollTestCaseWithChild :
}
case 1: {
// Wheel scroll on impl thread.
- InputHandlerClient::ScrollStatus status = impl->scrollBegin(
+ InputHandlerClient::ScrollStatus status = impl->ScrollBegin(
gfx::ToCeiledPoint(
expected_scroll_layer_impl->position() +
gfx::Vector2dF(0.5f, 0.5f)),
InputHandlerClient::Wheel);
EXPECT_EQ(InputHandlerClient::ScrollStarted, status);
- impl->scrollBy(gfx::Point(), scroll_amount_);
- impl->scrollEnd();
+ impl->ScrollBy(gfx::Point(), scroll_amount_);
+ impl->ScrollEnd();
// Check the scroll is applied as a delta.
EXPECT_VECTOR_EQ(
@@ -498,7 +498,7 @@ class ImplSidePaintingScrollTest : public LayerTreeHostScrollTest {
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
// Manual vsync tick.
- if (impl->pendingTree())
+ if (impl->pending_tree())
impl->setNeedsRedraw();
}
};
@@ -540,23 +540,23 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest {
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
// We force a second draw here of the first commit before activating
// the second commit.
- if (impl->activeTree()->source_frame_number() == 0)
+ if (impl->active_tree()->source_frame_number() == 0)
impl->setNeedsRedraw();
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
ImplSidePaintingScrollTest::drawLayersOnThread(impl);
- LayerImpl* root = impl->rootLayer();
+ LayerImpl* root = impl->active_tree()->root_layer();
root->SetScrollable(true);
root->SetMaxScrollOffset(gfx::Vector2d(100, 100));
LayerImpl* pending_root =
- impl->activeTree()->FindPendingTreeLayerById(root->id());
+ impl->active_tree()->FindPendingTreeLayerById(root->id());
- switch (impl->activeTree()->source_frame_number()) {
+ switch (impl->active_tree()->source_frame_number()) {
case 0:
- if (!impl->pendingTree()) {
+ if (!impl->pending_tree()) {
can_activate_ = false;
EXPECT_VECTOR_EQ(root->scroll_delta(), gfx::Vector2d());
root->ScrollBy(impl_thread_scroll1_);
@@ -571,7 +571,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest {
} else {
can_activate_ = true;
ASSERT_TRUE(pending_root);
- EXPECT_EQ(impl->pendingTree()->source_frame_number(), 1);
+ EXPECT_EQ(impl->pending_tree()->source_frame_number(), 1);
root->ScrollBy(impl_thread_scroll2_);
EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_);
@@ -586,7 +586,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest {
}
break;
case 1:
- EXPECT_FALSE(impl->pendingTree());
+ EXPECT_FALSE(impl->pending_tree());
EXPECT_VECTOR_EQ(root->scroll_offset(),
initial_scroll_ + main_thread_scroll_ + impl_thread_scroll1_);
EXPECT_VECTOR_EQ(root->scroll_delta(), impl_thread_scroll2_);
@@ -628,7 +628,7 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset
}
virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- LayerImpl* root = impl->rootLayer();
+ LayerImpl* root = impl->active_tree()->root_layer();
root->SetScrollable(true);
root->SetMaxScrollOffset(gfx::Vector2d(100, 100));
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index 8840c19..5e8aa5b 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -60,7 +60,7 @@ void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) {
root_scroll_layer_ = NULL;
currently_scrolling_layer_ = NULL;
- layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
void LayerTreeImpl::FindRootScrollLayer() {
@@ -113,7 +113,7 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
if (hud_layer())
target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(
LayerTreeHostCommon::findLayerInSubtree(
- target_tree->RootLayer(), hud_layer()->id())));
+ target_tree->root_layer(), hud_layer()->id())));
else
target_tree->set_hud_layer(NULL);
}
@@ -159,7 +159,7 @@ void LayerTreeImpl::SetPageScaleDelta(float delta)
page_scale_delta_ = delta;
if (IsActiveTree()) {
- LayerTreeImpl* pending_tree = layer_tree_host_impl_->pendingTree();
+ LayerTreeImpl* pending_tree = layer_tree_host_impl_->pending_tree();
if (pending_tree) {
DCHECK_EQ(1, pending_tree->sent_page_scale_delta());
pending_tree->SetPageScaleDelta(page_scale_delta_ / sent_page_scale_delta_);
@@ -217,9 +217,9 @@ struct UpdateTilePrioritiesForLayer {
void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) {
if (!needs_update_draw_properties_) {
- if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && RootLayer())
+ if (reason == UPDATE_ACTIVE_TREE_FOR_DRAW && root_layer())
LayerTreeHostCommon::callFunctionForSubtree<UpdateTilePrioritiesForLayer>(
- RootLayer());
+ root_layer());
return;
}
@@ -230,7 +230,7 @@ void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) {
if (!layer_tree_host_impl_->renderer())
return;
- if (!RootLayer())
+ if (!root_layer())
return;
if (root_scroll_layer_) {
@@ -240,12 +240,15 @@ void LayerTreeImpl::UpdateDrawProperties(UpdateDrawPropertiesReason reason) {
}
{
- TRACE_EVENT1("cc", "LayerTreeImpl::UpdateDrawProperties", "IsActive", IsActiveTree());
+ TRACE_EVENT1("cc",
+ "LayerTreeImpl::UpdateDrawProperties",
+ "IsActive",
+ IsActiveTree());
bool update_tile_priorities =
reason == UPDATE_PENDING_TREE ||
reason == UPDATE_ACTIVE_TREE_FOR_DRAW;
LayerTreeHostCommon::calculateDrawProperties(
- RootLayer(),
+ root_layer(),
device_viewport_size(),
device_scale_factor(),
total_page_scale_factor(),
@@ -268,7 +271,7 @@ static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current)
}
void LayerTreeImpl::ClearRenderSurfaces() {
- ClearRenderSurfacesOnLayerImplRecursive(RootLayer());
+ ClearRenderSurfacesOnLayerImplRecursive(root_layer());
render_surface_layer_list_.clear();
set_needs_update_draw_properties();
}
@@ -320,7 +323,7 @@ void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pendingTree) {
int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0;
pendingTree->set_currently_scrolling_layer(
- LayerTreeHostCommon::findLayerInSubtree(pendingTree->RootLayer(), id));
+ LayerTreeHostCommon::findLayerInSubtree(pendingTree->root_layer(), id));
}
static void DidBecomeActiveRecursive(LayerImpl* layer) {
@@ -330,8 +333,8 @@ static void DidBecomeActiveRecursive(LayerImpl* layer) {
}
void LayerTreeImpl::DidBecomeActive() {
- if (RootLayer())
- DidBecomeActiveRecursive(RootLayer());
+ if (root_layer())
+ DidBecomeActiveRecursive(root_layer());
FindRootScrollLayer();
UpdateMaxScrollOffset();
}
@@ -342,12 +345,12 @@ bool LayerTreeImpl::ContentsTexturesPurged() const {
void LayerTreeImpl::SetContentsTexturesPurged() {
contents_textures_purged_ = true;
- layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
void LayerTreeImpl::ResetContentsTexturesPurged() {
contents_textures_purged_ = false;
- layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
bool LayerTreeImpl::ViewportSizeInvalid() const {
@@ -356,12 +359,12 @@ bool LayerTreeImpl::ViewportSizeInvalid() const {
void LayerTreeImpl::SetViewportSizeInvalid() {
viewport_size_invalid_ = true;
- layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
void LayerTreeImpl::ResetViewportSizeInvalid() {
viewport_size_invalid_ = false;
- layer_tree_host_impl_->OnCanDrawStateChangedForTree(this);
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
Proxy* LayerTreeImpl::proxy() const {
@@ -369,73 +372,73 @@ Proxy* LayerTreeImpl::proxy() const {
}
const LayerTreeSettings& LayerTreeImpl::settings() const {
- return layer_tree_host_impl_->Settings();
+ return layer_tree_host_impl_->settings();
}
const RendererCapabilities& LayerTreeImpl::rendererCapabilities() const {
- return layer_tree_host_impl_->rendererCapabilities();
+ return layer_tree_host_impl_->GetRendererCapabilities();
}
OutputSurface* LayerTreeImpl::output_surface() const {
- return layer_tree_host_impl_->outputSurface();
+ return layer_tree_host_impl_->output_surface();
}
ResourceProvider* LayerTreeImpl::resource_provider() const {
- return layer_tree_host_impl_->resourceProvider();
+ return layer_tree_host_impl_->resource_provider();
}
TileManager* LayerTreeImpl::tile_manager() const {
- return layer_tree_host_impl_->tileManager();
+ return layer_tree_host_impl_->tile_manager();
}
FrameRateCounter* LayerTreeImpl::frame_rate_counter() const {
- return layer_tree_host_impl_->fpsCounter();
+ return layer_tree_host_impl_->fps_counter();
}
PaintTimeCounter* LayerTreeImpl::paint_time_counter() const {
- return layer_tree_host_impl_->paintTimeCounter();
+ return layer_tree_host_impl_->paint_time_counter();
}
MemoryHistory* LayerTreeImpl::memory_history() const {
- return layer_tree_host_impl_->memoryHistory();
+ return layer_tree_host_impl_->memory_history();
}
bool LayerTreeImpl::IsActiveTree() const {
- return layer_tree_host_impl_->activeTree() == this;
+ return layer_tree_host_impl_->active_tree() == this;
}
bool LayerTreeImpl::IsPendingTree() const {
- return layer_tree_host_impl_->pendingTree() == this;
+ return layer_tree_host_impl_->pending_tree() == this;
}
bool LayerTreeImpl::IsRecycleTree() const {
- return layer_tree_host_impl_->recycleTree() == this;
+ return layer_tree_host_impl_->recycle_tree() == this;
}
LayerImpl* LayerTreeImpl::FindActiveTreeLayerById(int id) {
- LayerTreeImpl* tree = layer_tree_host_impl_->activeTree();
+ LayerTreeImpl* tree = layer_tree_host_impl_->active_tree();
if (!tree)
return NULL;
return tree->LayerById(id);
}
LayerImpl* LayerTreeImpl::FindPendingTreeLayerById(int id) {
- LayerTreeImpl* tree = layer_tree_host_impl_->pendingTree();
+ LayerTreeImpl* tree = layer_tree_host_impl_->pending_tree();
if (!tree)
return NULL;
return tree->LayerById(id);
}
int LayerTreeImpl::MaxTextureSize() const {
- return layer_tree_host_impl_->rendererCapabilities().max_texture_size;
+ return layer_tree_host_impl_->GetRendererCapabilities().max_texture_size;
}
bool LayerTreeImpl::PinchGestureActive() const {
- return layer_tree_host_impl_->pinchGestureActive();
+ return layer_tree_host_impl_->pinch_gesture_active();
}
base::TimeTicks LayerTreeImpl::CurrentFrameTime() const {
- return layer_tree_host_impl_->currentFrameTime();
+ return layer_tree_host_impl_->CurrentFrameTime();
}
void LayerTreeImpl::SetNeedsRedraw() {
@@ -443,31 +446,31 @@ void LayerTreeImpl::SetNeedsRedraw() {
}
const LayerTreeDebugState& LayerTreeImpl::debug_state() const {
- return layer_tree_host_impl_->debugState();
+ return layer_tree_host_impl_->debug_state();
}
float LayerTreeImpl::device_scale_factor() const {
- return layer_tree_host_impl_->deviceScaleFactor();
+ return layer_tree_host_impl_->device_scale_factor();
}
gfx::Size LayerTreeImpl::device_viewport_size() const {
- return layer_tree_host_impl_->DeviceViewportSize();
+ return layer_tree_host_impl_->device_viewport_size();
}
-const gfx::Size& LayerTreeImpl::layout_viewport_size() const {
- return layer_tree_host_impl_->layoutViewportSize();
+gfx::Size LayerTreeImpl::layout_viewport_size() const {
+ return layer_tree_host_impl_->layout_viewport_size();
}
std::string LayerTreeImpl::layer_tree_as_text() const {
- return layer_tree_host_impl_->layerTreeAsText();
+ return layer_tree_host_impl_->LayerTreeAsText();
}
DebugRectHistory* LayerTreeImpl::debug_rect_history() const {
- return layer_tree_host_impl_->debugRectHistory();
+ return layer_tree_host_impl_->debug_rect_history();
}
AnimationRegistrar* LayerTreeImpl::animationRegistrar() const {
- return layer_tree_host_impl_->animationRegistrar();
+ return layer_tree_host_impl_->animation_registrar();
}
scoped_ptr<base::Value> LayerTreeImpl::AsValue() const {
diff --git a/cc/layer_tree_impl.h b/cc/layer_tree_impl.h
index 9c752b8..189434d 100644
--- a/cc/layer_tree_impl.h
+++ b/cc/layer_tree_impl.h
@@ -75,14 +75,14 @@ class CC_EXPORT LayerTreeImpl {
const LayerTreeDebugState& debug_state() const;
float device_scale_factor() const;
gfx::Size device_viewport_size() const;
- const gfx::Size& layout_viewport_size() const;
+ gfx::Size layout_viewport_size() const;
std::string layer_tree_as_text() const;
DebugRectHistory* debug_rect_history() const;
scoped_ptr<base::Value> AsValue() const;
// Other public methods
// ---------------------------------------------------------------------------
- LayerImpl* RootLayer() const { return root_layer_.get(); }
+ LayerImpl* root_layer() const { return root_layer_.get(); }
void SetRootLayer(scoped_ptr<LayerImpl>);
scoped_ptr<LayerImpl> DetachLayerTree();
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index c62ad09..5b61332 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -596,7 +596,7 @@ TEST_F(LayerTest, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds)
TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect)
{
scoped_refptr<Layer> testLayer = Layer::Create();
- scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1);
testLayer->SetNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)));
testLayer->PushPropertiesTo(implLayer.get());
@@ -617,7 +617,7 @@ TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect)
TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForTransform)
{
scoped_refptr<Layer> testLayer = Layer::Create();
- scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1);
gfx::Transform transform;
transform.Rotate(45.0);
@@ -633,7 +633,7 @@ TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForTransform)
TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity)
{
scoped_refptr<Layer> testLayer = Layer::Create();
- scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1);
testLayer->SetOpacity(0.5);
@@ -647,7 +647,7 @@ TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity)
TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyTransformAnimation)
{
scoped_refptr<Layer> testLayer = Layer::Create();
- scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1);
scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create();
implLayer->layer_animation_controller()->SetAnimationRegistrar(registrar.get());
@@ -676,7 +676,7 @@ TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringIm
TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyOpacityAnimation)
{
scoped_refptr<Layer> testLayer = Layer::Create();
- scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1);
scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create();
implLayer->layer_animation_controller()->SetAnimationRegistrar(registrar.get());
diff --git a/cc/nine_patch_layer_impl_unittest.cc b/cc/nine_patch_layer_impl_unittest.cc
index 19f7d0d..faaf705 100644
--- a/cc/nine_patch_layer_impl_unittest.cc
+++ b/cc/nine_patch_layer_impl_unittest.cc
@@ -41,7 +41,7 @@ TEST(NinePatchLayerImplTest, verifyDrawQuads)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(hostImpl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visibleContentRect;
layer->SetBounds(layerSize);
layer->SetContentBounds(layerSize);
@@ -102,7 +102,7 @@ TEST(NinePatchLayerImplTest, verifyDrawQuadsForSqueezedLayer)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<NinePatchLayerImpl> layer = NinePatchLayerImpl::Create(hostImpl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visibleContentRect;
layer->SetBounds(layerSize);
layer->SetContentBounds(layerSize);
diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc
index 5f830ec..d779370 100644
--- a/cc/occlusion_tracker_unittest.cc
+++ b/cc/occlusion_tracker_unittest.cc
@@ -407,13 +407,13 @@ private:
template<>
LayerTreeHost* OcclusionTrackerTest<OcclusionTrackerTestMainThreadTypes>::getHost()
{
- return 0;
+ return NULL;
}
template<>
LayerTreeImpl* OcclusionTrackerTest<OcclusionTrackerTestImplThreadTypes>::getHost()
{
- return m_hostImpl.activeTree();
+ return m_hostImpl.active_tree();
}
#define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \
diff --git a/cc/overdraw_metrics.cc b/cc/overdraw_metrics.cc
index f28258b..3b0244f 100644
--- a/cc/overdraw_metrics.cc
+++ b/cc/overdraw_metrics.cc
@@ -151,7 +151,7 @@ static gfx::Size DeviceViewportSize(const LayerTreeHost* host) {
return host->device_viewport_size();
}
static gfx::Size DeviceViewportSize(const LayerTreeHostImpl* host_impl) {
- return host_impl->DeviceViewportSize();
+ return host_impl->device_viewport_size();
}
template <typename LayerTreeHostType>
diff --git a/cc/picture_layer_impl_unittest.cc b/cc/picture_layer_impl_unittest.cc
index 4de1022..823a7c9 100644
--- a/cc/picture_layer_impl_unittest.cc
+++ b/cc/picture_layer_impl_unittest.cc
@@ -149,7 +149,7 @@ class PictureLayerImplTest : public testing::Test {
PictureLayerImplTest()
: host_impl_(ImplSidePaintingSettings(), &proxy_),
id_(7) {
- host_impl_.initializeRenderer(createFakeOutputSurface());
+ host_impl_.InitializeRenderer(createFakeOutputSurface());
}
virtual ~PictureLayerImplTest() {
@@ -159,14 +159,14 @@ class PictureLayerImplTest : public testing::Test {
scoped_refptr<PicturePileImpl> pending_pile,
scoped_refptr<PicturePileImpl> active_pile) {
SetupPendingTree(active_pile);
- host_impl_.activatePendingTree();
+ host_impl_.ActivatePendingTree();
active_layer_ = static_cast<TestablePictureLayerImpl*>(
- host_impl_.activeTree()->LayerById(id_));
+ host_impl_.active_tree()->LayerById(id_));
SetupPendingTree(pending_pile);
pending_layer_ = static_cast<TestablePictureLayerImpl*>(
- host_impl_.pendingTree()->LayerById(id_));
+ host_impl_.pending_tree()->LayerById(id_));
}
void AddDefaultTilingsWithInvalidation(const Region& invalidation) {
@@ -179,8 +179,8 @@ class PictureLayerImplTest : public testing::Test {
void SetupPendingTree(
scoped_refptr<PicturePileImpl> pile) {
- host_impl_.createPendingTree();
- LayerTreeImpl* pending_tree = host_impl_.pendingTree();
+ host_impl_.CreatePendingTree();
+ LayerTreeImpl* pending_tree = host_impl_.pending_tree();
// Clear recycled tree.
pending_tree->DetachLayerTree();
@@ -229,7 +229,7 @@ class PictureLayerImplTest : public testing::Test {
SetupTrees(pending_pile, active_pile);
- host_impl_.activeTree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f);
+ host_impl_.active_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f);
float result_scale_x, result_scale_y;
gfx::Size result_bounds;
active_layer_->CalculateContentsScale(
@@ -284,12 +284,12 @@ class PictureLayerImplTest : public testing::Test {
};
TEST_F(PictureLayerImplTest, tileGridAlignment) {
- host_impl_.setDeviceScaleFactor(1.f);
+ host_impl_.SetDeviceScaleFactor(1.f);
TestTileGridAlignmentCommon();
}
TEST_F(PictureLayerImplTest, tileGridAlignmentHiDPI) {
- host_impl_.setDeviceScaleFactor(2.f);
+ host_impl_.SetDeviceScaleFactor(2.f);
TestTileGridAlignmentCommon();
}
@@ -489,8 +489,8 @@ TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) {
SetupTrees(pending_pile, active_pile);
// These are included in the scale given to the layer.
- host_impl_.setDeviceScaleFactor(1.f);
- host_impl_.pendingTree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f);
+ host_impl_.SetDeviceScaleFactor(1.f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f);
pending_layer_->CalculateContentsScale(
1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
@@ -513,12 +513,12 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
SetupTrees(pending_pile, active_pile);
EXPECT_EQ(0u, pending_layer_->tilings().num_tilings());
- float low_res_factor = host_impl_.Settings().lowResContentsScaleFactor;
+ float low_res_factor = host_impl_.settings().lowResContentsScaleFactor;
EXPECT_LT(low_res_factor, 1.f);
// These are included in the scale given to the layer.
- host_impl_.setDeviceScaleFactor(1.7f);
- host_impl_.pendingTree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
+ host_impl_.SetDeviceScaleFactor(1.7f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
pending_layer_->CalculateContentsScale(
1.3f, false, &result_scale_x, &result_scale_y, &result_bounds);
@@ -543,7 +543,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
pending_layer_->tilings().tiling_at(1)->contents_scale());
// If we change the page scale factor, then we should get new tilings.
- host_impl_.pendingTree()->SetPageScaleFactorAndLimits(2.2f, 2.2f, 2.2f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(2.2f, 2.2f, 2.2f);
pending_layer_->CalculateContentsScale(
1.8f, false, &result_scale_x, &result_scale_y, &result_bounds);
@@ -556,7 +556,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
pending_layer_->tilings().tiling_at(2)->contents_scale());
// If we change the device scale factor, then we should get new tilings.
- host_impl_.setDeviceScaleFactor(1.4f);
+ host_impl_.SetDeviceScaleFactor(1.4f);
pending_layer_->CalculateContentsScale(
1.9f, false, &result_scale_x, &result_scale_y, &result_bounds);
@@ -570,8 +570,8 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
// If we change the device scale factor, but end up at the same total scale
// factor somehow, then we don't get new tilings.
- host_impl_.setDeviceScaleFactor(2.2f);
- host_impl_.pendingTree()->SetPageScaleFactorAndLimits(1.4f, 1.4f, 1.4f);
+ host_impl_.SetDeviceScaleFactor(2.2f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(1.4f, 1.4f, 1.4f);
pending_layer_->CalculateContentsScale(
1.9f, false, &result_scale_x, &result_scale_y, &result_bounds);
@@ -600,13 +600,13 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
SetupTrees(pending_pile, active_pile);
EXPECT_EQ(0u, pending_layer_->tilings().num_tilings());
- float low_res_factor = host_impl_.Settings().lowResContentsScaleFactor;
+ float low_res_factor = host_impl_.settings().lowResContentsScaleFactor;
EXPECT_LT(low_res_factor, 1.f);
// These are included in the scale given to the layer.
- host_impl_.setDeviceScaleFactor(1.7f);
- host_impl_.pendingTree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
- host_impl_.activeTree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
+ host_impl_.SetDeviceScaleFactor(1.7f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
+ host_impl_.active_tree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
SetContentsScaleOnBothLayers(1.f, false);
ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
@@ -626,8 +626,8 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
// Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2.
- host_impl_.pendingTree()->SetPageScaleFactorAndLimits(1.2f, 1.2f, 1.2f);
- host_impl_.activeTree()->SetPageScaleFactorAndLimits(1.2f, 1.2f, 1.2f);
+ host_impl_.pending_tree()->SetPageScaleFactorAndLimits(1.2f, 1.2f, 1.2f);
+ host_impl_.active_tree()->SetPageScaleFactorAndLimits(1.2f, 1.2f, 1.2f);
SetContentsScaleOnBothLayers(1.2f, false);
ASSERT_EQ(4u, active_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc
index 55749dc..7016583 100644
--- a/cc/quad_culler_unittest.cc
+++ b/cc/quad_culler_unittest.cc
@@ -49,7 +49,7 @@ public:
scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const gfx::Transform& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, const gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
{
- scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::Create(m_hostImpl.activeTree(), layer_id_++);
+ scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::Create(m_hostImpl.active_tree(), layer_id_++);
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(100, 100), LayerTilingData::NoBorderTexels);
tiler->setBounds(layerRect.size());
layer->setTilingData(*tiler);
diff --git a/cc/render_pass_sink.h b/cc/render_pass_sink.h
index ae00f62..1c98c69 100644
--- a/cc/render_pass_sink.h
+++ b/cc/render_pass_sink.h
@@ -9,13 +9,13 @@
#include "cc/cc_export.h"
namespace cc {
-
class RenderPass;
class CC_EXPORT RenderPassSink {
-public:
- virtual void appendRenderPass(scoped_ptr<RenderPass>) = 0;
+ public:
+ virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) = 0;
};
-}
+} // namespace cc
+
#endif // CC_RENDER_PASS_SINK_H_
diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc
index dd8fc3a..d35ccfc 100644
--- a/cc/render_surface_impl.cc
+++ b/cc/render_surface_impl.cc
@@ -191,7 +191,7 @@ void RenderSurfaceImpl::AppendRenderPasses(RenderPassSink* pass_sink) {
content_rect_,
damage_tracker_->current_damage_rect(),
screen_space_transform_);
- pass_sink->appendRenderPass(pass.Pass());
+ pass_sink->AppendRenderPass(pass.Pass());
}
void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink,
diff --git a/cc/render_surface_unittest.cc b/cc/render_surface_unittest.cc
index dbd169f..d848f11 100644
--- a/cc/render_surface_unittest.cc
+++ b/cc/render_surface_unittest.cc
@@ -39,7 +39,7 @@ TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> owningLayer = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> owningLayer = LayerImpl::Create(hostImpl.active_tree(), 1);
owningLayer->CreateRenderSurface();
ASSERT_TRUE(owningLayer->render_surface());
RenderSurfaceImpl* renderSurface = owningLayer->render_surface();
@@ -59,7 +59,7 @@ TEST(RenderSurfaceTest, verifySurfaceChangesAreTrackedProperly)
EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->SetClipRect(testRect));
EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(renderSurface->SetContentRect(testRect));
- scoped_ptr<LayerImpl> dummyMask = LayerImpl::Create(hostImpl.activeTree(), 2);
+ scoped_ptr<LayerImpl> dummyMask = LayerImpl::Create(hostImpl.active_tree(), 2);
gfx::Transform dummyMatrix;
dummyMatrix.Translate(1.0, 2.0);
@@ -75,9 +75,9 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> rootLayer = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> rootLayer = LayerImpl::Create(hostImpl.active_tree(), 1);
- scoped_ptr<LayerImpl> owningLayer = LayerImpl::Create(hostImpl.activeTree(), 2);
+ scoped_ptr<LayerImpl> owningLayer = LayerImpl::Create(hostImpl.active_tree(), 2);
owningLayer->CreateRenderSurface();
ASSERT_TRUE(owningLayer->render_surface());
owningLayer->draw_properties().render_target = owningLayer.get();
@@ -115,7 +115,7 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState)
class TestRenderPassSink : public RenderPassSink {
public:
- virtual void appendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.push_back(renderPass.Pass()); }
+ virtual void AppendRenderPass(scoped_ptr<RenderPass> renderPass) OVERRIDE { m_renderPasses.push_back(renderPass.Pass()); }
const ScopedPtrVector<RenderPass>& renderPasses() const { return m_renderPasses; }
@@ -127,9 +127,9 @@ TEST(RenderSurfaceTest, sanityCheckSurfaceCreatesCorrectRenderPass)
{
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<LayerImpl> rootLayer = LayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<LayerImpl> rootLayer = LayerImpl::Create(hostImpl.active_tree(), 1);
- scoped_ptr<LayerImpl> owningLayer = LayerImpl::Create(hostImpl.activeTree(), 2);
+ scoped_ptr<LayerImpl> owningLayer = LayerImpl::Create(hostImpl.active_tree(), 2);
owningLayer->CreateRenderSurface();
ASSERT_TRUE(owningLayer->render_surface());
owningLayer->draw_properties().render_target = owningLayer.get();
diff --git a/cc/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/scrollbar_animation_controller_linear_fade_unittest.cc
index 10977a7..e3c2c23 100644
--- a/cc/scrollbar_animation_controller_linear_fade_unittest.cc
+++ b/cc/scrollbar_animation_controller_linear_fade_unittest.cc
@@ -24,9 +24,9 @@ public:
protected:
virtual void SetUp()
{
- m_scrollLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+ m_scrollLayer = LayerImpl::Create(m_hostImpl.active_tree(), 1);
scoped_ptr<ScrollbarGeometryFixedThumb> geometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometry::create(false)));
- m_scrollbarLayer = ScrollbarLayerImpl::Create(m_hostImpl.activeTree(), 2, geometry.Pass());
+ m_scrollbarLayer = ScrollbarLayerImpl::Create(m_hostImpl.active_tree(), 2, geometry.Pass());
m_scrollLayer->SetMaxScrollOffset(gfx::Vector2d(50, 50));
m_scrollLayer->SetBounds(gfx::Size(50, 50));
diff --git a/cc/scrollbar_layer_unittest.cc b/cc/scrollbar_layer_unittest.cc
index bf37810..cdb4cc9 100644
--- a/cc/scrollbar_layer_unittest.cc
+++ b/cc/scrollbar_layer_unittest.cc
@@ -41,7 +41,7 @@ scoped_ptr<LayerImpl> layerImplForScrollAreaAndScrollbar(
scoped_refptr<Layer> child2 = ScrollbarLayer::Create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(true), child1->id());
layerTreeRoot->AddChild(child1);
layerTreeRoot->InsertChild(child2, reverse_order ? 0 : 1);
- scoped_ptr<LayerImpl> layerImpl = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), host_impl->activeTree());
+ scoped_ptr<LayerImpl> layerImpl = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), host_impl->active_tree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImpl.get());
return layerImpl.Pass();
}
@@ -117,7 +117,7 @@ TEST(ScrollbarLayerTest, scrollOffsetSynchronization)
layerTreeRoot->SetBounds(gfx::Size(100, 200));
contentLayer->SetBounds(gfx::Size(100, 200));
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.active_tree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
ScrollbarLayerImpl* ccScrollbarLayer = static_cast<ScrollbarLayerImpl*>(layerImplTreeRoot->children()[1]);
@@ -132,7 +132,7 @@ TEST(ScrollbarLayerTest, scrollOffsetSynchronization)
contentLayer->SetBounds(gfx::Size(1000, 2000));
ScrollbarAnimationController* scrollbarController = layerImplTreeRoot->scrollbar_animation_controller();
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), hostImpl.active_tree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
EXPECT_EQ(scrollbarController, layerImplTreeRoot->scrollbar_animation_controller());
@@ -216,7 +216,7 @@ public:
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- const int kMaxTextureSize = impl->rendererCapabilities().max_texture_size;
+ const int kMaxTextureSize = impl->GetRendererCapabilities().max_texture_size;
// Check first that we're actually testing something.
EXPECT_GT(m_scrollbarLayer->bounds().width(), kMaxTextureSize);
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index c6b90882..0c2314b 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -60,12 +60,12 @@ bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) {
{
DebugScopedSetImplThread impl(this);
- layer_tree_host_impl_->readback(pixels, rect);
+ layer_tree_host_impl_->Readback(pixels, rect);
- if (layer_tree_host_impl_->isContextLost())
+ if (layer_tree_host_impl_->IsContextLost())
return false;
- layer_tree_host_impl_->swapBuffers();
+ layer_tree_host_impl_->SwapBuffers();
}
DidSwapFrame();
@@ -76,7 +76,7 @@ void SingleThreadProxy::StartPageScaleAnimation(gfx::Vector2d target_offset,
bool use_anchor,
float scale,
base::TimeDelta duration) {
- layer_tree_host_impl_->startPageScaleAnimation(
+ layer_tree_host_impl_->StartPageScaleAnimation(
target_offset, use_anchor, scale, base::TimeTicks::Now(), duration);
}
@@ -84,7 +84,7 @@ void SingleThreadProxy::FinishAllRendering() {
DCHECK(Proxy::IsMainThread());
{
DebugScopedSetImplThread impl(this);
- layer_tree_host_impl_->finishAllRendering();
+ layer_tree_host_impl_->FinishAllRendering();
}
}
@@ -110,7 +110,7 @@ void SingleThreadProxy::SetSurfaceReady() {
void SingleThreadProxy::SetVisible(bool visible) {
DebugScopedSetImplThread impl(this);
- layer_tree_host_impl_->setVisible(visible);
+ layer_tree_host_impl_->SetVisible(visible);
}
bool SingleThreadProxy::InitializeRenderer() {
@@ -118,12 +118,12 @@ bool SingleThreadProxy::InitializeRenderer() {
DCHECK(output_surface_before_initialization_.get());
{
DebugScopedSetImplThread impl(this);
- bool ok = layer_tree_host_impl_->initializeRenderer(
+ bool ok = layer_tree_host_impl_->InitializeRenderer(
output_surface_before_initialization_.Pass());
if (ok) {
renderer_initialized_ = true;
renderer_capabilities_for_main_thread_ =
- layer_tree_host_impl_->rendererCapabilities();
+ layer_tree_host_impl_->GetRendererCapabilities();
}
return ok;
@@ -152,13 +152,13 @@ bool SingleThreadProxy::RecreateOutputSurface() {
DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
DebugScopedSetImplThread impl(this);
layer_tree_host_->DeleteContentsTexturesOnImplThread(
- layer_tree_host_impl_->resourceProvider());
+ layer_tree_host_impl_->resource_provider());
initialized =
- layer_tree_host_impl_->initializeRenderer(outputSurface.Pass());
+ layer_tree_host_impl_->InitializeRenderer(outputSurface.Pass());
if (initialized) {
renderer_capabilities_for_main_thread_ =
- layer_tree_host_impl_->rendererCapabilities();
- layer_tree_host_impl_->resourceProvider()
+ layer_tree_host_impl_->GetRendererCapabilities();
+ layer_tree_host_impl_->resource_provider()
->SetOffscreenContextProvider(offscreen_context_provider);
} else if (offscreen_context_provider) {
offscreen_context_provider->VerifyContexts();
@@ -174,7 +174,7 @@ bool SingleThreadProxy::RecreateOutputSurface() {
void SingleThreadProxy::CollectRenderingStats(RenderingStats* stats) {
stats->totalCommitTime = total_commit_time_;
stats->totalCommitCount = total_commit_count_;
- layer_tree_host_impl_->renderingStats(stats);
+ layer_tree_host_impl_->CollectRenderingStats(stats);
}
const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
@@ -196,7 +196,7 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
DebugScopedSetImplThread impl(this);
base::TimeTicks startTime = base::TimeTicks::HighResNow();
- layer_tree_host_impl_->beginCommit();
+ layer_tree_host_impl_->BeginCommit();
layer_tree_host_->contents_texture_manager()->
pushTexturePrioritiesToBackings();
@@ -207,18 +207,18 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
NULL,
Proxy::MainThread(),
queue.Pass(),
- layer_tree_host_impl_->resourceProvider());
+ layer_tree_host_impl_->resource_provider());
updateController->Finalize();
layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
- layer_tree_host_impl_->commitComplete();
+ layer_tree_host_impl_->CommitComplete();
#ifndef NDEBUG
// In the single-threaded case, the scroll deltas should never be
// touched on the impl layer tree.
scoped_ptr<ScrollAndScaleSet> scrollInfo =
- layer_tree_host_impl_->processScrollDeltas();
+ layer_tree_host_impl_->ProcessScrollDeltas();
DCHECK(!scrollInfo->scrolls.size());
#endif
@@ -242,7 +242,7 @@ void SingleThreadProxy::SetNeedsRedraw() {
SetNeedsCommit();
}
-void SingleThreadProxy::onHasPendingTreeStateChanged(bool have_pending_tree) {
+void SingleThreadProxy::OnHasPendingTreeStateChanged(bool have_pending_tree) {
// Thread-only feature.
NOTREACHED();
}
@@ -266,30 +266,30 @@ void SingleThreadProxy::Stop() {
DebugScopedSetImplThread impl(this);
layer_tree_host_->DeleteContentsTexturesOnImplThread(
- layer_tree_host_impl_->resourceProvider());
+ layer_tree_host_impl_->resource_provider());
layer_tree_host_impl_.reset();
}
layer_tree_host_ = NULL;
}
-void SingleThreadProxy::setNeedsRedrawOnImplThread() {
+void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
layer_tree_host_->ScheduleComposite();
}
-void SingleThreadProxy::didUploadVisibleHighResolutionTileOnImplThread() {
+void SingleThreadProxy::DidUploadVisibleHighResolutionTileOnImplThread() {
// Impl-side painting only.
NOTREACHED();
}
-void SingleThreadProxy::setNeedsCommitOnImplThread() {
+void SingleThreadProxy::SetNeedsCommitOnImplThread() {
layer_tree_host_->ScheduleComposite();
}
-void SingleThreadProxy::setNeedsManageTilesOnImplThread() {
+void SingleThreadProxy::SetNeedsManageTilesOnImplThread() {
layer_tree_host_->ScheduleComposite();
}
-void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(
+void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
scoped_ptr<AnimationEventsVector> events,
base::Time wall_clock_time) {
DCHECK(Proxy::IsImplThread());
@@ -297,7 +297,7 @@ void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(
layer_tree_host_->SetAnimationEvents(events.Pass(), wall_clock_time);
}
-bool SingleThreadProxy::reduceContentsTextureMemoryOnImplThread(
+bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread(
size_t limit_bytes,
int priority_cutoff) {
DCHECK(IsImplThread());
@@ -305,15 +305,15 @@ bool SingleThreadProxy::reduceContentsTextureMemoryOnImplThread(
return false;
return layer_tree_host_->contents_texture_manager()->reduceMemoryOnImplThread(
- limit_bytes, priority_cutoff, layer_tree_host_impl_->resourceProvider());
+ limit_bytes, priority_cutoff, layer_tree_host_impl_->resource_provider());
}
-void SingleThreadProxy::reduceWastedContentsTextureMemoryOnImplThread() {
+void SingleThreadProxy::ReduceWastedContentsTextureMemoryOnImplThread() {
// Impl-side painting only.
NOTREACHED();
}
-void SingleThreadProxy::sendManagedMemoryStats() {
+void SingleThreadProxy::SendManagedMemoryStats() {
DCHECK(Proxy::IsImplThread());
if (!layer_tree_host_impl_.get())
return;
@@ -322,24 +322,24 @@ void SingleThreadProxy::sendManagedMemoryStats() {
PrioritizedResourceManager* contents_texture_manager =
layer_tree_host_->contents_texture_manager();
- layer_tree_host_impl_->sendManagedMemoryStats(
+ layer_tree_host_impl_->SendManagedMemoryStats(
contents_texture_manager->memoryVisibleBytes(),
contents_texture_manager->memoryVisibleAndNearbyBytes(),
contents_texture_manager->memoryUseBytes());
}
-bool SingleThreadProxy::isInsideDraw() { return inside_draw_; }
+bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; }
-void SingleThreadProxy::didLoseOutputSurfaceOnImplThread() {
+void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
// Cause a commit so we can notice the lost context.
- setNeedsCommitOnImplThread();
+ SetNeedsCommitOnImplThread();
}
// Called by the legacy scheduling path (e.g. where render_widget does the
// scheduling)
void SingleThreadProxy::CompositeImmediately() {
if (CommitAndComposite()) {
- layer_tree_host_impl_->swapBuffers();
+ layer_tree_host_impl_->SwapBuffers();
DidSwapFrame();
}
}
@@ -353,7 +353,7 @@ scoped_ptr<base::Value> SingleThreadProxy::AsValue() const {
DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this));
state->Set("layer_tree_host_impl",
- layer_tree_host_impl_->asValue().release());
+ layer_tree_host_impl_->AsValue().release());
}
return state.PassAs<base::Value>();
}
@@ -366,7 +366,7 @@ void SingleThreadProxy::ForceSerializeOnSwapBuffers() {
}
}
-void SingleThreadProxy::onSwapBuffersCompleteOnImplThread() { NOTREACHED(); }
+void SingleThreadProxy::OnSwapBuffersCompleteOnImplThread() { NOTREACHED(); }
bool SingleThreadProxy::CommitAndComposite() {
DCHECK(Proxy::IsMainThread());
@@ -390,7 +390,7 @@ bool SingleThreadProxy::CommitAndComposite() {
scoped_ptr<ResourceUpdateQueue> queue =
make_scoped_ptr(new ResourceUpdateQueue);
layer_tree_host_->UpdateLayers(
- queue.get(), layer_tree_host_impl_->memoryAllocationLimitBytes());
+ queue.get(), layer_tree_host_impl_->memory_allocation_limit_bytes());
layer_tree_host_->WillCommit();
DoCommit(queue.Pass());
@@ -406,33 +406,33 @@ bool SingleThreadProxy::DoComposite(
DebugScopedSetImplThread impl(this);
base::AutoReset<bool> mark_inside(&inside_draw_, true);
- layer_tree_host_impl_->resourceProvider()->
+ layer_tree_host_impl_->resource_provider()->
SetOffscreenContextProvider(offscreen_context_provider);
if (!layer_tree_host_impl_->visible())
return false;
- layer_tree_host_impl_->animate(base::TimeTicks::Now(), base::Time::Now());
+ layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now());
// We guard prepareToDraw() with canDraw() because it always returns a valid
// frame, so can only be used when such a frame is possible. Since
// drawLayers() depends on the result of prepareToDraw(), it is guarded on
// canDraw() as well.
- if (!layer_tree_host_impl_->canDraw())
+ if (!layer_tree_host_impl_->CanDraw())
return false;
LayerTreeHostImpl::FrameData frame;
- layer_tree_host_impl_->prepareToDraw(frame);
- layer_tree_host_impl_->drawLayers(frame);
- layer_tree_host_impl_->didDrawAllLayers(frame);
- output_surface_lost_ = layer_tree_host_impl_->isContextLost();
+ layer_tree_host_impl_->PrepareToDraw(&frame);
+ layer_tree_host_impl_->DrawLayers(&frame);
+ layer_tree_host_impl_->DidDrawAllLayers(frame);
+ output_surface_lost_ = layer_tree_host_impl_->IsContextLost();
- layer_tree_host_impl_->beginNextFrame();
+ layer_tree_host_impl_->BeginNextFrame();
}
if (output_surface_lost_) {
cc::ContextProvider* offscreen_contexts = layer_tree_host_impl_->
- resourceProvider()->offscreen_context_provider();
+ resource_provider()->offscreen_context_provider();
if (offscreen_contexts)
offscreen_contexts->VerifyContexts();
layer_tree_host_->DidLoseOutputSurface();
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index f8e92b6..4180b02 100644
--- a/cc/single_thread_proxy.h
+++ b/cc/single_thread_proxy.h
@@ -53,26 +53,26 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
virtual bool CommitPendingForTesting() OVERRIDE;
// LayerTreeHostImplClient implementation
- virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE;
- virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
- virtual void onVSyncParametersChanged(base::TimeTicks timebase,
+ virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE;
+ virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE;
+ virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
base::TimeDelta interval) OVERRIDE {}
- virtual void onCanDrawStateChanged(bool can_draw) OVERRIDE {}
- virtual void onHasPendingTreeStateChanged(bool have_pending_tree) OVERRIDE;
- virtual void setNeedsRedrawOnImplThread() OVERRIDE;
- virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE;
- virtual void setNeedsCommitOnImplThread() OVERRIDE;
- virtual void setNeedsManageTilesOnImplThread() OVERRIDE;
- virtual void postAnimationEventsToMainThreadOnImplThread(
+ virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {}
+ virtual void OnHasPendingTreeStateChanged(bool have_pending_tree) OVERRIDE;
+ virtual void SetNeedsRedrawOnImplThread() OVERRIDE;
+ virtual void DidUploadVisibleHighResolutionTileOnImplThread() OVERRIDE;
+ virtual void SetNeedsCommitOnImplThread() OVERRIDE;
+ virtual void SetNeedsManageTilesOnImplThread() OVERRIDE;
+ virtual void PostAnimationEventsToMainThreadOnImplThread(
scoped_ptr<AnimationEventsVector> events,
base::Time wall_clock_time) OVERRIDE;
- virtual bool reduceContentsTextureMemoryOnImplThread(
+ virtual bool ReduceContentsTextureMemoryOnImplThread(
size_t limit_bytes,
int priority_cutoff) OVERRIDE;
- virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE;
- virtual void sendManagedMemoryStats() OVERRIDE;
- virtual bool isInsideDraw() OVERRIDE;
- virtual void renewTreePriority() OVERRIDE {}
+ virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE;
+ virtual void SendManagedMemoryStats() OVERRIDE;
+ virtual bool IsInsideDraw() OVERRIDE;
+ virtual void RenewTreePriority() OVERRIDE {}
// Called by the legacy path where RenderWidget does the scheduling.
void CompositeImmediately();
diff --git a/cc/solid_color_layer_impl_unittest.cc b/cc/solid_color_layer_impl_unittest.cc
index d5f7f61..a9faf40 100644
--- a/cc/solid_color_layer_impl_unittest.cc
+++ b/cc/solid_color_layer_impl_unittest.cc
@@ -26,7 +26,7 @@ TEST(SolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::Create(hostImpl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visibleContentRect;
layer->SetBounds(layerSize);
layer->SetContentBounds(layerSize);
@@ -49,7 +49,7 @@ TEST(SolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::Create(hostImpl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visibleContentRect;
layer->SetBounds(layerSize);
layer->SetContentBounds(layerSize);
@@ -74,7 +74,7 @@ TEST(SolidColorLayerImplTest, verifyCorrectOpacityInQuad)
FakeImplProxy proxy;
FakeLayerTreeHostImpl hostImpl(&proxy);
- scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::Create(hostImpl.activeTree(), 1);
+ scoped_ptr<SolidColorLayerImpl> layer = SolidColorLayerImpl::Create(hostImpl.active_tree(), 1);
layer->draw_properties().visible_content_rect = visibleContentRect;
layer->SetBounds(layerSize);
layer->SetContentBounds(layerSize);
@@ -119,7 +119,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect)
EXPECT_TRUE(layer->contents_opaque());
{
- scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::Create(hostImpl.activeTree(), layer->id());
+ scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::Create(hostImpl.active_tree(), layer->id());
layer->PushPropertiesTo(layerImpl.get());
// The impl layer should call itself opaque as well.
@@ -141,7 +141,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect)
EXPECT_FALSE(layer->contents_opaque());
{
- scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::Create(hostImpl.activeTree(), layer->id());
+ scoped_ptr<SolidColorLayerImpl> layerImpl = SolidColorLayerImpl::Create(hostImpl.active_tree(), layer->id());
layer->PushPropertiesTo(layerImpl.get());
// The impl layer should callnot itself opaque anymore.
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index 64d0150..334ff9f 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -7,23 +7,19 @@
namespace cc {
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy)
- : LayerTreeHostImpl(LayerTreeSettings(), &client_, proxy)
-{
+ : LayerTreeHostImpl(LayerTreeSettings(), &client_, proxy) {
// Explicitly clear all debug settings.
- setDebugState(LayerTreeDebugState());
+ SetDebugState(LayerTreeDebugState());
}
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(
const LayerTreeSettings& settings,
Proxy* proxy)
- : LayerTreeHostImpl(settings, &client_, proxy)
-{
+ : LayerTreeHostImpl(settings, &client_, proxy) {
// Explicitly clear all debug settings.
- setDebugState(LayerTreeDebugState());
+ SetDebugState(LayerTreeDebugState());
}
-FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl()
-{
-}
+FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
} // namespace cc
diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h
index 0d218df..54015dc 100644
--- a/cc/test/fake_layer_tree_host_impl.h
+++ b/cc/test/fake_layer_tree_host_impl.h
@@ -17,13 +17,13 @@ class FakeLayerTreeHostImpl : public LayerTreeHostImpl {
FakeLayerTreeHostImpl(const LayerTreeSettings& settings, Proxy* proxy);
virtual ~FakeLayerTreeHostImpl();
- void forcePrepareToDraw() {
- LayerTreeHostImpl::FrameData frameData;
- prepareToDraw(frameData);
- didDrawAllLayers(frameData);
+ void ForcePrepareToDraw() {
+ LayerTreeHostImpl::FrameData frame_data;
+ PrepareToDraw(&frame_data);
+ DidDrawAllLayers(frame_data);
}
- using LayerTreeHostImpl::activatePendingTree;
+ using LayerTreeHostImpl::ActivatePendingTree;
private:
FakeLayerTreeHostImplClient client_;
diff --git a/cc/test/fake_layer_tree_host_impl_client.cc b/cc/test/fake_layer_tree_host_impl_client.cc
index dcefd0e..c4d38ab 100644
--- a/cc/test/fake_layer_tree_host_impl_client.cc
+++ b/cc/test/fake_layer_tree_host_impl_client.cc
@@ -6,13 +6,13 @@
namespace cc {
-bool FakeLayerTreeHostImplClient::reduceContentsTextureMemoryOnImplThread(
- size_t,
- int) {
+bool FakeLayerTreeHostImplClient::ReduceContentsTextureMemoryOnImplThread(
+ size_t limit_butes,
+ int priority_cutoff) {
return false;
}
-bool FakeLayerTreeHostImplClient::isInsideDraw() {
+bool FakeLayerTreeHostImplClient::IsInsideDraw() {
return false;
}
diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h
index e50ca57..fc68a18 100644
--- a/cc/test/fake_layer_tree_host_impl_client.h
+++ b/cc/test/fake_layer_tree_host_impl_client.h
@@ -12,25 +12,27 @@ namespace cc {
class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient {
public:
// LayerTreeHostImplClient implementation.
- virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE { }
- virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE { }
- virtual void onVSyncParametersChanged(
+ virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {}
+ virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {}
+ virtual void OnVSyncParametersChanged(
base::TimeTicks,
- base::TimeDelta) OVERRIDE { }
- virtual void onCanDrawStateChanged(bool) OVERRIDE { }
- virtual void onHasPendingTreeStateChanged(bool) OVERRIDE { }
- virtual void setNeedsRedrawOnImplThread() OVERRIDE { }
- virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { }
- virtual void setNeedsCommitOnImplThread() OVERRIDE { }
- virtual void setNeedsManageTilesOnImplThread() OVERRIDE { }
- virtual void postAnimationEventsToMainThreadOnImplThread(
- scoped_ptr<AnimationEventsVector>,
- base::Time) OVERRIDE { }
- virtual bool reduceContentsTextureMemoryOnImplThread(size_t, int) OVERRIDE;
- virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE { }
- virtual void sendManagedMemoryStats() OVERRIDE { }
- virtual bool isInsideDraw() OVERRIDE;
- virtual void renewTreePriority() OVERRIDE { }
+ base::TimeDelta) OVERRIDE {}
+ virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {}
+ virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE {}
+ virtual void SetNeedsRedrawOnImplThread() OVERRIDE {}
+ virtual void DidUploadVisibleHighResolutionTileOnImplThread() OVERRIDE {}
+ virtual void SetNeedsCommitOnImplThread() OVERRIDE {}
+ virtual void SetNeedsManageTilesOnImplThread() OVERRIDE {}
+ virtual void PostAnimationEventsToMainThreadOnImplThread(
+ scoped_ptr<AnimationEventsVector> events,
+ base::Time wall_clock_time) OVERRIDE {}
+ virtual bool ReduceContentsTextureMemoryOnImplThread(
+ size_t limit_bytes,
+ int priority_cutoff) OVERRIDE;
+ virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE {}
+ virtual void SendManagedMemoryStats() OVERRIDE {}
+ virtual bool IsInsideDraw() OVERRIDE;
+ virtual void RenewTreePriority() OVERRIDE {}
};
} // namespace cc
diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc
index a27afc2..def1820 100644
--- a/cc/test/layer_tree_test_common.cc
+++ b/cc/test/layer_tree_test_common.cc
@@ -38,7 +38,7 @@ TestHooks::TestHooks()
TestHooks::~TestHooks() { }
-bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool)
+bool TestHooks::prepareToDrawOnThread(cc::LayerTreeHostImpl*, LayerTreeHostImpl::FrameData*, bool)
{
return true;
}
@@ -68,76 +68,76 @@ scoped_ptr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testH
return make_scoped_ptr(new MockLayerTreeHostImpl(testHooks, settings, client, proxy));
}
-void MockLayerTreeHostImpl::beginCommit()
+void MockLayerTreeHostImpl::BeginCommit()
{
- LayerTreeHostImpl::beginCommit();
+ LayerTreeHostImpl::BeginCommit();
m_testHooks->beginCommitOnThread(this);
}
-void MockLayerTreeHostImpl::commitComplete()
+void MockLayerTreeHostImpl::CommitComplete()
{
- LayerTreeHostImpl::commitComplete();
+ LayerTreeHostImpl::CommitComplete();
m_testHooks->commitCompleteOnThread(this);
- if (!Settings().implSidePainting)
+ if (!settings().implSidePainting)
m_testHooks->treeActivatedOnThread(this);
}
-bool MockLayerTreeHostImpl::prepareToDraw(FrameData& frame)
+bool MockLayerTreeHostImpl::PrepareToDraw(FrameData* frame)
{
- bool result = LayerTreeHostImpl::prepareToDraw(frame);
+ bool result = LayerTreeHostImpl::PrepareToDraw(frame);
if (!m_testHooks->prepareToDrawOnThread(this, frame, result))
result = false;
return result;
}
-void MockLayerTreeHostImpl::drawLayers(FrameData& frame)
+void MockLayerTreeHostImpl::DrawLayers(FrameData* frame)
{
- LayerTreeHostImpl::drawLayers(frame);
+ LayerTreeHostImpl::DrawLayers(frame);
m_testHooks->drawLayersOnThread(this);
}
-bool MockLayerTreeHostImpl::activatePendingTreeIfNeeded()
+bool MockLayerTreeHostImpl::ActivatePendingTreeIfNeeded()
{
- if (!pendingTree())
+ if (!pending_tree())
return false;
if (!m_testHooks->canActivatePendingTree())
return false;
- bool activated = LayerTreeHostImpl::activatePendingTreeIfNeeded();
+ bool activated = LayerTreeHostImpl::ActivatePendingTreeIfNeeded();
if (activated)
m_testHooks->treeActivatedOnThread(this);
return activated;
}
-bool MockLayerTreeHostImpl::initializeRenderer(scoped_ptr<OutputSurface> outputSurface)
+bool MockLayerTreeHostImpl::InitializeRenderer(scoped_ptr<OutputSurface> outputSurface)
{
- bool success = LayerTreeHostImpl::initializeRenderer(outputSurface.Pass());
+ bool success = LayerTreeHostImpl::InitializeRenderer(outputSurface.Pass());
m_testHooks->initializedRendererOnThread(this, success);
return success;
}
-void MockLayerTreeHostImpl::setVisible(bool visible)
+void MockLayerTreeHostImpl::SetVisible(bool visible)
{
- LayerTreeHostImpl::setVisible(visible);
+ LayerTreeHostImpl::SetVisible(visible);
m_testHooks->didSetVisibleOnImplTree(this, visible);
}
-void MockLayerTreeHostImpl::animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime)
+void MockLayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime)
{
m_testHooks->willAnimateLayers(this, monotonicTime);
- LayerTreeHostImpl::animateLayers(monotonicTime, wallClockTime);
+ LayerTreeHostImpl::AnimateLayers(monotonicTime, wallClockTime);
m_testHooks->animateLayers(this, monotonicTime);
}
-void MockLayerTreeHostImpl::updateAnimationState()
+void MockLayerTreeHostImpl::UpdateAnimationState()
{
- LayerTreeHostImpl::updateAnimationState();
+ LayerTreeHostImpl::UpdateAnimationState();
bool hasUnfinishedAnimation = false;
- AnimationRegistrar::AnimationControllerMap::const_iterator iter = activeAnimationControllers().begin();
- for (; iter != activeAnimationControllers().end(); ++iter) {
+ AnimationRegistrar::AnimationControllerMap::const_iterator iter = active_animation_controllers().begin();
+ for (; iter != active_animation_controllers().end(); ++iter) {
if (iter->second->HasActiveAnimation()) {
hasUnfinishedAnimation = true;
break;
@@ -146,7 +146,7 @@ void MockLayerTreeHostImpl::updateAnimationState()
m_testHooks->updateAnimationState(this, hasUnfinishedAnimation);
}
-base::TimeDelta MockLayerTreeHostImpl::lowFrequencyAnimationInterval() const
+base::TimeDelta MockLayerTreeHostImpl::LowFrequencyAnimationInterval() const
{
return base::TimeDelta::FromMilliseconds(16);
}
diff --git a/cc/test/layer_tree_test_common.h b/cc/test/layer_tree_test_common.h
index 6a61a11..ac9534e3 100644
--- a/cc/test/layer_tree_test_common.h
+++ b/cc/test/layer_tree_test_common.h
@@ -35,7 +35,7 @@ public:
virtual void treeActivatedOnThread(LayerTreeHostImpl*) { }
virtual void initializedRendererOnThread(LayerTreeHostImpl*, bool success) { }
virtual bool prepareToDrawOnThread(
- LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result);
+ LayerTreeHostImpl*, LayerTreeHostImpl::FrameData*, bool result);
virtual void drawLayersOnThread(LayerTreeHostImpl*) { }
virtual void animateLayers(LayerTreeHostImpl*, base::TimeTicks monotonicTime) { }
virtual void updateAnimationState(LayerTreeHostImpl*, bool hasUnfinishedAnimation) { }
@@ -163,21 +163,21 @@ class MockLayerTreeHostImpl : public LayerTreeHostImpl {
public:
static scoped_ptr<MockLayerTreeHostImpl> create(TestHooks*, const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
- virtual void beginCommit() OVERRIDE;
- virtual void commitComplete() OVERRIDE;
- virtual bool prepareToDraw(FrameData&) OVERRIDE;
- virtual void drawLayers(FrameData&) OVERRIDE;
- virtual bool activatePendingTreeIfNeeded() OVERRIDE;
- virtual bool initializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVERRIDE;
- virtual void setVisible(bool visible) OVERRIDE;
+ virtual void BeginCommit() OVERRIDE;
+ virtual void CommitComplete() OVERRIDE;
+ virtual bool PrepareToDraw(FrameData* frame) OVERRIDE;
+ virtual void DrawLayers(FrameData* frame) OVERRIDE;
+ virtual bool ActivatePendingTreeIfNeeded() OVERRIDE;
+ virtual bool InitializeRenderer(scoped_ptr<OutputSurface> outputSurface) OVERRIDE;
+ virtual void SetVisible(bool visible) OVERRIDE;
// Make these public.
typedef std::vector<LayerImpl*> LayerList;
protected:
- virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime) OVERRIDE;
- virtual void updateAnimationState() OVERRIDE;
- virtual base::TimeDelta lowFrequencyAnimationInterval() const OVERRIDE;
+ virtual void AnimateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime) OVERRIDE;
+ virtual void UpdateAnimationState() OVERRIDE;
+ virtual base::TimeDelta LowFrequencyAnimationInterval() const OVERRIDE;
private:
MockLayerTreeHostImpl(TestHooks*, const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
diff --git a/cc/texture_layer_unittest.cc b/cc/texture_layer_unittest.cc
index 5b08c50..195bf43 100644
--- a/cc/texture_layer_unittest.cc
+++ b/cc/texture_layer_unittest.cc
@@ -105,7 +105,7 @@ TEST_F(TextureLayerTest, syncImplWhenDrawing)
scoped_refptr<TextureLayer> testLayer = TextureLayer::Create(NULL);
ASSERT_TRUE(testLayer);
scoped_ptr<TextureLayerImpl> implLayer;
- implLayer = TextureLayerImpl::Create(m_hostImpl.activeTree(), 1, false);
+ implLayer = TextureLayerImpl::Create(m_hostImpl.active_tree(), 1, false);
ASSERT_TRUE(implLayer);
EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AnyNumber());
@@ -400,7 +400,7 @@ protected:
{
TextureLayerTest::SetUp();
m_layerTreeHost.reset(new MockLayerImplTreeHost);
- EXPECT_TRUE(m_hostImpl.initializeRenderer(createFakeOutputSurface()));
+ EXPECT_TRUE(m_hostImpl.InitializeRenderer(createFakeOutputSurface()));
}
CommonMailboxObjects m_testData;
@@ -408,13 +408,13 @@ protected:
TEST_F(TextureLayerImplWithMailboxTest, testImplLayerCallbacks)
{
- m_hostImpl.createPendingTree();
+ m_hostImpl.CreatePendingTree();
scoped_ptr<TextureLayerImpl> pendingLayer;
- pendingLayer = TextureLayerImpl::Create(m_hostImpl.pendingTree(), 1, true);
+ pendingLayer = TextureLayerImpl::Create(m_hostImpl.pending_tree(), 1, true);
ASSERT_TRUE(pendingLayer);
scoped_ptr<LayerImpl> activeLayer(pendingLayer->CreateLayerImpl(
- m_hostImpl.activeTree()));
+ m_hostImpl.active_tree()));
ASSERT_TRUE(activeLayer);
pendingLayer->setTextureMailbox(m_testData.m_mailbox1);
@@ -459,20 +459,20 @@ TEST_F(TextureLayerImplWithMailboxTest, testImplLayerCallbacks)
TEST_F(TextureLayerImplWithMailboxTest, testDestructorCallbackOnCreatedResource)
{
scoped_ptr<TextureLayerImpl> implLayer;
- implLayer = TextureLayerImpl::Create(m_hostImpl.activeTree(), 1, true);
+ implLayer = TextureLayerImpl::Create(m_hostImpl.active_tree(), 1, true);
ASSERT_TRUE(implLayer);
EXPECT_CALL(m_testData.m_mockCallback,
Release(m_testData.m_mailboxName1, _)).Times(1);
implLayer->setTextureMailbox(m_testData.m_mailbox1);
- implLayer->WillDraw(m_hostImpl.activeTree()->resource_provider());
- implLayer->DidDraw(m_hostImpl.activeTree()->resource_provider());
+ implLayer->WillDraw(m_hostImpl.active_tree()->resource_provider());
+ implLayer->DidDraw(m_hostImpl.active_tree()->resource_provider());
implLayer->setTextureMailbox(TextureMailbox());
}
TEST_F(TextureLayerImplWithMailboxTest, testCallbackOnInUseResource)
{
- ResourceProvider *provider = m_hostImpl.activeTree()->resource_provider();
+ ResourceProvider *provider = m_hostImpl.active_tree()->resource_provider();
ResourceProvider::ResourceId id =
provider->CreateResourceFromTextureMailbox(m_testData.m_mailbox1);
provider->AllocateForTesting(id);
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index faa6695..b3053c0 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -134,7 +134,7 @@ void ThreadProxy::requestStartPageScaleAnimationOnImplThread(gfx::Vector2d targe
{
DCHECK(Proxy::IsImplThread());
if (m_layerTreeHostImpl.get())
- m_layerTreeHostImpl->startPageScaleAnimation(targetOffset, useAnchor, scale, base::TimeTicks::Now(), duration);
+ m_layerTreeHostImpl->StartPageScaleAnimation(targetOffset, useAnchor, scale, base::TimeTicks::Now(), duration);
}
void ThreadProxy::FinishAllRendering()
@@ -190,7 +190,7 @@ void ThreadProxy::SetVisible(bool visible)
void ThreadProxy::setVisibleOnImplThread(CompletionEvent* completion, bool visible)
{
TRACE_EVENT0("cc", "ThreadProxy::setVisibleOnImplThread");
- m_layerTreeHostImpl->setVisible(visible);
+ m_layerTreeHostImpl->SetVisible(visible);
m_schedulerOnImplThread->setVisible(visible);
completion->signal();
}
@@ -287,7 +287,7 @@ void ThreadProxy::SetNeedsAnimate()
if (m_commitRequestSentToImplThread)
return;
m_commitRequestSentToImplThread = true;
- Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::setNeedsCommitOnImplThread, m_implThreadWeakPtr));
+ Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::SetNeedsCommitOnImplThread, m_implThreadWeakPtr));
}
void ThreadProxy::SetNeedsCommit()
@@ -301,10 +301,10 @@ void ThreadProxy::SetNeedsCommit()
if (m_commitRequestSentToImplThread)
return;
m_commitRequestSentToImplThread = true;
- Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::setNeedsCommitOnImplThread, m_implThreadWeakPtr));
+ Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::SetNeedsCommitOnImplThread, m_implThreadWeakPtr));
}
-void ThreadProxy::didLoseOutputSurfaceOnImplThread()
+void ThreadProxy::DidLoseOutputSurfaceOnImplThread()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::didLoseOutputSurfaceOnImplThread");
@@ -315,14 +315,14 @@ void ThreadProxy::checkOutputSurfaceStatusOnImplThread()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::checkOutputSurfaceStatusOnImplThread");
- if (!m_layerTreeHostImpl->isContextLost())
+ if (!m_layerTreeHostImpl->IsContextLost())
return;
- if (cc::ContextProvider* offscreenContexts = m_layerTreeHostImpl->resourceProvider()->offscreen_context_provider())
+ if (cc::ContextProvider* offscreenContexts = m_layerTreeHostImpl->resource_provider()->offscreen_context_provider())
offscreenContexts->VerifyContexts();
m_schedulerOnImplThread->didLoseOutputSurface();
}
-void ThreadProxy::onSwapBuffersCompleteOnImplThread()
+void ThreadProxy::OnSwapBuffersCompleteOnImplThread()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::onSwapBuffersCompleteOnImplThread");
@@ -330,35 +330,35 @@ void ThreadProxy::onSwapBuffersCompleteOnImplThread()
Proxy::MainThread()->postTask(base::Bind(&ThreadProxy::didCompleteSwapBuffers, m_mainThreadWeakPtr));
}
-void ThreadProxy::onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval)
+void ThreadProxy::OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval)
{
DCHECK(IsImplThread());
TRACE_EVENT2("cc", "ThreadProxy::onVSyncParametersChanged", "timebase", (timebase - base::TimeTicks()).InMilliseconds(), "interval", interval.InMilliseconds());
m_schedulerOnImplThread->setTimebaseAndInterval(timebase, interval);
}
-void ThreadProxy::onCanDrawStateChanged(bool canDraw)
+void ThreadProxy::OnCanDrawStateChanged(bool canDraw)
{
DCHECK(IsImplThread());
TRACE_EVENT1("cc", "ThreadProxy::onCanDrawStateChanged", "canDraw", canDraw);
m_schedulerOnImplThread->setCanDraw(canDraw);
}
-void ThreadProxy::onHasPendingTreeStateChanged(bool hasPendingTree)
+void ThreadProxy::OnHasPendingTreeStateChanged(bool hasPendingTree)
{
DCHECK(IsImplThread());
TRACE_EVENT1("cc", "ThreadProxy::onHasPendingTreeStateChanged", "hasPendingTree", hasPendingTree);
m_schedulerOnImplThread->setHasPendingTree(hasPendingTree);
}
-void ThreadProxy::setNeedsCommitOnImplThread()
+void ThreadProxy::SetNeedsCommitOnImplThread()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::setNeedsCommitOnImplThread");
m_schedulerOnImplThread->setNeedsCommit();
}
-void ThreadProxy::setNeedsManageTilesOnImplThread()
+void ThreadProxy::SetNeedsManageTilesOnImplThread()
{
if (m_manageTilesPending)
return;
@@ -371,7 +371,7 @@ void ThreadProxy::manageTilesOnImplThread()
// TODO(nduca): If needed, move this into CCSchedulerStateMachine.
m_manageTilesPending = false;
if (m_layerTreeHostImpl)
- m_layerTreeHostImpl->manageTiles();
+ m_layerTreeHostImpl->ManageTiles();
}
void ThreadProxy::setNeedsForcedCommitOnImplThread()
@@ -381,21 +381,21 @@ void ThreadProxy::setNeedsForcedCommitOnImplThread()
m_schedulerOnImplThread->setNeedsForcedCommit();
}
-void ThreadProxy::postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime)
+void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime)
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::postAnimationEventsToMainThreadOnImplThread");
Proxy::MainThread()->postTask(base::Bind(&ThreadProxy::setAnimationEvents, m_mainThreadWeakPtr, base::Passed(&events), wallClockTime));
}
-bool ThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff)
+bool ThreadProxy::ReduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff)
{
DCHECK(IsImplThread());
if (!m_layerTreeHost->contents_texture_manager())
return false;
- bool reduceResult = m_layerTreeHost->contents_texture_manager()->reduceMemoryOnImplThread(limitBytes, priorityCutoff, m_layerTreeHostImpl->resourceProvider());
+ bool reduceResult = m_layerTreeHost->contents_texture_manager()->reduceMemoryOnImplThread(limitBytes, priorityCutoff, m_layerTreeHostImpl->resource_provider());
if (!reduceResult)
return false;
@@ -406,17 +406,17 @@ bool ThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
return true;
}
-void ThreadProxy::reduceWastedContentsTextureMemoryOnImplThread()
+void ThreadProxy::ReduceWastedContentsTextureMemoryOnImplThread()
{
DCHECK(IsImplThread());
if (!m_layerTreeHost->contents_texture_manager())
return;
- m_layerTreeHost->contents_texture_manager()->reduceWastedMemoryOnImplThread(m_layerTreeHostImpl->resourceProvider());
+ m_layerTreeHost->contents_texture_manager()->reduceWastedMemoryOnImplThread(m_layerTreeHostImpl->resource_provider());
}
-void ThreadProxy::sendManagedMemoryStats()
+void ThreadProxy::SendManagedMemoryStats()
{
DCHECK(IsImplThread());
if (!m_layerTreeHostImpl.get())
@@ -430,13 +430,13 @@ void ThreadProxy::sendManagedMemoryStats()
if (m_layerTreeHost->settings().implSidePainting)
return;
- m_layerTreeHostImpl->sendManagedMemoryStats(
+ m_layerTreeHostImpl->SendManagedMemoryStats(
m_layerTreeHost->contents_texture_manager()->memoryVisibleBytes(),
m_layerTreeHost->contents_texture_manager()->memoryVisibleAndNearbyBytes(),
m_layerTreeHost->contents_texture_manager()->memoryUseBytes());
}
-bool ThreadProxy::isInsideDraw()
+bool ThreadProxy::IsInsideDraw()
{
return m_insideDraw;
}
@@ -446,7 +446,7 @@ void ThreadProxy::SetNeedsRedraw()
DCHECK(IsMainThread());
TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedraw");
Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::setFullRootLayerDamageOnImplThread, m_implThreadWeakPtr));
- Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::setNeedsRedrawOnImplThread, m_implThreadWeakPtr));
+ Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::SetNeedsRedrawOnImplThread, m_implThreadWeakPtr));
}
void ThreadProxy::SetDeferCommits(bool deferCommits)
@@ -470,7 +470,7 @@ bool ThreadProxy::CommitRequested() const
return m_commitRequested;
}
-void ThreadProxy::setNeedsRedrawOnImplThread()
+void ThreadProxy::SetNeedsRedrawOnImplThread()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::setNeedsRedrawOnImplThread");
@@ -484,7 +484,7 @@ void ThreadProxy::didSwapUseIncompleteTileOnImplThread()
m_schedulerOnImplThread->didSwapUseIncompleteTile();
}
-void ThreadProxy::didUploadVisibleHighResolutionTileOnImplThread()
+void ThreadProxy::DidUploadVisibleHighResolutionTileOnImplThread()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::didUploadVisibleHighResolutionTileOnImplThread");
@@ -494,7 +494,7 @@ void ThreadProxy::didUploadVisibleHighResolutionTileOnImplThread()
void ThreadProxy::MainThreadHasStoppedFlinging()
{
if (m_inputHandlerOnImplThread)
- m_inputHandlerOnImplThread->mainThreadHasStoppedFlinging();
+ m_inputHandlerOnImplThread->MainThreadHasStoppedFlinging();
}
void ThreadProxy::Start()
@@ -555,7 +555,7 @@ void ThreadProxy::finishAllRenderingOnImplThread(CompletionEvent* completion)
{
TRACE_EVENT0("cc", "ThreadProxy::finishAllRenderingOnImplThread");
DCHECK(IsImplThread());
- m_layerTreeHostImpl->finishAllRendering();
+ m_layerTreeHostImpl->FinishAllRendering();
completion->signal();
}
@@ -578,10 +578,10 @@ void ThreadProxy::scheduledActionBeginFrame()
TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame");
scoped_ptr<BeginFrameAndCommitState> beginFrameState(new BeginFrameAndCommitState);
beginFrameState->monotonicFrameBeginTime = base::TimeTicks::Now();
- beginFrameState->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
- beginFrameState->implTransform = m_layerTreeHostImpl->activeTree()->ImplTransform();
- DCHECK_GT(m_layerTreeHostImpl->memoryAllocationLimitBytes(), 0u);
- beginFrameState->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
+ beginFrameState->scrollInfo = m_layerTreeHostImpl->ProcessScrollDeltas();
+ beginFrameState->implTransform = m_layerTreeHostImpl->active_tree()->ImplTransform();
+ DCHECK_GT(m_layerTreeHostImpl->memory_allocation_limit_bytes(), 0u);
+ beginFrameState->memoryAllocationLimitBytes = m_layerTreeHostImpl->memory_allocation_limit_bytes();
Proxy::MainThread()->postTask(base::Bind(&ThreadProxy::beginFrame, m_mainThreadWeakPtr, base::Passed(&beginFrameState)));
if (m_beginFrameCompletionEventOnImplThread) {
@@ -721,7 +721,7 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Re
return;
}
- m_layerTreeHostImpl->resourceProvider()->SetOffscreenContextProvider(offscreenContextProvider);
+ m_layerTreeHostImpl->resource_provider()->SetOffscreenContextProvider(offscreenContextProvider);
if (m_layerTreeHost->contents_texture_manager()->linkedEvictedBackingsExist()) {
// Clear any uploads we were making to textures linked to evicted
@@ -729,12 +729,12 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Re
queue->clearUploadsToEvictedResources();
// Some textures in the layer tree are invalid. Kick off another commit
// to fill them again.
- setNeedsCommitOnImplThread();
+ SetNeedsCommitOnImplThread();
}
m_layerTreeHost->contents_texture_manager()->pushTexturePrioritiesToBackings();
- m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::Create(this, Proxy::ImplThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider());
+ m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::Create(this, Proxy::ImplThread(), queue.Pass(), m_layerTreeHostImpl->resource_provider());
m_currentResourceUpdateControllerOnImplThread->PerformMoreUpdates(
m_schedulerOnImplThread->anticipatedDrawTime());
@@ -762,10 +762,10 @@ void ThreadProxy::scheduledActionCommit()
m_currentResourceUpdateControllerOnImplThread->Finalize();
m_currentResourceUpdateControllerOnImplThread.reset();
- m_layerTreeHostImpl->beginCommit();
+ m_layerTreeHostImpl->BeginCommit();
m_layerTreeHost->BeginCommitOnImplThread(m_layerTreeHostImpl.get());
m_layerTreeHost->FinishCommitOnImplThread(m_layerTreeHostImpl.get());
- m_layerTreeHostImpl->commitComplete();
+ m_layerTreeHostImpl->CommitComplete();
m_nextFrameIsNewlyCommittedFrameOnImplThread = true;
@@ -791,14 +791,14 @@ void ThreadProxy::scheduledActionCheckForCompletedTileUploads()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::scheduledActionCheckForCompletedTileUploads");
- m_layerTreeHostImpl->checkForCompletedTileUploads();
+ m_layerTreeHostImpl->CheckForCompletedTileUploads();
}
void ThreadProxy::scheduledActionActivatePendingTreeIfNeeded()
{
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::scheduledActionActivatePendingTreeIfNeeded");
- m_layerTreeHostImpl->activatePendingTreeIfNeeded();
+ m_layerTreeHostImpl->ActivatePendingTreeIfNeeded();
}
void ThreadProxy::scheduledActionBeginContextRecreation()
@@ -830,10 +830,10 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal
base::Time wallClockTime = base::Time::Now();
if (m_inputHandlerOnImplThread.get())
- m_inputHandlerOnImplThread->animate(monotonicTime);
+ m_inputHandlerOnImplThread->Animate(monotonicTime);
- m_layerTreeHostImpl->activatePendingTreeIfNeeded();
- m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
+ m_layerTreeHostImpl->ActivatePendingTreeIfNeeded();
+ m_layerTreeHostImpl->Animate(monotonicTime, wallClockTime);
// This method is called on a forced draw, regardless of whether we are able to produce a frame,
// as the calling site on main thread is blocked until its request completes, and we signal
@@ -845,18 +845,18 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal
// prepareToDraw(), it is guarded on canDraw() as well.
LayerTreeHostImpl::FrameData frame;
- bool drawFrame = m_layerTreeHostImpl->canDraw() && (m_layerTreeHostImpl->prepareToDraw(frame) || forcedDraw);
+ bool drawFrame = m_layerTreeHostImpl->CanDraw() && (m_layerTreeHostImpl->PrepareToDraw(&frame) || forcedDraw);
if (drawFrame) {
- m_layerTreeHostImpl->drawLayers(frame);
+ m_layerTreeHostImpl->DrawLayers(&frame);
result.didDraw = true;
}
- m_layerTreeHostImpl->didDrawAllLayers(frame);
+ m_layerTreeHostImpl->DidDrawAllLayers(frame);
// Check for tree activation.
- if (m_completionEventForCommitHeldOnTreeActivation && !m_layerTreeHostImpl->pendingTree())
+ if (m_completionEventForCommitHeldOnTreeActivation && !m_layerTreeHostImpl->pending_tree())
{
TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation");
- DCHECK(m_layerTreeHostImpl->Settings().implSidePainting);
+ DCHECK(m_layerTreeHostImpl->settings().implSidePainting);
m_completionEventForCommitHeldOnTreeActivation->signal();
m_completionEventForCommitHeldOnTreeActivation = 0;
}
@@ -865,15 +865,15 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal
if (m_readbackRequestOnImplThread) {
m_readbackRequestOnImplThread->success = false;
if (drawFrame) {
- m_layerTreeHostImpl->readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);
- m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->isContextLost();
+ m_layerTreeHostImpl->Readback(m_readbackRequestOnImplThread->pixels, m_readbackRequestOnImplThread->rect);
+ m_readbackRequestOnImplThread->success = !m_layerTreeHostImpl->IsContextLost();
}
m_readbackRequestOnImplThread->completion.signal();
m_readbackRequestOnImplThread = 0;
} else if (drawFrame) {
- result.didSwap = m_layerTreeHostImpl->swapBuffers();
+ result.didSwap = m_layerTreeHostImpl->SwapBuffers();
- if (frame.containsIncompleteTile)
+ if (frame.contains_incomplete_tile)
didSwapUseIncompleteTileOnImplThread();
}
@@ -886,7 +886,7 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal
if (drawFrame)
checkOutputSurfaceStatusOnImplThread();
- m_layerTreeHostImpl->beginNextFrame();
+ m_layerTreeHostImpl->BeginNextFrame();
return result;
}
@@ -1016,7 +1016,7 @@ void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputH
m_inputHandlerOnImplThread = scoped_ptr<InputHandler>(handler);
if (m_inputHandlerOnImplThread.get())
- m_inputHandlerOnImplThread->bindToClient(m_layerTreeHostImpl.get());
+ m_inputHandlerOnImplThread->BindToClient(m_layerTreeHostImpl.get());
m_implThreadWeakPtr = m_weakFactoryOnImplThread.GetWeakPtr();
completion->signal();
@@ -1034,14 +1034,14 @@ void ThreadProxy::initializeRendererOnImplThread(CompletionEvent* completion, bo
TRACE_EVENT0("cc", "ThreadProxy::initializeRendererOnImplThread");
DCHECK(IsImplThread());
DCHECK(m_outputSurfaceBeforeInitializationOnImplThread.get());
- *initializeSucceeded = m_layerTreeHostImpl->initializeRenderer(m_outputSurfaceBeforeInitializationOnImplThread.Pass());
+ *initializeSucceeded = m_layerTreeHostImpl->InitializeRenderer(m_outputSurfaceBeforeInitializationOnImplThread.Pass());
if (*initializeSucceeded) {
- *capabilities = m_layerTreeHostImpl->rendererCapabilities();
+ *capabilities = m_layerTreeHostImpl->GetRendererCapabilities();
m_schedulerOnImplThread->setSwapBuffersCompleteSupported(
capabilities->using_swap_complete_callback);
int maxFramesPending = FrameRateController::kDefaultMaxFramesPending;
- if (m_layerTreeHostImpl->outputSurface()->capabilities().has_parent_compositor)
+ if (m_layerTreeHostImpl->output_surface()->capabilities().has_parent_compositor)
maxFramesPending = 1;
m_schedulerOnImplThread->setMaxFramesPending(maxFramesPending);
}
@@ -1053,7 +1053,7 @@ void ThreadProxy::layerTreeHostClosedOnImplThread(CompletionEvent* completion)
{
TRACE_EVENT0("cc", "ThreadProxy::layerTreeHostClosedOnImplThread");
DCHECK(IsImplThread());
- m_layerTreeHost->DeleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
+ m_layerTreeHost->DeleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resource_provider());
m_inputHandlerOnImplThread.reset();
m_layerTreeHostImpl.reset();
m_schedulerOnImplThread.reset();
@@ -1076,11 +1076,11 @@ void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion,
{
TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurfaceOnImplThread");
DCHECK(IsImplThread());
- m_layerTreeHost->DeleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
- *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
+ m_layerTreeHost->DeleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resource_provider());
+ *recreateSucceeded = m_layerTreeHostImpl->InitializeRenderer(outputSurface.Pass());
if (*recreateSucceeded) {
- *capabilities = m_layerTreeHostImpl->rendererCapabilities();
- m_layerTreeHostImpl->resourceProvider()->SetOffscreenContextProvider(offscreenContextProvider);
+ *capabilities = m_layerTreeHostImpl->GetRendererCapabilities();
+ m_layerTreeHostImpl->resource_provider()->SetOffscreenContextProvider(offscreenContextProvider);
m_schedulerOnImplThread->didRecreateOutputSurface();
} else if (offscreenContextProvider) {
offscreenContextProvider->VerifyContexts();
@@ -1091,7 +1091,7 @@ void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion,
void ThreadProxy::renderingStatsOnImplThread(CompletionEvent* completion, RenderingStats* stats)
{
DCHECK(IsImplThread());
- m_layerTreeHostImpl->renderingStats(stats);
+ m_layerTreeHostImpl->CollectRenderingStats(stats);
completion->signal();
}
@@ -1123,7 +1123,7 @@ scoped_ptr<base::Value> ThreadProxy::AsValue() const
void ThreadProxy::asValueOnImplThread(CompletionEvent* completion, base::DictionaryValue* state) const
{
- state->Set("layer_tree_host_impl", m_layerTreeHostImpl->asValue().release());
+ state->Set("layer_tree_host_impl", m_layerTreeHostImpl->AsValue().release());
completion->signal();
}
@@ -1142,7 +1142,7 @@ bool ThreadProxy::CommitPendingForTesting()
void ThreadProxy::commitPendingOnImplThreadForTesting(CommitPendingRequest* request)
{
DCHECK(IsImplThread());
- if (m_layerTreeHostImpl->outputSurface())
+ if (m_layerTreeHostImpl->output_surface())
request->commitPending = m_schedulerOnImplThread->commitPending();
else
request->commitPending = false;
@@ -1168,16 +1168,16 @@ skia::RefPtr<SkPicture> ThreadProxy::CapturePicture()
void ThreadProxy::capturePictureOnImplThread(CompletionEvent* completion, skia::RefPtr<SkPicture>* picture)
{
DCHECK(IsImplThread());
- *picture = m_layerTreeHostImpl->capturePicture();
+ *picture = m_layerTreeHostImpl->CapturePicture();
completion->signal();
}
-void ThreadProxy::renewTreePriority()
+void ThreadProxy::RenewTreePriority()
{
bool smoothnessTakesPriority =
- m_layerTreeHostImpl->pinchGestureActive() ||
- m_layerTreeHostImpl->currentlyScrollingLayer() ||
- m_layerTreeHostImpl->pageScaleAnimationActive();
+ m_layerTreeHostImpl->pinch_gesture_active() ||
+ m_layerTreeHostImpl->CurrentlyScrollingLayer() ||
+ m_layerTreeHostImpl->page_scale_animation_active();
// Update expiration time if smoothness currently takes priority.
if (smoothnessTakesPriority) {
@@ -1195,17 +1195,17 @@ void ThreadProxy::renewTreePriority()
// New content always takes priority when the active tree has
// evicted resources or there is an invalid viewport size.
- if (m_layerTreeHostImpl->activeTree()->ContentsTexturesPurged() ||
- m_layerTreeHostImpl->activeTree()->ViewportSizeInvalid())
+ if (m_layerTreeHostImpl->active_tree()->ContentsTexturesPurged() ||
+ m_layerTreeHostImpl->active_tree()->ViewportSizeInvalid())
priority = NEW_CONTENT_TAKES_PRIORITY;
- m_layerTreeHostImpl->setTreePriority(priority);
+ m_layerTreeHostImpl->SetTreePriority(priority);
// Notify the the client of this compositor via the output surface.
// TODO(epenner): Route this to compositor-thread instead of output-surface
// after GTFO refactor of compositor-thread (http://crbug/170828).
- if (m_layerTreeHostImpl->outputSurface()) {
- m_layerTreeHostImpl->outputSurface()->UpdateSmoothnessTakesPriority(
+ if (m_layerTreeHostImpl->output_surface()) {
+ m_layerTreeHostImpl->output_surface()->UpdateSmoothnessTakesPriority(
priority == SMOOTHNESS_TAKES_PRIORITY);
}
@@ -1232,7 +1232,7 @@ void ThreadProxy::renewTreePriorityOnImplThread()
DCHECK(m_renewTreePriorityOnImplThreadPending);
m_renewTreePriorityOnImplThreadPending = false;
- renewTreePriority();
+ RenewTreePriority();
}
} // namespace cc
diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h
index 1b027e0..a56b5be 100644
--- a/cc/thread_proxy.h
+++ b/cc/thread_proxy.h
@@ -59,21 +59,21 @@ public:
virtual bool CommitPendingForTesting() OVERRIDE;
// LayerTreeHostImplClient implementation
- virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE;
- virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE;
- virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
- virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE;
- virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE;
- virtual void setNeedsRedrawOnImplThread() OVERRIDE;
- virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE;
- virtual void setNeedsCommitOnImplThread() OVERRIDE;
- virtual void setNeedsManageTilesOnImplThread() OVERRIDE;
- virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) OVERRIDE;
- virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE;
- virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE;
- virtual void sendManagedMemoryStats() OVERRIDE;
- virtual bool isInsideDraw() OVERRIDE;
- virtual void renewTreePriority() OVERRIDE;
+ virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE;
+ virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE;
+ virtual void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
+ virtual void OnCanDrawStateChanged(bool canDraw) OVERRIDE;
+ virtual void OnHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE;
+ virtual void SetNeedsRedrawOnImplThread() OVERRIDE;
+ virtual void DidUploadVisibleHighResolutionTileOnImplThread() OVERRIDE;
+ virtual void SetNeedsCommitOnImplThread() OVERRIDE;
+ virtual void SetNeedsManageTilesOnImplThread() OVERRIDE;
+ virtual void PostAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) OVERRIDE;
+ virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) OVERRIDE;
+ virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE;
+ virtual void SendManagedMemoryStats() OVERRIDE;
+ virtual bool IsInsideDraw() OVERRIDE;
+ virtual void RenewTreePriority() OVERRIDE;
// SchedulerClient implementation
virtual void scheduledActionBeginFrame() OVERRIDE;
diff --git a/cc/tiled_layer_impl_unittest.cc b/cc/tiled_layer_impl_unittest.cc
index c816f91..bdf9f7b 100644
--- a/cc/tiled_layer_impl_unittest.cc
+++ b/cc/tiled_layer_impl_unittest.cc
@@ -30,7 +30,7 @@ public:
// visibility of the entire layer size.
scoped_ptr<TiledLayerImpl> createLayer(const gfx::Size& tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption borderTexels)
{
- scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::Create(m_hostImpl.activeTree(), 1);
+ scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::Create(m_hostImpl.active_tree(), 1);
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(tileSize, borderTexels);
tiler->setBounds(layerSize);
layer->setTilingData(*tiler);
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index 52293aa..e955155 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -196,7 +196,7 @@ public:
TEST_F(TiledLayerTest, pushDirtyTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->SetBounds(gfx::Size(100, 200));
@@ -220,7 +220,7 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
TestOcclusionTracker occluded;
m_occlusion = &occluded;
layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000));
@@ -257,7 +257,7 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
TEST_F(TiledLayerTest, pushDeletedTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->SetBounds(gfx::Size(100, 200));
@@ -291,7 +291,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
TEST_F(TiledLayerTest, pushIdlePaintTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
// This paints 1 visible of the 25 invalid tiles.
@@ -327,7 +327,7 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles)
TEST_F(TiledLayerTest, predictivePainting)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// Prepainting should occur in the scroll direction first, and the
// visible rect should be extruded only along the dominant axis.
@@ -400,9 +400,9 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
// Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later.
m_resourceManager->setMaxMemoryLimitBytes(2 * 1024 * 1024);
scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl1 = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl1 = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl2 = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 2));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl2 = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 2));
// For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from
// layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint
@@ -453,7 +453,7 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
TestOcclusionTracker occluded;
m_occlusion = &occluded;
@@ -473,7 +473,7 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// The tile size is 100x100, so this invalidates and then paints two tiles.
// However, during the paint, we invalidate one of the tiles. This should
@@ -493,8 +493,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
{
scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layer1Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
- scoped_ptr<FakeTiledLayerImpl> layer2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 2));
+ scoped_ptr<FakeTiledLayerImpl> layer1Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layer2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 2));
// Invalidate a tile on layer1, during update of layer 2.
layer2->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer1.get());
@@ -517,8 +517,8 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
{
scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layer1Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
- scoped_ptr<FakeTiledLayerImpl> layer2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 2));
+ scoped_ptr<FakeTiledLayerImpl> layer1Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layer2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 2));
layer1->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer2.get());
layer1->SetBounds(gfx::Size(100, 200));
@@ -559,7 +559,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
m_resourceManager->setMaxMemoryLimitBytes(memoryForLayer);
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// Full size layer with half being visible.
layer->SetBounds(gfx::Size(layerWidth, layerHeight));
@@ -599,7 +599,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
TEST_F(TiledLayerTest, idlePaintOutOfMemory)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// We have enough memory for only the visible rect, so we will run out of memory in first idle paint.
int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel.
@@ -623,7 +623,7 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory)
TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
bool animating[2] = {false, true};
for (int i = 0; i < 2; i++) {
@@ -651,7 +651,7 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// Alternate between not visible and visible.
gfx::Rect v(0, 0, 100, 100);
@@ -682,7 +682,7 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
TEST_F(TiledLayerTest, invalidateFromPrepare)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->SetBounds(gfx::Size(100, 200));
@@ -756,7 +756,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get()));
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
// Create a layer with one tile.
layer->SetBounds(gfx::Size(100, 100));
@@ -911,7 +911,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
layer_tree_host_->UpdateLayers(m_queue.get(),
std::numeric_limits<size_t>::max());
{
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
EXPECT_EQ(6, m_queue->fullUploadSize());
EXPECT_EQ(0, m_queue->partialUploadSize());
updateTextures();
@@ -926,7 +926,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150));
layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max());
{
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
EXPECT_EQ(3, m_queue->fullUploadSize());
EXPECT_EQ(3, m_queue->partialUploadSize());
updateTextures();
@@ -940,7 +940,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Partial update of 6 tiles.
layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
{
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max());
EXPECT_EQ(2, m_queue->fullUploadSize());
EXPECT_EQ(4, m_queue->partialUploadSize());
@@ -955,7 +955,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Checkerboard all tiles.
layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200));
{
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
layerPushPropertiesTo(layer.get(), layerImpl.get());
}
layer_tree_host_->CommitComplete();
@@ -963,7 +963,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Partial update of 6 checkerboard tiles.
layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
{
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max());
EXPECT_EQ(6, m_queue->fullUploadSize());
EXPECT_EQ(0, m_queue->partialUploadSize());
@@ -978,7 +978,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates)
// Partial update of 4 tiles.
layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100));
{
- scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1));
+ scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), 1));
layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max());
EXPECT_EQ(0, m_queue->fullUploadSize());
EXPECT_EQ(4, m_queue->partialUploadSize());
@@ -1478,9 +1478,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
child->fakeLayerUpdater()->clearUpdateCount();
child2->fakeLayerUpdater()->clearUpdateCount();
- scoped_ptr<FakeTiledLayerImpl> rootImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), root->id()));
- scoped_ptr<FakeTiledLayerImpl> childImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), child->id()));
- scoped_ptr<FakeTiledLayerImpl> child2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), child2->id()));
+ scoped_ptr<FakeTiledLayerImpl> rootImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), root->id()));
+ scoped_ptr<FakeTiledLayerImpl> childImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), child->id()));
+ scoped_ptr<FakeTiledLayerImpl> child2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), child2->id()));
layerPushPropertiesTo(root.get(), rootImpl.get());
layerPushPropertiesTo(child.get(), childImpl.get());
layerPushPropertiesTo(child2.get(), child2Impl.get());
@@ -1512,9 +1512,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
child->fakeLayerUpdater()->clearUpdateCount();
child2->fakeLayerUpdater()->clearUpdateCount();
- scoped_ptr<FakeTiledLayerImpl> rootImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), root->id()));
- scoped_ptr<FakeTiledLayerImpl> childImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), child->id()));
- scoped_ptr<FakeTiledLayerImpl> child2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), child2->id()));
+ scoped_ptr<FakeTiledLayerImpl> rootImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), root->id()));
+ scoped_ptr<FakeTiledLayerImpl> childImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), child->id()));
+ scoped_ptr<FakeTiledLayerImpl> child2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), child2->id()));
layerPushPropertiesTo(root.get(), rootImpl.get());
layerPushPropertiesTo(child.get(), childImpl.get());
layerPushPropertiesTo(child2.get(), child2Impl.get());
@@ -1547,9 +1547,9 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
child->fakeLayerUpdater()->clearUpdateCount();
child2->fakeLayerUpdater()->clearUpdateCount();
- scoped_ptr<FakeTiledLayerImpl> rootImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), root->id()));
- scoped_ptr<FakeTiledLayerImpl> childImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), child->id()));
- scoped_ptr<FakeTiledLayerImpl> child2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), child2->id()));
+ scoped_ptr<FakeTiledLayerImpl> rootImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), root->id()));
+ scoped_ptr<FakeTiledLayerImpl> childImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), child->id()));
+ scoped_ptr<FakeTiledLayerImpl> child2Impl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->active_tree(), child2->id()));
layerPushPropertiesTo(root.get(), rootImpl.get());
layerPushPropertiesTo(child.get(), childImpl.get());
layerPushPropertiesTo(child2.get(), child2Impl.get());
diff --git a/cc/tree_synchronizer_unittest.cc b/cc/tree_synchronizer_unittest.cc
index b7879bf..88d4436 100644
--- a/cc/tree_synchronizer_unittest.cc
+++ b/cc/tree_synchronizer_unittest.cc
@@ -143,7 +143,7 @@ protected:
// return a null tree.
TEST_F(TreeSynchronizerTest, syncNullTree)
{
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(static_cast<Layer*>(NULL), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(static_cast<Layer*>(NULL), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
EXPECT_TRUE(!layerImplTreeRoot.get());
}
@@ -155,9 +155,9 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeFromEmpty)
layerTreeRoot->AddChild(Layer::Create());
layerTreeRoot->AddChild(Layer::Create());
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
}
// Constructs a very simple tree and synchronizes it attempting to reuse some layers
@@ -169,8 +169,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
layerTreeRoot->AddChild(MockLayer::Create(&layerImplDestructionList));
layerTreeRoot->AddChild(MockLayer::Create(&layerImplDestructionList));
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// We have to push properties to pick up the destruction list pointer.
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
@@ -182,8 +182,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeReusingLayers)
int secondLayerImplId = layerImplTreeRoot->children()[1]->id();
// Synchronize again. After the sync the trees should be equivalent and we should have created and destroyed one LayerImpl.
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
ASSERT_EQ(1u, layerImplDestructionList.size());
EXPECT_EQ(secondLayerImplId, layerImplDestructionList[0]);
@@ -200,8 +200,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
scoped_refptr<Layer> child2 = MockLayer::Create(&layerImplDestructionList);
layerTreeRoot->AddChild(MockLayer::Create(&layerImplDestructionList));
layerTreeRoot->AddChild(child2);
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// We have to push properties to pick up the destruction list pointer.
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
@@ -211,8 +211,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeAndTrackStackingOrderChange)
// re-insert the layer and sync again.
child2->RemoveFromParent();
layerTreeRoot->AddChild(child2);
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
@@ -238,8 +238,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeAndProperties)
gfx::Size secondChildBounds = gfx::Size(25, 53);
layerTreeRoot->children()[1]->SetBounds(secondChildBounds);
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
@@ -276,8 +276,8 @@ TEST_F(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange)
layerB->AddChild(MockLayer::Create(&layerImplDestructionList));
scoped_refptr<Layer> layerD = layerB->children()[1].get();
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// We have to push properties to pick up the destruction list pointer.
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
@@ -297,8 +297,8 @@ TEST_F(TreeSynchronizerTest, reuseLayerImplsAfterStructuralChange)
layerC->AddChild(layerB);
// After another synchronize our trees should match and we should not have destroyed any LayerImpls
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
EXPECT_EQ(0u, layerImplDestructionList.size());
}
@@ -316,8 +316,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
int oldTreeFirstChildLayerId = oldLayerTreeRoot->children()[0]->id();
int oldTreeSecondChildLayerId = oldLayerTreeRoot->children()[1]->id();
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
- expectTreesAreIdentical(oldLayerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(oldLayerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(oldLayerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// We have to push properties to pick up the destruction list pointer.
TreeSynchronizer::pushProperties(oldLayerTreeRoot.get(), layerImplTreeRoot.get());
@@ -327,8 +327,8 @@ TEST_F(TreeSynchronizerTest, syncSimpleTreeThenDestroy)
// Synchronize again. After the sync all LayerImpls from the old tree should be deleted.
scoped_refptr<Layer> newLayerTreeRoot = Layer::Create();
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(newLayerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(newLayerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(newLayerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
ASSERT_EQ(3u, layerImplDestructionList.size());
@@ -359,24 +359,24 @@ TEST_F(TreeSynchronizerTest, syncMaskReplicaAndReplicaMaskLayers)
replicaLayerWithMask->SetMaskLayer(replicaMaskLayer.get());
layerTreeRoot->children()[2]->SetReplicaLayer(replicaLayerWithMask.get());
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// Remove the mask layer.
layerTreeRoot->children()[0]->SetMaskLayer(0);
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// Remove the replica layer.
layerTreeRoot->children()[1]->SetReplicaLayer(0);
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
// Remove the replica mask.
replicaLayerWithMask->SetMaskLayer(0);
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
- expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
+ expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), m_hostImpl.active_tree());
}
TEST_F(TreeSynchronizerTest, synchronizeAnimations)
@@ -384,7 +384,7 @@ TEST_F(TreeSynchronizerTest, synchronizeAnimations)
LayerTreeSettings settings;
FakeProxy proxy(scoped_ptr<Thread>(NULL));
DebugScopedSetImplThread impl(&proxy);
- scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings, 0, &proxy);
+ scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::Create(settings, NULL, &proxy);
scoped_refptr<Layer> layerTreeRoot = Layer::Create();
@@ -392,9 +392,9 @@ TEST_F(TreeSynchronizerTest, synchronizeAnimations)
EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer_animation_controller())->synchronizedAnimations());
- scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree());
+ scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.active_tree());
TreeSynchronizer::pushProperties(layerTreeRoot.get(), layerImplTreeRoot.get());
- layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.activeTree());
+ layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), layerImplTreeRoot.Pass(), m_hostImpl.active_tree());
EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer_animation_controller())->synchronizedAnimations());
}