diff options
author | loyso <loyso@chromium.org> | 2015-05-26 18:05:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-27 01:06:17 +0000 |
commit | ac00846c699607e5b7834e8aacc537a101678096 (patch) | |
tree | f631386ffec16f677c46fdca47563e096a428029 /ui/compositor | |
parent | 06b7fd242f6ada7f0e001055bbb541a7546ae74b (diff) | |
download | chromium_src-ac00846c699607e5b7834e8aacc537a101678096.zip chromium_src-ac00846c699607e5b7834e8aacc537a101678096.tar.gz chromium_src-ac00846c699607e5b7834e8aacc537a101678096.tar.bz2 |
Clean up ui<->cc layers interface.
Previous episode:
https://codereview.chromium.org/1101823002
BUG=394777
R=piman@chromium.org
R=ajuma@chromium.org
R=vollick@chromium.org
Review URL: https://codereview.chromium.org/1159633002
Cr-Commit-Position: refs/heads/master@{#331498}
Diffstat (limited to 'ui/compositor')
-rw-r--r-- | ui/compositor/compositor.cc | 8 | ||||
-rw-r--r-- | ui/compositor/dip_util.cc | 3 | ||||
-rw-r--r-- | ui/compositor/layer.cc | 37 | ||||
-rw-r--r-- | ui/compositor/layer.h | 8 | ||||
-rw-r--r-- | ui/compositor/layer_animation_element.cc | 6 | ||||
-rw-r--r-- | ui/compositor/layer_unittest.cc | 143 |
6 files changed, 107 insertions, 98 deletions
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index e40abff..c6e2daf 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -167,7 +167,7 @@ Compositor::~Compositor() { DCHECK(begin_frame_observer_list_.empty()); if (root_layer_) - root_layer_->SetCompositor(NULL); + root_layer_->ResetCompositor(); // Stop all outstanding draws before telling the ContextFactory to tear // down any contexts that the |host_| may rely upon. @@ -189,13 +189,11 @@ void Compositor::SetRootLayer(Layer* root_layer) { if (root_layer_ == root_layer) return; if (root_layer_) - root_layer_->SetCompositor(NULL); + root_layer_->ResetCompositor(); root_layer_ = root_layer; - if (root_layer_ && !root_layer_->GetCompositor()) - root_layer_->SetCompositor(this); root_web_layer_->RemoveAllChildren(); if (root_layer_) - root_web_layer_->AddChild(root_layer_->cc_layer()); + root_layer_->SetCompositor(this, root_web_layer_); } void Compositor::SetHostHasTransparentBackground( diff --git a/ui/compositor/dip_util.cc b/ui/compositor/dip_util.cc index 7356383..62e995f 100644 --- a/ui/compositor/dip_util.cc +++ b/ui/compositor/dip_util.cc @@ -103,8 +103,7 @@ void SnapLayerToPhysicalPixelBoundary(ui::Layer* snapped_layer, origin = layer_to_snap->GetTargetBounds().origin() + layer_to_snap->subpixel_position_offset(); } else { - cc::Layer* cc_layer = layer_to_snap->cc_layer(); - origin = cc_layer->position(); + origin = layer_to_snap->position(); } CheckSnapped((layer_offset.x() + origin.x()) * scale_factor); CheckSnapped((layer_offset.y() + origin.y()) * scale_factor); diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index 8625815..fc18bca 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -128,6 +128,7 @@ Layer::~Layer() { layer_mask_back_link_->SetMaskLayer(NULL); for (size_t i = 0; i < children_.size(); ++i) children_[i]->parent_ = NULL; + cc_layer_->RemoveLayerAnimationEventObserver(this); cc_layer_->RemoveFromParent(); } @@ -157,22 +158,29 @@ float Layer::opacity() const { return cc_layer_->opacity(); } -void Layer::SetCompositor(Compositor* compositor) { - // This function must only be called to set the compositor on the root layer, - // or to reset it. - DCHECK(!compositor || !compositor_); - DCHECK(!compositor || compositor->root_layer() == this); +void Layer::SetCompositor(Compositor* compositor, + scoped_refptr<cc::Layer> root_layer) { + // This function must only be called to set the compositor on the root ui + // layer. + DCHECK(compositor); + DCHECK(!compositor_); + DCHECK(compositor->root_layer() == this); DCHECK(!parent_); - if (compositor_) { + + compositor_ = compositor; + OnDeviceScaleFactorChanged(compositor->device_scale_factor()); + AddAnimatorsInTreeToCollection(compositor_->layer_animator_collection()); + + root_layer->AddChild(cc_layer_); + SendPendingThreadedAnimations(); +} + +void Layer::ResetCompositor() { + DCHECK(!parent_); + if (compositor_) RemoveAnimatorsInTreeFromCollection( compositor_->layer_animator_collection()); - } - compositor_ = compositor; - if (compositor) { - OnDeviceScaleFactorChanged(compositor->device_scale_factor()); - SendPendingThreadedAnimations(); - AddAnimatorsInTreeToCollection(compositor_->layer_animator_collection()); - } + compositor_ = nullptr; } void Layer::Add(Layer* child) { @@ -353,8 +361,7 @@ void Layer::SetMaskLayer(Layer* layer_mask) { if (layer_mask_) layer_mask_->layer_mask_back_link_ = NULL; layer_mask_ = layer_mask; - cc_layer_->SetMaskLayer( - layer_mask ? layer_mask->cc_layer() : NULL); + cc_layer_->SetMaskLayer(layer_mask ? layer_mask->cc_layer_ : NULL); // We need to reference the linked object so that it can properly break the // link to us when it gets deleted. if (layer_mask) { diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index 066d079..8120197 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -91,7 +91,9 @@ class COMPOSITOR_EXPORT Layer // Called by the compositor when the Layer is set as its root Layer. This can // only ever be called on the root layer. - void SetCompositor(Compositor* compositor); + void SetCompositor(Compositor* compositor, + scoped_refptr<cc::Layer> root_layer); + void ResetCompositor(); LayerDelegate* delegate() { return delegate_; } void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } @@ -144,6 +146,8 @@ class COMPOSITOR_EXPORT Layer void SetTransform(const gfx::Transform& transform); gfx::Transform transform() const; + gfx::PointF position() const { return cc_layer_->position(); } + // Return the target transform if animator is running, or the current // transform otherwise. gfx::Transform GetTargetTransform() const; @@ -355,7 +359,7 @@ class COMPOSITOR_EXPORT Layer ContentLayerClient::PaintingControlSetting painting_control) override; bool FillsBoundsCompletely() const override; - cc::Layer* cc_layer() { return cc_layer_; } + cc::Layer* cc_layer_for_testing() { return cc_layer_; } // TextureLayerClient bool PrepareTextureMailbox( diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc index 7c3cf8c..1d4a241 100644 --- a/ui/compositor/layer_animation_element.cc +++ b/ui/compositor/layer_animation_element.cc @@ -340,7 +340,7 @@ class ThreadedLayerAnimationElement : public LayerAnimationElement { if (t < 1.0) return false; - if (Started()) { + if (Started() && IsThreaded()) { delegate->RemoveThreadedAnimation(animation_id()); } @@ -349,14 +349,14 @@ class ThreadedLayerAnimationElement : public LayerAnimationElement { } void OnAbort(LayerAnimationDelegate* delegate) override { - if (delegate && Started()) { + if (delegate && Started() && IsThreaded()) { delegate->RemoveThreadedAnimation(animation_id()); } } void RequestEffectiveStart(LayerAnimationDelegate* delegate) override { DCHECK(animation_group_id()); - if (duration() == base::TimeDelta()) { + if (!IsThreaded()) { set_effective_start_time(requested_start_time()); return; } diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index bb3c63d..44ac816 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc @@ -669,14 +669,14 @@ TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { l1->SetVisible(false); l1->SetBounds(gfx::Rect(4, 5)); - EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin()); - EXPECT_TRUE(l1->cc_layer()->DrawsContent()); - EXPECT_TRUE(l1->cc_layer()->contents_opaque()); - EXPECT_TRUE(l1->cc_layer()->force_render_surface()); - EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer()->bounds()); + EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); + EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); + EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); + EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); + EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); - cc::Layer* before_layer = l1->cc_layer(); + cc::Layer* before_layer = l1->cc_layer_for_testing(); bool callback1_run = false; cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0); @@ -684,14 +684,14 @@ TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { base::Bind(ReturnMailbox, &callback1_run)), gfx::Size(10, 10)); - EXPECT_NE(before_layer, l1->cc_layer()); + EXPECT_NE(before_layer, l1->cc_layer_for_testing()); - EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin()); - EXPECT_TRUE(l1->cc_layer()->DrawsContent()); - EXPECT_TRUE(l1->cc_layer()->contents_opaque()); - EXPECT_TRUE(l1->cc_layer()->force_render_surface()); - EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer()->bounds()); + EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); + EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); + EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); + EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); + EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); EXPECT_FALSE(callback1_run); bool callback2_run = false; @@ -704,15 +704,15 @@ TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { // Show solid color instead. l1->SetShowSolidColorContent(); - EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin()); - EXPECT_TRUE(l1->cc_layer()->DrawsContent()); - EXPECT_TRUE(l1->cc_layer()->contents_opaque()); - EXPECT_TRUE(l1->cc_layer()->force_render_surface()); - EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer()->bounds()); + EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); + EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); + EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); + EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); + EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); EXPECT_TRUE(callback2_run); - before_layer = l1->cc_layer(); + before_layer = l1->cc_layer_for_testing(); // Back to a texture, without changing the bounds of the layer or the texture. bool callback3_run = false; @@ -721,14 +721,14 @@ TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { base::Bind(ReturnMailbox, &callback3_run)), gfx::Size(10, 10)); - EXPECT_NE(before_layer, l1->cc_layer()); + EXPECT_NE(before_layer, l1->cc_layer_for_testing()); - EXPECT_EQ(gfx::Point3F(), l1->cc_layer()->transform_origin()); - EXPECT_TRUE(l1->cc_layer()->DrawsContent()); - EXPECT_TRUE(l1->cc_layer()->contents_opaque()); - EXPECT_TRUE(l1->cc_layer()->force_render_surface()); - EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer()->bounds()); + EXPECT_EQ(gfx::Point3F(), l1->cc_layer_for_testing()->transform_origin()); + EXPECT_TRUE(l1->cc_layer_for_testing()->DrawsContent()); + EXPECT_TRUE(l1->cc_layer_for_testing()->contents_opaque()); + EXPECT_TRUE(l1->cc_layer_for_testing()->force_render_surface()); + EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_EQ(gfx::Size(4, 5), l1->cc_layer_for_testing()->bounds()); EXPECT_FALSE(callback3_run); // Release the on |l1| mailbox to clean up the test. @@ -752,9 +752,9 @@ TEST_F(LayerWithNullDelegateTest, Visibility) { EXPECT_TRUE(l1->IsDrawn()); EXPECT_TRUE(l2->IsDrawn()); EXPECT_TRUE(l3->IsDrawn()); - EXPECT_FALSE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree()); - EXPECT_FALSE(l3->cc_layer()->hide_layer_and_subtree()); + EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_FALSE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); compositor()->SetRootLayer(l1.get()); @@ -764,25 +764,25 @@ TEST_F(LayerWithNullDelegateTest, Visibility) { EXPECT_FALSE(l1->IsDrawn()); EXPECT_FALSE(l2->IsDrawn()); EXPECT_FALSE(l3->IsDrawn()); - EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree()); - EXPECT_FALSE(l3->cc_layer()->hide_layer_and_subtree()); + EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_FALSE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); l3->SetVisible(false); EXPECT_FALSE(l1->IsDrawn()); EXPECT_FALSE(l2->IsDrawn()); EXPECT_FALSE(l3->IsDrawn()); - EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree()); - EXPECT_TRUE(l3->cc_layer()->hide_layer_and_subtree()); + EXPECT_TRUE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_TRUE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); l1->SetVisible(true); EXPECT_TRUE(l1->IsDrawn()); EXPECT_TRUE(l2->IsDrawn()); EXPECT_FALSE(l3->IsDrawn()); - EXPECT_FALSE(l1->cc_layer()->hide_layer_and_subtree()); - EXPECT_FALSE(l2->cc_layer()->hide_layer_and_subtree()); - EXPECT_TRUE(l3->cc_layer()->hide_layer_and_subtree()); + EXPECT_FALSE(l1->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_FALSE(l2->cc_layer_for_testing()->hide_layer_and_subtree()); + EXPECT_TRUE(l3->cc_layer_for_testing()->hide_layer_and_subtree()); } // Checks that stacking-related methods behave as advertised. @@ -1294,9 +1294,9 @@ TEST_F(LayerWithRealCompositorTest, ScaleUpDown) { EXPECT_EQ("10,20 200x220", root->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); - gfx::Size cc_bounds_size = root->cc_layer()->bounds(); + gfx::Size cc_bounds_size = root->cc_layer_for_testing()->bounds(); EXPECT_EQ("200x220", cc_bounds_size.ToString()); - cc_bounds_size = l1->cc_layer()->bounds(); + cc_bounds_size = l1->cc_layer_for_testing()->bounds(); EXPECT_EQ("140x180", cc_bounds_size.ToString()); // No scale change, so no scale notification. EXPECT_EQ(0.0f, root_delegate.device_scale_factor()); @@ -1307,9 +1307,9 @@ TEST_F(LayerWithRealCompositorTest, ScaleUpDown) { EXPECT_EQ("10,20 200x220", root->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); // CC layer should still match the UI layer bounds. - cc_bounds_size = root->cc_layer()->bounds(); + cc_bounds_size = root->cc_layer_for_testing()->bounds(); EXPECT_EQ("200x220", cc_bounds_size.ToString()); - cc_bounds_size = l1->cc_layer()->bounds(); + cc_bounds_size = l1->cc_layer_for_testing()->bounds(); EXPECT_EQ("140x180", cc_bounds_size.ToString()); // New scale factor must have been notified. Make sure painting happens at // right scale. @@ -1321,9 +1321,9 @@ TEST_F(LayerWithRealCompositorTest, ScaleUpDown) { EXPECT_EQ("10,20 200x220", root->bounds().ToString()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); // CC layer should still match the UI layer bounds. - cc_bounds_size = root->cc_layer()->bounds(); + cc_bounds_size = root->cc_layer_for_testing()->bounds(); EXPECT_EQ("200x220", cc_bounds_size.ToString()); - cc_bounds_size = l1->cc_layer()->bounds(); + cc_bounds_size = l1->cc_layer_for_testing()->bounds(); EXPECT_EQ("140x180", cc_bounds_size.ToString()); // New scale factor must have been notified. Make sure painting happens at // right scale. @@ -1354,7 +1354,7 @@ TEST_F(LayerWithRealCompositorTest, ScaleReparent) { root->Add(l1.get()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); - gfx::Size cc_bounds_size = l1->cc_layer()->bounds(); + gfx::Size cc_bounds_size = l1->cc_layer_for_testing()->bounds(); EXPECT_EQ("140x180", cc_bounds_size.ToString()); EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); @@ -1365,12 +1365,12 @@ TEST_F(LayerWithRealCompositorTest, ScaleReparent) { GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); // Sanity check on root and l1. EXPECT_EQ("10,20 200x220", root->bounds().ToString()); - cc_bounds_size = l1->cc_layer()->bounds(); + cc_bounds_size = l1->cc_layer_for_testing()->bounds(); EXPECT_EQ("140x180", cc_bounds_size.ToString()); root->Add(l1.get()); EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); - cc_bounds_size = l1->cc_layer()->bounds(); + cc_bounds_size = l1->cc_layer_for_testing()->bounds(); EXPECT_EQ("140x180", cc_bounds_size.ToString()); EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); } @@ -1442,12 +1442,12 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) { frame_provider = new cc::DelegatedFrameProvider( resource_collection.get(), MakeFrameData(gfx::Size(10, 10))); child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); - EXPECT_EQ(child->cc_layer()->bounds().ToString(), + EXPECT_EQ(child->cc_layer_for_testing()->bounds().ToString(), gfx::Size(10, 10).ToString()); // Content larger than layer. child->SetBounds(gfx::Rect(0, 0, 5, 5)); - EXPECT_EQ(child->cc_layer()->bounds().ToString(), + EXPECT_EQ(child->cc_layer_for_testing()->bounds().ToString(), gfx::Size(5, 5).ToString()); // Content smaller than layer. @@ -1455,25 +1455,26 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) { frame_provider = new cc::DelegatedFrameProvider( resource_collection.get(), MakeFrameData(gfx::Size(5, 5))); child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(5, 5)); - EXPECT_EQ(child->cc_layer()->bounds().ToString(), gfx::Size(5, 5).ToString()); + EXPECT_EQ(child->cc_layer_for_testing()->bounds().ToString(), + gfx::Size(5, 5).ToString()); // Hi-DPI content on low-DPI layer. frame_provider = new cc::DelegatedFrameProvider( resource_collection.get(), MakeFrameData(gfx::Size(20, 20))); child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); - EXPECT_EQ(child->cc_layer()->bounds().ToString(), + EXPECT_EQ(child->cc_layer_for_testing()->bounds().ToString(), gfx::Size(10, 10).ToString()); // Hi-DPI content on hi-DPI layer. compositor()->SetScaleAndSize(2.f, gfx::Size(1000, 1000)); - EXPECT_EQ(child->cc_layer()->bounds().ToString(), + EXPECT_EQ(child->cc_layer_for_testing()->bounds().ToString(), gfx::Size(10, 10).ToString()); // Low-DPI content on hi-DPI layer. frame_provider = new cc::DelegatedFrameProvider( resource_collection.get(), MakeFrameData(gfx::Size(10, 10))); child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); - EXPECT_EQ(child->cc_layer()->bounds().ToString(), + EXPECT_EQ(child->cc_layer_for_testing()->bounds().ToString(), gfx::Size(10, 10).ToString()); } @@ -1487,10 +1488,10 @@ TEST_F(LayerWithDelegateTest, ExternalContent) { // The layer is already showing solid color content, so the cc layer won't // change. - scoped_refptr<cc::Layer> before = child->cc_layer(); + scoped_refptr<cc::Layer> before = child->cc_layer_for_testing(); child->SetShowSolidColorContent(); - EXPECT_TRUE(child->cc_layer()); - EXPECT_EQ(before.get(), child->cc_layer()); + EXPECT_TRUE(child->cc_layer_for_testing()); + EXPECT_EQ(before.get(), child->cc_layer_for_testing()); scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection = new cc::DelegatedFrameResourceCollection; @@ -1499,16 +1500,16 @@ TEST_F(LayerWithDelegateTest, ExternalContent) { MakeFrameData(gfx::Size(10, 10))); // Showing delegated content changes the underlying cc layer. - before = child->cc_layer(); + before = child->cc_layer_for_testing(); child->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); - EXPECT_TRUE(child->cc_layer()); - EXPECT_NE(before.get(), child->cc_layer()); + EXPECT_TRUE(child->cc_layer_for_testing()); + EXPECT_NE(before.get(), child->cc_layer_for_testing()); // Changing to painted content should change the underlying cc layer. - before = child->cc_layer(); + before = child->cc_layer_for_testing(); child->SetShowSolidColorContent(); - EXPECT_TRUE(child->cc_layer()); - EXPECT_NE(before.get(), child->cc_layer()); + EXPECT_TRUE(child->cc_layer_for_testing()); + EXPECT_NE(before.get(), child->cc_layer_for_testing()); } // Verifies that layer filters still attached after changing implementation @@ -1516,12 +1517,12 @@ TEST_F(LayerWithDelegateTest, ExternalContent) { TEST_F(LayerWithDelegateTest, LayerFiltersSurvival) { scoped_ptr<Layer> layer(CreateLayer(LAYER_TEXTURED)); layer->SetBounds(gfx::Rect(0, 0, 10, 10)); - EXPECT_TRUE(layer->cc_layer()); - EXPECT_EQ(0u, layer->cc_layer()->filters().size()); + EXPECT_TRUE(layer->cc_layer_for_testing()); + EXPECT_EQ(0u, layer->cc_layer_for_testing()->filters().size()); layer->SetLayerGrayscale(0.5f); EXPECT_EQ(layer->layer_grayscale(), 0.5f); - EXPECT_EQ(1u, layer->cc_layer()->filters().size()); + EXPECT_EQ(1u, layer->cc_layer_for_testing()->filters().size()); scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection = new cc::DelegatedFrameResourceCollection; @@ -1530,12 +1531,12 @@ TEST_F(LayerWithDelegateTest, LayerFiltersSurvival) { MakeFrameData(gfx::Size(10, 10))); // Showing delegated content changes the underlying cc layer. - scoped_refptr<cc::Layer> before = layer->cc_layer(); + scoped_refptr<cc::Layer> before = layer->cc_layer_for_testing(); layer->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); EXPECT_EQ(layer->layer_grayscale(), 0.5f); - EXPECT_TRUE(layer->cc_layer()); - EXPECT_NE(before.get(), layer->cc_layer()); - EXPECT_EQ(1u, layer->cc_layer()->filters().size()); + EXPECT_TRUE(layer->cc_layer_for_testing()); + EXPECT_NE(before.get(), layer->cc_layer_for_testing()); + EXPECT_EQ(1u, layer->cc_layer_for_testing()->filters().size()); } // Tests Layer::AddThreadedAnimation and Layer::RemoveThreadedAnimation. |