From 0940d410fd6f1da81a07a963a8b485cee310918f Mon Sep 17 00:00:00 2001 From: loyso Date: Sun, 13 Mar 2016 18:30:31 -0700 Subject: CC Animation: Erase cc::LayerSettings everywhere. Also, erase LayerTreeSettings::use_compositor_animation_timelines flag. BUG=575041 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1783613004 Cr-Commit-Position: refs/heads/master@{#380914} --- cc/layers/heads_up_display_layer.cc | 10 +- cc/layers/heads_up_display_layer.h | 5 +- cc/layers/heads_up_display_unittest.cc | 2 +- cc/layers/io_surface_layer.cc | 9 +- cc/layers/io_surface_layer.h | 4 +- cc/layers/layer.cc | 10 +- cc/layers/layer.h | 6 +- cc/layers/layer_perftest.cc | 3 +- cc/layers/layer_position_constraint_unittest.cc | 31 +- cc/layers/layer_proto_converter.cc | 8 +- cc/layers/layer_proto_converter_unittest.cc | 48 ++- cc/layers/layer_settings.cc | 13 - cc/layers/layer_settings.h | 22 -- cc/layers/layer_unittest.cc | 382 +++++++++++------------- cc/layers/layer_utils_unittest.cc | 10 +- cc/layers/nine_patch_layer.cc | 11 +- cc/layers/nine_patch_layer.h | 4 +- cc/layers/nine_patch_layer_unittest.cc | 4 +- cc/layers/painted_scrollbar_layer.cc | 11 +- cc/layers/painted_scrollbar_layer.h | 5 +- cc/layers/painted_scrollbar_layer_unittest.cc | 5 +- cc/layers/picture_image_layer.cc | 9 +- cc/layers/picture_image_layer.h | 4 +- cc/layers/picture_image_layer_unittest.cc | 4 +- cc/layers/picture_layer.cc | 19 +- cc/layers/picture_layer.h | 8 +- cc/layers/picture_layer_impl_unittest.cc | 8 +- cc/layers/picture_layer_unittest.cc | 36 +-- cc/layers/scrollbar_layer_unittest.cc | 99 +++--- cc/layers/solid_color_layer.cc | 9 +- cc/layers/solid_color_layer.h | 4 +- cc/layers/solid_color_layer_impl_unittest.cc | 8 +- cc/layers/solid_color_scrollbar_layer.cc | 10 +- cc/layers/solid_color_scrollbar_layer.h | 4 +- cc/layers/surface_layer.cc | 12 +- cc/layers/surface_layer.h | 4 +- cc/layers/surface_layer_unittest.cc | 9 +- cc/layers/texture_layer.cc | 9 +- cc/layers/texture_layer.h | 3 +- cc/layers/texture_layer_unittest.cc | 45 ++- cc/layers/ui_resource_layer.cc | 9 +- cc/layers/ui_resource_layer.h | 4 +- cc/layers/ui_resource_layer_unittest.cc | 21 +- cc/layers/video_layer.cc | 8 +- cc/layers/video_layer.h | 8 +- 45 files changed, 391 insertions(+), 566 deletions(-) delete mode 100644 cc/layers/layer_settings.cc delete mode 100644 cc/layers/layer_settings.h (limited to 'cc/layers') diff --git a/cc/layers/heads_up_display_layer.cc b/cc/layers/heads_up_display_layer.cc index a34ca42..8d581dc 100644 --- a/cc/layers/heads_up_display_layer.cc +++ b/cc/layers/heads_up_display_layer.cc @@ -13,14 +13,12 @@ namespace cc { -scoped_refptr HeadsUpDisplayLayer::Create( - const LayerSettings& settings) { - return make_scoped_refptr(new HeadsUpDisplayLayer(settings)); +scoped_refptr HeadsUpDisplayLayer::Create() { + return make_scoped_refptr(new HeadsUpDisplayLayer()); } -HeadsUpDisplayLayer::HeadsUpDisplayLayer(const LayerSettings& settings) - : Layer(settings), - typeface_(skia::AdoptRef( +HeadsUpDisplayLayer::HeadsUpDisplayLayer() + : typeface_(skia::AdoptRef( SkTypeface::CreateFromName("times new roman", SkTypeface::kNormal))) { if (!typeface_) { typeface_ = skia::AdoptRef( diff --git a/cc/layers/heads_up_display_layer.h b/cc/layers/heads_up_display_layer.h index 23b3407a..5d416c2 100644 --- a/cc/layers/heads_up_display_layer.h +++ b/cc/layers/heads_up_display_layer.h @@ -21,8 +21,7 @@ class LayerNode; class CC_EXPORT HeadsUpDisplayLayer : public Layer { public: - static scoped_refptr Create( - const LayerSettings& settings); + static scoped_refptr Create(); void PrepareForCalculateDrawProperties( const gfx::Size& device_viewport, float device_scale_factor); @@ -35,7 +34,7 @@ class CC_EXPORT HeadsUpDisplayLayer : public Layer { void PushPropertiesTo(LayerImpl* layer) override; protected: - explicit HeadsUpDisplayLayer(const LayerSettings& settings); + HeadsUpDisplayLayer(); bool HasDrawableContent() const override; private: diff --git a/cc/layers/heads_up_display_unittest.cc b/cc/layers/heads_up_display_unittest.cc index 532a169..1801021 100644 --- a/cc/layers/heads_up_display_unittest.cc +++ b/cc/layers/heads_up_display_unittest.cc @@ -26,7 +26,7 @@ class DrawsContentLayer : public Layer { bool DrawsContent() const override { return true; } private: - DrawsContentLayer() : Layer(LayerSettings()) {} + DrawsContentLayer() {} ~DrawsContentLayer() override {} }; diff --git a/cc/layers/io_surface_layer.cc b/cc/layers/io_surface_layer.cc index 7fb3f3f1..0934f1e 100644 --- a/cc/layers/io_surface_layer.cc +++ b/cc/layers/io_surface_layer.cc @@ -10,14 +10,11 @@ namespace cc { -scoped_refptr IOSurfaceLayer::Create( - const LayerSettings& settings) { - return make_scoped_refptr(new IOSurfaceLayer(settings)); +scoped_refptr IOSurfaceLayer::Create() { + return make_scoped_refptr(new IOSurfaceLayer()); } -IOSurfaceLayer::IOSurfaceLayer(const LayerSettings& settings) - : Layer(settings), io_surface_id_(0) { -} +IOSurfaceLayer::IOSurfaceLayer() : io_surface_id_(0) {} IOSurfaceLayer::~IOSurfaceLayer() {} diff --git a/cc/layers/io_surface_layer.h b/cc/layers/io_surface_layer.h index a88492f..c0883094 100644 --- a/cc/layers/io_surface_layer.h +++ b/cc/layers/io_surface_layer.h @@ -15,7 +15,7 @@ namespace cc { class CC_EXPORT IOSurfaceLayer : public Layer { public: - static scoped_refptr Create(const LayerSettings& settings); + static scoped_refptr Create(); void SetIOSurfaceProperties(uint32_t io_surface_id, const gfx::Size& size); @@ -25,7 +25,7 @@ class CC_EXPORT IOSurfaceLayer : public Layer { protected: bool HasDrawableContent() const override; - explicit IOSurfaceLayer(const LayerSettings& settings); + IOSurfaceLayer(); private: ~IOSurfaceLayer() override; diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 854effe..9883c5c 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -22,7 +22,6 @@ #include "cc/layers/layer_client.h" #include "cc/layers/layer_impl.h" #include "cc/layers/layer_proto_converter.h" -#include "cc/layers/layer_settings.h" #include "cc/layers/scrollbar_layer_interface.h" #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" @@ -41,11 +40,11 @@ namespace cc { base::StaticAtomicSequenceNumber g_next_layer_id; -scoped_refptr Layer::Create(const LayerSettings& settings) { - return make_scoped_refptr(new Layer(settings)); +scoped_refptr Layer::Create() { + return make_scoped_refptr(new Layer()); } -Layer::Layer(const LayerSettings& settings) +Layer::Layer() : needs_push_properties_(false), num_dependents_need_push_properties_(0), // Layer IDs start from 1. @@ -97,8 +96,7 @@ Layer::Layer(const LayerSettings& settings) replica_layer_(nullptr), client_(nullptr), num_unclipped_descendants_(0), - frame_timing_requests_dirty_(false) { -} + frame_timing_requests_dirty_(false) {} Layer::~Layer() { // Our parent should be holding a reference to us so there should be no diff --git a/cc/layers/layer.h b/cc/layers/layer.h index c14f14d..97023d0 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -55,7 +55,6 @@ class CopyOutputRequest; class LayerAnimationEventObserver; class LayerClient; class LayerImpl; -class LayerSettings; class LayerTreeHost; class LayerTreeHostCommon; class LayerTreeImpl; @@ -82,7 +81,7 @@ class CC_EXPORT Layer : public base::RefCounted { INVALID_ID = -1, }; - static scoped_refptr Create(const LayerSettings& settings); + static scoped_refptr Create(); int id() const { return layer_id_; } @@ -534,8 +533,7 @@ class CC_EXPORT Layer : public base::RefCounted { friend class LayerImpl; friend class TreeSynchronizer; virtual ~Layer(); - - explicit Layer(const LayerSettings& settings); + Layer(); // These SetNeeds functions are in order of severity of update: // diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc index e27f0309..d3c1191 100644 --- a/cc/layers/layer_perftest.cc +++ b/cc/layers/layer_perftest.cc @@ -6,7 +6,6 @@ #include "base/thread_task_runner_handle.h" #include "cc/debug/lap_timer.h" -#include "cc/layers/layer_settings.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_layer_tree_host_client.h" @@ -57,7 +56,7 @@ class LayerPerfTest : public testing::Test { }; TEST_F(LayerPerfTest, PushPropertiesTo) { - scoped_refptr test_layer = Layer::Create(LayerSettings()); + scoped_refptr test_layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc index b2cc0df..7cc7db0 100644 --- a/cc/layers/layer_position_constraint_unittest.cc +++ b/cc/layers/layer_position_constraint_unittest.cc @@ -8,7 +8,6 @@ #include "cc/layers/layer.h" #include "cc/layers/layer_impl.h" -#include "cc/layers/layer_settings.h" #include "cc/proto/layer_position_constraint.pb.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_proxy.h" @@ -22,8 +21,7 @@ namespace { class LayerWithForcedDrawsContent : public Layer { public: - explicit LayerWithForcedDrawsContent(const LayerSettings& settings) - : Layer(settings) {} + LayerWithForcedDrawsContent() {} bool DrawsContent() const override; @@ -88,16 +86,14 @@ class LayerPositionConstraintTest : public testing::Test { void CreateTreeForTest() { // scroll_layer_ is the inner viewport scroll layer and child_ is the outer // viewport scroll layer. - root_ = Layer::Create(layer_settings_); - inner_viewport_container_layer_ = Layer::Create(layer_settings_); - scroll_layer_ = Layer::Create(layer_settings_); - outer_viewport_container_layer_ = Layer::Create(layer_settings_); - child_transform_layer_ = Layer::Create(layer_settings_); - child_ = Layer::Create(layer_settings_); - grand_child_ = - make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings_)); - great_grand_child_ = - make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings_)); + root_ = Layer::Create(); + inner_viewport_container_layer_ = Layer::Create(); + scroll_layer_ = Layer::Create(); + outer_viewport_container_layer_ = Layer::Create(); + child_transform_layer_ = Layer::Create(); + child_ = Layer::Create(); + grand_child_ = make_scoped_refptr(new LayerWithForcedDrawsContent()); + great_grand_child_ = make_scoped_refptr(new LayerWithForcedDrawsContent()); gfx::Transform IdentityMatrix; gfx::Point3F transform_origin; @@ -175,7 +171,6 @@ class LayerPositionConstraintTest : public testing::Test { FakeLayerTreeHostClient fake_client_; TestTaskGraphRunner task_graph_runner_; scoped_ptr layer_tree_host_; - LayerSettings layer_settings_; scoped_refptr root_; scoped_refptr inner_viewport_container_layer_; scoped_refptr scroll_layer_; @@ -554,7 +549,7 @@ TEST_F(LayerPositionConstraintTest, // Add one more layer to the test tree for this scenario. scoped_refptr fixed_position_child = - make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings_)); + make_scoped_refptr(new LayerWithForcedDrawsContent()); SetLayerPropertiesForTesting(fixed_position_child.get(), gfx::Transform(), gfx::Point3F(), gfx::PointF(), gfx::Size(100, 100), true); @@ -711,7 +706,7 @@ TEST_F( // Add one more layer to the test tree for this scenario. scoped_refptr fixed_position_child = - make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings_)); + make_scoped_refptr(new LayerWithForcedDrawsContent()); SetLayerPropertiesForTesting(fixed_position_child.get(), gfx::Transform(), gfx::Point3F(), gfx::PointF(), gfx::Size(100, 100), true); @@ -1043,7 +1038,7 @@ TEST_F(LayerPositionConstraintTest, // Add one more layer to the hierarchy for this test. scoped_refptr great_great_grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings_)); + make_scoped_refptr(new LayerWithForcedDrawsContent()); great_grand_child_->AddChild(great_great_grand_child); child_->SetIsContainerForFixedPositionLayers(true); @@ -1096,7 +1091,7 @@ TEST_F(LayerPositionConstraintTest, // This test checks for correct scroll compensation when the fixed-position // container is the inner viewport scroll layer and has non-zero bounds delta. scoped_refptr fixed_child = - make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings_)); + make_scoped_refptr(new LayerWithForcedDrawsContent()); fixed_child->SetBounds(gfx::Size(300, 300)); scroll_layer_->AddChild(fixed_child); fixed_child->SetPositionConstraint(fixed_to_top_left_); diff --git a/cc/layers/layer_proto_converter.cc b/cc/layers/layer_proto_converter.cc index 19215c9..921028fe 100644 --- a/cc/layers/layer_proto_converter.cc +++ b/cc/layers/layer_proto_converter.cc @@ -8,7 +8,6 @@ #include "cc/layers/empty_content_layer_client.h" #include "cc/layers/heads_up_display_layer.h" #include "cc/layers/layer.h" -#include "cc/layers/layer_settings.h" #include "cc/layers/picture_layer.h" #include "cc/proto/layer.pb.h" #include "cc/trees/layer_tree_host_common.h" @@ -113,12 +112,11 @@ scoped_refptr LayerProtoConverter::FindOrAllocateAndConstruct( // layer type we don't support. case proto::LayerNode::UNKNOWN: case proto::LayerNode::LAYER: - return Layer::Create(LayerSettings()).get(); + return Layer::Create().get(); case proto::LayerNode::PICTURE_LAYER: - return PictureLayer::Create(LayerSettings(), - EmptyContentLayerClient::GetInstance()); + return PictureLayer::Create(EmptyContentLayerClient::GetInstance()); case proto::LayerNode::HEADS_UP_DISPLAY_LAYER: - return HeadsUpDisplayLayer::Create(LayerSettings()); + return HeadsUpDisplayLayer::Create(); } // TODO(nyquist): Add the rest of the necessary LayerTypes. This function // should not return null. diff --git a/cc/layers/layer_proto_converter_unittest.cc b/cc/layers/layer_proto_converter_unittest.cc index af1e902..fd88da4 100644 --- a/cc/layers/layer_proto_converter_unittest.cc +++ b/cc/layers/layer_proto_converter_unittest.cc @@ -7,7 +7,6 @@ #include "cc/layers/empty_content_layer_client.h" #include "cc/layers/heads_up_display_layer.h" #include "cc/layers/layer.h" -#include "cc/layers/layer_settings.h" #include "cc/layers/picture_layer.h" #include "cc/proto/layer.pb.h" #include "cc/test/fake_layer_tree_host.h" @@ -48,7 +47,7 @@ TEST_F(LayerProtoConverterTest, TestKeepingRoot) { c The old root node will be reused during deserialization. */ - scoped_refptr old_root = Layer::Create(LayerSettings()); + scoped_refptr old_root = Layer::Create(); proto::LayerNode root_node; root_node.set_id(old_root->id()); root_node.set_type(proto::LayerNode::LAYER); @@ -144,7 +143,7 @@ TEST_F(LayerProtoConverterTest, TestSwappingRoot) { child_c_node->set_type(proto::LayerNode::LAYER); child_c_node->set_parent_id(child_b_node->id()); - scoped_refptr old_root = Layer::Create(LayerSettings()); + scoped_refptr old_root = Layer::Create(); scoped_refptr new_root = LayerProtoConverter::DeserializeLayerHierarchy(old_root, root_node); @@ -175,13 +174,13 @@ TEST_F(LayerProtoConverterTest, RecursivePropertiesSerialization) { Layers marked with + have descendants with changed properties. Layer b also has a mask layer and a replica layer. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b_mask = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b_replica = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); - scoped_refptr layer_src_d = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_b_mask = Layer::Create(); + scoped_refptr layer_src_b_replica = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); + scoped_refptr layer_src_d = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); layer_src_a->AddChild(layer_src_c); @@ -294,10 +293,10 @@ TEST_F(LayerProtoConverterTest, RecursivePropertiesSerializationSingleChild) { Layers marked with + have descendants with changed properties. Layer b also has a mask layer. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b_mask = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_b_mask = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); layer_src_root->AddChild(layer_src_b); layer_src_b->AddChild(layer_src_c); layer_src_b->SetMaskLayer(layer_src_b_mask.get()); @@ -361,7 +360,7 @@ TEST_F(LayerProtoConverterTest, DeserializeLayerProperties) { */ proto::LayerUpdate updates; - scoped_refptr root = Layer::Create(LayerSettings()); + scoped_refptr root = Layer::Create(); root->SetLayerTreeHost(layer_tree_host_.get()); proto::LayerProperties* root_props = updates.add_layers(); root_props->set_id(root->id()); @@ -369,7 +368,7 @@ TEST_F(LayerProtoConverterTest, DeserializeLayerProperties) { root_props->set_num_dependents_need_push_properties(1); root_props->mutable_base(); - scoped_refptr a = Layer::Create(LayerSettings()); + scoped_refptr a = Layer::Create(); a->SetLayerTreeHost(layer_tree_host_.get()); proto::LayerProperties* a_props = updates.add_layers(); a_props->set_id(a->id()); @@ -377,7 +376,7 @@ TEST_F(LayerProtoConverterTest, DeserializeLayerProperties) { a_props->set_num_dependents_need_push_properties(0); root->AddChild(a); - scoped_refptr b = Layer::Create(LayerSettings()); + scoped_refptr b = Layer::Create(); b->SetLayerTreeHost(layer_tree_host_.get()); proto::LayerProperties* b_props = updates.add_layers(); b_props->set_id(b->id()); @@ -385,7 +384,7 @@ TEST_F(LayerProtoConverterTest, DeserializeLayerProperties) { b_props->set_num_dependents_need_push_properties(1); root->AddChild(b); - scoped_refptr c = Layer::Create(LayerSettings()); + scoped_refptr c = Layer::Create(); c->SetLayerTreeHost(layer_tree_host_.get()); proto::LayerProperties* c_props = updates.add_layers(); c_props->set_id(c->id()); @@ -415,8 +414,8 @@ TEST_F(LayerProtoConverterTest, DeserializeLayerProperties) { TEST_F(LayerProtoConverterTest, PictureLayerTypeSerialization) { // Make sure that PictureLayers serialize to the // proto::LayerType::PICTURE_LAYER type. - scoped_refptr layer = PictureLayer::Create( - LayerSettings(), EmptyContentLayerClient::GetInstance()); + scoped_refptr layer = + PictureLayer::Create(EmptyContentLayerClient::GetInstance()); proto::LayerNode layer_hierarchy; LayerProtoConverter::SerializeLayerHierarchy(layer.get(), &layer_hierarchy); @@ -426,8 +425,8 @@ TEST_F(LayerProtoConverterTest, PictureLayerTypeSerialization) { TEST_F(LayerProtoConverterTest, PictureLayerTypeDeserialization) { // Make sure that proto::LayerType::PICTURE_LAYER ends up building a // PictureLayer. - scoped_refptr old_root = PictureLayer::Create( - LayerSettings(), EmptyContentLayerClient::GetInstance()); + scoped_refptr old_root = + PictureLayer::Create(EmptyContentLayerClient::GetInstance()); proto::LayerNode root_node; root_node.set_id(old_root->id()); root_node.set_type(proto::LayerNode::PICTURE_LAYER); @@ -448,8 +447,7 @@ TEST_F(LayerProtoConverterTest, PictureLayerTypeDeserialization) { TEST_F(LayerProtoConverterTest, HudLayerTypeSerialization) { // Make sure that PictureLayers serialize to the // proto::LayerType::HEADS_UP_DISPLAY_LAYER type. - scoped_refptr layer = - HeadsUpDisplayLayer::Create(LayerSettings()); + scoped_refptr layer = HeadsUpDisplayLayer::Create(); proto::LayerNode layer_hierarchy; LayerProtoConverter::SerializeLayerHierarchy(layer.get(), &layer_hierarchy); @@ -459,7 +457,7 @@ TEST_F(LayerProtoConverterTest, HudLayerTypeSerialization) { TEST_F(LayerProtoConverterTest, HudLayerTypeDeserialization) { // Make sure that proto::LayerType::HEADS_UP_DISPLAY_LAYER ends up building a // HeadsUpDisplayLayer. - scoped_refptr old_root = HeadsUpDisplayLayer::Create(LayerSettings()); + scoped_refptr old_root = HeadsUpDisplayLayer::Create(); proto::LayerNode root_node; root_node.set_id(old_root->id()); root_node.set_type(proto::LayerNode::HEADS_UP_DISPLAY_LAYER); diff --git a/cc/layers/layer_settings.cc b/cc/layers/layer_settings.cc deleted file mode 100644 index d2eac38..0000000 --- a/cc/layers/layer_settings.cc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/layers/layer_settings.h" - -namespace cc { - -LayerSettings::LayerSettings() : use_compositor_animation_timelines(true) {} - -LayerSettings::~LayerSettings() {} - -} // namespace cc diff --git a/cc/layers/layer_settings.h b/cc/layers/layer_settings.h deleted file mode 100644 index 4f1ac3a..0000000 --- a/cc/layers/layer_settings.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_LAYERS_LAYER_SETTINGS_H_ -#define CC_LAYERS_LAYER_SETTINGS_H_ - -#include "cc/base/cc_export.h" - -namespace cc { - -class CC_EXPORT LayerSettings { - public: - LayerSettings(); - ~LayerSettings(); - - bool use_compositor_animation_timelines; -}; - -} // namespace cc - -#endif // CC_LAYERS_LAYER_SETTINGS_H_ diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 5b213c9..59a2b5c 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -14,7 +14,6 @@ #include "cc/base/math_util.h" #include "cc/input/main_thread_scrolling_reason.h" #include "cc/layers/layer_impl.h" -#include "cc/layers/layer_settings.h" #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" #include "cc/proto/layer.pb.h" @@ -131,7 +130,7 @@ class LayerSerializationTest : public testing::Test { // it can be re-used for the |dest| layer. src->SetLayerTreeHost(nullptr); - scoped_refptr dest = Layer::Create(LayerSettings()); + scoped_refptr dest = Layer::Create(); dest->layer_id_ = src->layer_id_; dest->SetLayerTreeHost(layer_tree_host_.get()); dest->FromLayerPropertiesProto(props); @@ -243,12 +242,12 @@ class LayerSerializationTest : public testing::Test { } void RunNoMembersChangedTest() { - scoped_refptr layer = Layer::Create(LayerSettings()); + scoped_refptr layer = Layer::Create(); VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); } void RunArbitraryMembersChangedTest() { - scoped_refptr layer = Layer::Create(LayerSettings()); + scoped_refptr layer = Layer::Create(); layer->transform_origin_ = gfx::Point3F(3.0f, 1.0f, 4.0f); layer->background_color_ = SK_ColorRED; layer->bounds_ = gfx::Size(3, 14); @@ -295,7 +294,7 @@ class LayerSerializationTest : public testing::Test { } void RunAllMembersChangedTest() { - scoped_refptr layer = Layer::Create(LayerSettings()); + scoped_refptr layer = Layer::Create(); layer->transform_origin_ = gfx::Point3F(3.0f, 1.0f, 4.0f); layer->background_color_ = SK_ColorRED; layer->bounds_ = gfx::Size(3, 14); @@ -345,20 +344,20 @@ class LayerSerializationTest : public testing::Test { } void RunScrollAndClipLayersTest() { - scoped_refptr layer = Layer::Create(LayerSettings()); + scoped_refptr layer = Layer::Create(); - scoped_refptr scroll_parent = Layer::Create(LayerSettings()); + scoped_refptr scroll_parent = Layer::Create(); layer->scroll_parent_ = scroll_parent.get(); - scoped_refptr scroll_child = Layer::Create(LayerSettings()); + scoped_refptr scroll_child = Layer::Create(); layer->scroll_children_.reset(new std::set); layer->scroll_children_->insert(scroll_child.get()); - scoped_refptr clip_parent = Layer::Create(LayerSettings()); + scoped_refptr clip_parent = Layer::Create(); layer->clip_parent_ = clip_parent.get(); layer->clip_children_.reset(new std::set); - scoped_refptr clip_child1 = Layer::Create(LayerSettings()); + scoped_refptr clip_child1 = Layer::Create(); layer->clip_children_->insert(clip_child1.get()); - scoped_refptr clip_child2 = Layer::Create(LayerSettings()); + scoped_refptr clip_child2 = Layer::Create(); layer->clip_children_->insert(clip_child2.get()); VerifyBaseLayerPropertiesSerializationAndDeserialization(layer.get()); @@ -376,10 +375,10 @@ class LayerSerializationTest : public testing::Test { The root layer has a LayerTreeHost, and it should propagate to all the children. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_a->AddChild(layer_src_b); layer_src_b->AddChild(layer_src_c); @@ -388,7 +387,7 @@ class LayerSerializationTest : public testing::Test { layer_src_root->ToLayerNodeProto(&proto); Layer::LayerIdMap empty_dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); // Forcefully set the layer tree host for the root layer, which should cause // it to propagate to all the children. @@ -438,8 +437,8 @@ class LayerSerializationTest : public testing::Test { not have called InvalidatePropertyTreesIndices() for any of the layers, which would happen in for example SetLayerTreeHost(...) calls. */ - scoped_refptr layer_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); + scoped_refptr layer_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); layer_root->AddChild(layer_src_a); layer_root->transform_tree_index_ = 33; layer_src_a->transform_tree_index_ = 42; @@ -474,9 +473,9 @@ class LayerSerializationTest : public testing::Test { not have called InvalidatePropertyTreesIndices() for any of the layers, which would happen in for example SetLayerTreeHost(...) calls. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); @@ -484,7 +483,7 @@ class LayerSerializationTest : public testing::Test { proto::LayerNode root_proto_1; layer_src_root->ToLayerNodeProto(&root_proto_1); Layer::LayerIdMap dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(root_proto_1, dest_layer_map); // Ensure initial copy is correct. @@ -538,15 +537,15 @@ class LayerSerializationTest : public testing::Test { not have called InvalidatePropertyTreesIndices() for any of the layers, which would happen in for example SetLayerTreeHost(...) calls. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); layer_src_root->AddChild(layer_src_a); // Copy tree-structure to new root. proto::LayerNode root_proto_1; layer_src_root->ToLayerNodeProto(&root_proto_1); Layer::LayerIdMap dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(root_proto_1, dest_layer_map); // Ensure initial copy is correct. @@ -559,7 +558,7 @@ class LayerSerializationTest : public testing::Test { layer_dest_a->transform_tree_index_ = 42; // Add another child. - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); + scoped_refptr layer_src_b = Layer::Create(); layer_src_root->AddChild(layer_src_b); // Now serialize and deserialize again. @@ -594,9 +593,9 @@ class LayerSerializationTest : public testing::Test { not have called InvalidatePropertyTreesIndices() for any of the layers, which would happen in for example SetLayerTreeHost(...) calls. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); @@ -604,7 +603,7 @@ class LayerSerializationTest : public testing::Test { proto::LayerNode root_proto_1; layer_src_root->ToLayerNodeProto(&root_proto_1); Layer::LayerIdMap dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(root_proto_1, dest_layer_map); // Ensure initial copy is correct. @@ -657,10 +656,10 @@ class LayerSerializationTest : public testing::Test { not have called InvalidatePropertyTreesIndices() for any of the layers, which would happen in for example SetLayerTreeHost(...) calls. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); layer_src_b->AddChild(layer_src_c); @@ -669,7 +668,7 @@ class LayerSerializationTest : public testing::Test { proto::LayerNode root_proto_1; layer_src_root->ToLayerNodeProto(&root_proto_1); Layer::LayerIdMap dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(root_proto_1, dest_layer_map); // Ensure initial copy is correct. @@ -736,10 +735,10 @@ class LayerSerializationTest : public testing::Test { not have called InvalidatePropertyTreesIndices() for any of the layers, which would happen in for example SetLayerTreeHost(...) calls. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); layer_src_a->AddChild(layer_src_c); @@ -748,7 +747,7 @@ class LayerSerializationTest : public testing::Test { proto::LayerNode root_proto_1; layer_src_root->ToLayerNodeProto(&root_proto_1); Layer::LayerIdMap dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(root_proto_1, dest_layer_map); // Ensure initial copy is correct. @@ -817,27 +816,18 @@ class MockLayerTreeHost : public LayerTreeHost { MOCK_METHOD0(SetNeedsFullTreeSync, void()); }; -class LayerTreeSettingsForLayerTest : public LayerTreeSettings { - public: - LayerTreeSettingsForLayerTest() { use_compositor_animation_timelines = true; } -}; - class LayerTest : public testing::Test { public: LayerTest() - : host_impl_(LayerTreeSettingsForLayerTest(), + : host_impl_(LayerTreeSettings(), &task_runner_provider_, &shared_bitmap_manager_, &task_graph_runner_), fake_client_(FakeLayerTreeHostClient::DIRECT_3D) { - layer_settings_.use_compositor_animation_timelines = - settings().use_compositor_animation_timelines; - if (settings().use_compositor_animation_timelines) { - timeline_impl_ = - AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); - timeline_impl_->set_is_impl_only(true); - host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_); - } + timeline_impl_ = + AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); + timeline_impl_->set_is_impl_only(true); + host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_); } const LayerTreeSettings& settings() { return settings_; } @@ -891,13 +881,13 @@ class LayerTest : public testing::Test { } void CreateSimpleTestTree() { - parent_ = Layer::Create(layer_settings_); - child1_ = Layer::Create(layer_settings_); - child2_ = Layer::Create(layer_settings_); - child3_ = Layer::Create(layer_settings_); - grand_child1_ = Layer::Create(layer_settings_); - grand_child2_ = Layer::Create(layer_settings_); - grand_child3_ = Layer::Create(layer_settings_); + parent_ = Layer::Create(); + child1_ = Layer::Create(); + child2_ = Layer::Create(); + child3_ = Layer::Create(); + grand_child1_ = Layer::Create(); + grand_child2_ = Layer::Create(); + grand_child3_ = Layer::Create(); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); layer_tree_host_->SetRootLayer(parent_); @@ -931,12 +921,11 @@ class LayerTest : public testing::Test { scoped_refptr timeline_impl_; - LayerTreeSettingsForLayerTest settings_; - LayerSettings layer_settings_; + LayerTreeSettings settings_; }; TEST_F(LayerTest, BasicCreateAndDestroy) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); @@ -949,12 +938,12 @@ TEST_F(LayerTest, BasicCreateAndDestroy) { TEST_F(LayerTest, LayerPropertyChangedForSubtree) { EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); - scoped_refptr root = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); - scoped_refptr grand_child = Layer::Create(layer_settings_); - scoped_refptr dummy_layer1 = Layer::Create(layer_settings_); - scoped_refptr dummy_layer2 = Layer::Create(layer_settings_); + scoped_refptr root = Layer::Create(); + scoped_refptr child = Layer::Create(); + scoped_refptr child2 = Layer::Create(); + scoped_refptr grand_child = Layer::Create(); + scoped_refptr dummy_layer1 = Layer::Create(); + scoped_refptr dummy_layer2 = Layer::Create(); layer_tree_host_->SetRootLayer(root); root->AddChild(child); @@ -1134,8 +1123,8 @@ TEST_F(LayerTest, LayerPropertyChangedForSubtree) { } TEST_F(LayerTest, AddAndRemoveChild) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child = Layer::Create(); // Upon creation, layers should not have children or parent. ASSERT_EQ(0U, parent->children().size()); @@ -1155,8 +1144,8 @@ TEST_F(LayerTest, AddAndRemoveChild) { TEST_F(LayerTest, AddSameChildTwice) { EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child = Layer::Create(); layer_tree_host_->SetRootLayer(parent); @@ -1172,11 +1161,11 @@ TEST_F(LayerTest, AddSameChildTwice) { } TEST_F(LayerTest, InsertChild) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child1 = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); - scoped_refptr child3 = Layer::Create(layer_settings_); - scoped_refptr child4 = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child1 = Layer::Create(); + scoped_refptr child2 = Layer::Create(); + scoped_refptr child3 = Layer::Create(); + scoped_refptr child4 = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -1217,9 +1206,9 @@ TEST_F(LayerTest, InsertChild) { } TEST_F(LayerTest, InsertChildPastEndOfList) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child1 = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child1 = Layer::Create(); + scoped_refptr child2 = Layer::Create(); ASSERT_EQ(0U, parent->children().size()); @@ -1238,9 +1227,9 @@ TEST_F(LayerTest, InsertChildPastEndOfList) { } TEST_F(LayerTest, InsertSameChildTwice) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child1 = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child1 = Layer::Create(); + scoped_refptr child2 = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -1267,7 +1256,7 @@ TEST_F(LayerTest, InsertSameChildTwice) { TEST_F(LayerTest, ReplaceChildWithNewChild) { CreateSimpleTestTree(); - scoped_refptr child4 = Layer::Create(layer_settings_); + scoped_refptr child4 = Layer::Create(); EXPECT_FALSE(child4->parent()); @@ -1292,8 +1281,8 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) { CreateSimpleTestTree(); // create another simple tree with test_layer and child4. - scoped_refptr test_layer = Layer::Create(layer_settings_); - scoped_refptr child4 = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); + scoped_refptr child4 = Layer::Create(); test_layer->AddChild(child4); ASSERT_EQ(1U, test_layer->children().size()); EXPECT_EQ(child4, test_layer->children()[0]); @@ -1315,9 +1304,9 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) { } TEST_F(LayerTest, DeleteRemovedScrollParent) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child1 = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child1 = Layer::Create(); + scoped_refptr child2 = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -1344,9 +1333,9 @@ TEST_F(LayerTest, DeleteRemovedScrollParent) { } TEST_F(LayerTest, DeleteRemovedScrollChild) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child1 = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child1 = Layer::Create(); + scoped_refptr child2 = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -1396,11 +1385,11 @@ TEST_F(LayerTest, RemoveAllChildren) { } TEST_F(LayerTest, SetChildren) { - scoped_refptr old_parent = Layer::Create(layer_settings_); - scoped_refptr new_parent = Layer::Create(layer_settings_); + scoped_refptr old_parent = Layer::Create(); + scoped_refptr new_parent = Layer::Create(); - scoped_refptr child1 = Layer::Create(layer_settings_); - scoped_refptr child2 = Layer::Create(layer_settings_); + scoped_refptr child1 = Layer::Create(); + scoped_refptr child2 = Layer::Create(); LayerList new_children; new_children.push_back(child1); @@ -1427,17 +1416,17 @@ TEST_F(LayerTest, SetChildren) { } TEST_F(LayerTest, HasAncestor) { - scoped_refptr parent = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); EXPECT_FALSE(parent->HasAncestor(parent.get())); - scoped_refptr child = Layer::Create(layer_settings_); + scoped_refptr child = Layer::Create(); parent->AddChild(child); EXPECT_FALSE(child->HasAncestor(child.get())); EXPECT_TRUE(child->HasAncestor(parent.get())); EXPECT_FALSE(parent->HasAncestor(child.get())); - scoped_refptr child_child = Layer::Create(layer_settings_); + scoped_refptr child_child = Layer::Create(); child->AddChild(child_child); EXPECT_FALSE(child_child->HasAncestor(child_child.get())); @@ -1453,7 +1442,7 @@ TEST_F(LayerTest, GetRootLayerAfterTreeManipulations) { // For this test we don't care about SetNeedsFullTreeSync calls. EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); - scoped_refptr child4 = Layer::Create(layer_settings_); + scoped_refptr child4 = Layer::Create(); EXPECT_EQ(parent_.get(), parent_->RootLayer()); EXPECT_EQ(parent_.get(), child1_->RootLayer()); @@ -1508,7 +1497,7 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { // 2. indirectly calls SetNeedsUpdate, exactly once for each call to // SetNeedsDisplay. - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC( 1, layer_tree_host_->SetRootLayer(test_layer)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); @@ -1561,7 +1550,7 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { } TEST_F(LayerTest, TestSettingMainThreadScrollingReason) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(test_layer)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); @@ -1612,13 +1601,13 @@ TEST_F(LayerTest, TestSettingMainThreadScrollingReason) { } TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC( 1, layer_tree_host_->SetRootLayer(test_layer)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); - scoped_refptr dummy_layer1 = Layer::Create(layer_settings_); - scoped_refptr dummy_layer2 = Layer::Create(layer_settings_); + scoped_refptr dummy_layer1 = Layer::Create(); + scoped_refptr dummy_layer2 = Layer::Create(); // sanity check of initial test condition EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); @@ -1669,7 +1658,7 @@ TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { } TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -1701,7 +1690,7 @@ TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { } TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -1720,7 +1709,7 @@ TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { } TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForOpacity) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -1737,15 +1726,14 @@ TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForOpacity) { } TEST_F(LayerTest, MaskAndReplicaHasParent) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); - scoped_refptr mask = Layer::Create(layer_settings_); - scoped_refptr replica = Layer::Create(layer_settings_); - scoped_refptr replica_mask = Layer::Create(layer_settings_); - scoped_refptr mask_replacement = Layer::Create(layer_settings_); - scoped_refptr replica_replacement = Layer::Create(layer_settings_); - scoped_refptr replica_mask_replacement = - Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child = Layer::Create(); + scoped_refptr mask = Layer::Create(); + scoped_refptr replica = Layer::Create(); + scoped_refptr replica_mask = Layer::Create(); + scoped_refptr mask_replacement = Layer::Create(); + scoped_refptr replica_replacement = Layer::Create(); + scoped_refptr replica_mask_replacement = Layer::Create(); parent->AddChild(child); child->SetMaskLayer(mask.get()); @@ -1773,7 +1761,7 @@ TEST_F(LayerTest, MaskAndReplicaHasParent) { } TEST_F(LayerTest, CheckTransformIsInvertible) { - scoped_refptr layer = Layer::Create(layer_settings_); + scoped_refptr layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); @@ -1804,7 +1792,7 @@ TEST_F(LayerTest, CheckTransformIsInvertible) { } TEST_F(LayerTest, TransformIsInvertibleAnimation) { - scoped_refptr layer = Layer::Create(layer_settings_); + scoped_refptr layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); @@ -1872,22 +1860,14 @@ void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { AssertLayerTreeHostMatchesForSubtree(layer->replica_layer(), host); } -class LayerLayerTreeHostTest : public testing::Test { - public: - LayerLayerTreeHostTest() { - layer_settings_.use_compositor_animation_timelines = true; - } - - protected: - LayerSettings layer_settings_; -}; +class LayerLayerTreeHostTest : public testing::Test {}; TEST_F(LayerLayerTreeHostTest, EnteringTree) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); - scoped_refptr mask = Layer::Create(layer_settings_); - scoped_refptr replica = Layer::Create(layer_settings_); - scoped_refptr replica_mask = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child = Layer::Create(); + scoped_refptr mask = Layer::Create(); + scoped_refptr replica = Layer::Create(); + scoped_refptr replica_mask = Layer::Create(); // Set up a detached tree of layers. The host pointer should be nil for these // layers. @@ -1914,7 +1894,7 @@ TEST_F(LayerLayerTreeHostTest, EnteringTree) { } TEST_F(LayerLayerTreeHostTest, AddingLayerSubtree) { - scoped_refptr parent = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); LayerTreeHostFactory factory; scoped_ptr layer_tree_host = factory.Create(); @@ -1924,16 +1904,16 @@ TEST_F(LayerLayerTreeHostTest, AddingLayerSubtree) { // Adding a subtree to a layer already associated with a host should set the // host pointer on all layers in that subtree. - scoped_refptr child = Layer::Create(layer_settings_); - scoped_refptr grand_child = Layer::Create(layer_settings_); + scoped_refptr child = Layer::Create(); + scoped_refptr grand_child = Layer::Create(); child->AddChild(grand_child); // Masks, replicas, and replica masks should pick up the new host too. - scoped_refptr child_mask = Layer::Create(layer_settings_); + scoped_refptr child_mask = Layer::Create(); child->SetMaskLayer(child_mask.get()); - scoped_refptr child_replica = Layer::Create(layer_settings_); + scoped_refptr child_replica = Layer::Create(); child->SetReplicaLayer(child_replica.get()); - scoped_refptr child_replica_mask = Layer::Create(layer_settings_); + scoped_refptr child_replica_mask = Layer::Create(); child_replica->SetMaskLayer(child_replica_mask.get()); parent->AddChild(child); @@ -1943,11 +1923,11 @@ TEST_F(LayerLayerTreeHostTest, AddingLayerSubtree) { } TEST_F(LayerLayerTreeHostTest, ChangeHost) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); - scoped_refptr mask = Layer::Create(layer_settings_); - scoped_refptr replica = Layer::Create(layer_settings_); - scoped_refptr replica_mask = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr child = Layer::Create(); + scoped_refptr mask = Layer::Create(); + scoped_refptr replica = Layer::Create(); + scoped_refptr replica_mask = Layer::Create(); // Same setup as the previous test. parent->AddChild(child); @@ -1974,11 +1954,11 @@ TEST_F(LayerLayerTreeHostTest, ChangeHost) { } TEST_F(LayerLayerTreeHostTest, ChangeHostInSubtree) { - scoped_refptr first_parent = Layer::Create(layer_settings_); - scoped_refptr first_child = Layer::Create(layer_settings_); - scoped_refptr second_parent = Layer::Create(layer_settings_); - scoped_refptr second_child = Layer::Create(layer_settings_); - scoped_refptr second_grand_child = Layer::Create(layer_settings_); + scoped_refptr first_parent = Layer::Create(); + scoped_refptr first_child = Layer::Create(); + scoped_refptr second_parent = Layer::Create(); + scoped_refptr second_child = Layer::Create(); + scoped_refptr second_grand_child = Layer::Create(); // First put all children under the first parent and set the first host. first_parent->AddChild(first_child); @@ -2010,13 +1990,13 @@ TEST_F(LayerLayerTreeHostTest, ChangeHostInSubtree) { } TEST_F(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { - scoped_refptr parent = Layer::Create(layer_settings_); - scoped_refptr mask = Layer::Create(layer_settings_); - scoped_refptr replica = Layer::Create(layer_settings_); - scoped_refptr mask_child = Layer::Create(layer_settings_); - scoped_refptr replica_child = Layer::Create(layer_settings_); - scoped_refptr mask_replacement = Layer::Create(layer_settings_); - scoped_refptr replica_replacement = Layer::Create(layer_settings_); + scoped_refptr parent = Layer::Create(); + scoped_refptr mask = Layer::Create(); + scoped_refptr replica = Layer::Create(); + scoped_refptr mask_child = Layer::Create(); + scoped_refptr replica_child = Layer::Create(); + scoped_refptr mask_replacement = Layer::Create(); + scoped_refptr replica_replacement = Layer::Create(); parent->SetMaskLayer(mask.get()); parent->SetReplicaLayer(replica.get()); @@ -2044,8 +2024,8 @@ TEST_F(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { } TEST_F(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) { - scoped_refptr root = Layer::Create(layer_settings_); - scoped_refptr child = Layer::Create(layer_settings_); + scoped_refptr root = Layer::Create(); + scoped_refptr child = Layer::Create(); root->AddChild(child); LayerTreeHostFactory factory; scoped_ptr layer_tree_host = factory.Create(); @@ -2056,7 +2036,7 @@ TEST_F(LayerTest, SafeOpaqueBackgroundColor) { LayerTreeHostFactory factory; scoped_ptr layer_tree_host = factory.Create(); - scoped_refptr layer = Layer::Create(layer_settings_); + scoped_refptr layer = Layer::Create(); layer_tree_host->SetRootLayer(layer); for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { @@ -2087,9 +2067,8 @@ TEST_F(LayerTest, SafeOpaqueBackgroundColor) { class DrawsContentChangeLayer : public Layer { public: - static scoped_refptr Create( - const LayerSettings& settings) { - return make_scoped_refptr(new DrawsContentChangeLayer(settings)); + static scoped_refptr Create() { + return make_scoped_refptr(new DrawsContentChangeLayer()); } void SetLayerTreeHost(LayerTreeHost* host) override { @@ -2107,19 +2086,18 @@ class DrawsContentChangeLayer : public Layer { } private: - explicit DrawsContentChangeLayer(const LayerSettings& settings) - : Layer(settings), fake_draws_content_(false) {} + DrawsContentChangeLayer() : fake_draws_content_(false) {} ~DrawsContentChangeLayer() override {} bool fake_draws_content_; }; TEST_F(LayerTest, DrawsContentChangedInSetLayerTreeHost) { - scoped_refptr root_layer = Layer::Create(layer_settings_); + scoped_refptr root_layer = Layer::Create(); scoped_refptr becomes_not_draws_content = - DrawsContentChangeLayer::Create(layer_settings_); + DrawsContentChangeLayer::Create(); scoped_refptr becomes_draws_content = - DrawsContentChangeLayer::Create(layer_settings_); + DrawsContentChangeLayer::Create(); root_layer->SetIsDrawable(true); becomes_not_draws_content->SetIsDrawable(true); becomes_not_draws_content->SetFakeDrawsContent(true); @@ -2138,7 +2116,7 @@ void ReceiveCopyOutputResult(int* result_count, } TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { - scoped_refptr layer = Layer::Create(layer_settings_); + scoped_refptr layer = Layer::Create(); int result_count = 0; // Create identical requests without the source being set, and expect the @@ -2156,7 +2134,7 @@ TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { layer = nullptr; EXPECT_EQ(2, result_count); - layer = Layer::Create(layer_settings_); + layer = Layer::Create(); result_count = 0; // Create identical requests, but this time the source is being set. Expect @@ -2202,7 +2180,7 @@ TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { } TEST_F(LayerTest, AnimationSchedulesLayerUpdate) { - scoped_refptr layer = Layer::Create(layer_settings_); + scoped_refptr layer = Layer::Create(); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(layer)); EXPECT_CALL(*layer_tree_host_, SetNeedsUpdateLayers()).Times(1); @@ -2231,12 +2209,12 @@ TEST_F(LayerTest, RecursiveHierarchySerialization) { c Layer c also has a mask layer and a replica layer. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c_mask = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c_replica = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); + scoped_refptr layer_src_c_mask = Layer::Create(); + scoped_refptr layer_src_c_replica = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); layer_src_b->AddChild(layer_src_c); @@ -2247,7 +2225,7 @@ TEST_F(LayerTest, RecursiveHierarchySerialization) { layer_src_root->ToLayerNodeProto(&proto); Layer::LayerIdMap empty_dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(proto, empty_dest_layer_map); EXPECT_EQ(layer_src_root->id(), layer_dest_root->id()); @@ -2285,15 +2263,15 @@ TEST_F(LayerTest, RecursiveHierarchySerializationWithNodeReuse) { The deserialization should then re-use the Layers from last deserialization. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); layer_src_root->AddChild(layer_src_a); proto::LayerNode root_proto_1; layer_src_root->ToLayerNodeProto(&root_proto_1); Layer::LayerIdMap dest_layer_map_1; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(root_proto_1, dest_layer_map_1); EXPECT_EQ(layer_src_root->id(), layer_dest_root->id()); @@ -2307,7 +2285,7 @@ TEST_F(LayerTest, RecursiveHierarchySerializationWithNodeReuse) { dest_layer_map_2[layer_dest_a_1->id()] = layer_dest_a_1; // Add Layer |b|. - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); + scoped_refptr layer_src_b = Layer::Create(); layer_src_root->AddChild(layer_src_b); // Second serialization. @@ -2346,11 +2324,11 @@ TEST_F(LayerTest, DeletingSubtreeDeletesLayers) { d Then the subtree rooted at node |b| is deleted in the next update. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); - scoped_refptr layer_src_d = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); + scoped_refptr layer_src_d = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); layer_src_b->AddChild(layer_src_c); @@ -2362,7 +2340,7 @@ TEST_F(LayerTest, DeletingSubtreeDeletesLayers) { // Deserialization 1. Layer::LayerIdMap empty_dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(proto1, empty_dest_layer_map); EXPECT_EQ(layer_src_root->id(), layer_dest_root->id()); @@ -2393,9 +2371,9 @@ TEST_F(LayerTest, DeletingSubtreeDeletesLayers) { } TEST_F(LayerTest, DeleteMaskAndReplicaLayer) { - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_mask = Layer::Create(LayerSettings()); - scoped_refptr layer_src_replica = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_mask = Layer::Create(); + scoped_refptr layer_src_replica = Layer::Create(); layer_src_root->SetMaskLayer(layer_src_mask.get()); layer_src_root->SetReplicaLayer(layer_src_replica.get()); @@ -2405,7 +2383,7 @@ TEST_F(LayerTest, DeleteMaskAndReplicaLayer) { // Deserialization 1. Layer::LayerIdMap dest_layer_map; - scoped_refptr layer_dest_root = Layer::Create(LayerSettings()); + scoped_refptr layer_dest_root = Layer::Create(); layer_dest_root->FromLayerNodeProto(proto1, dest_layer_map); EXPECT_EQ(layer_src_root->id(), layer_dest_root->id()); @@ -2480,13 +2458,13 @@ TEST_F(LayerTest, SimplePropertiesSerialization) { Layers marked with + have descendants with changed properties. Layer b also has a mask layer and a replica layer. */ - scoped_refptr layer_src_root = Layer::Create(LayerSettings()); - scoped_refptr layer_src_a = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b_mask = Layer::Create(LayerSettings()); - scoped_refptr layer_src_b_replica = Layer::Create(LayerSettings()); - scoped_refptr layer_src_c = Layer::Create(LayerSettings()); - scoped_refptr layer_src_d = Layer::Create(LayerSettings()); + scoped_refptr layer_src_root = Layer::Create(); + scoped_refptr layer_src_a = Layer::Create(); + scoped_refptr layer_src_b = Layer::Create(); + scoped_refptr layer_src_b_mask = Layer::Create(); + scoped_refptr layer_src_b_replica = Layer::Create(); + scoped_refptr layer_src_c = Layer::Create(); + scoped_refptr layer_src_d = Layer::Create(); layer_src_root->AddChild(layer_src_a); layer_src_root->AddChild(layer_src_b); layer_src_a->AddChild(layer_src_c); @@ -2589,7 +2567,7 @@ TEST_F(LayerTest, SimplePropertiesSerialization) { } TEST_F(LayerSerializationTest, SimplePropertiesDeserialization) { - scoped_refptr layer = Layer::Create(LayerSettings()); + scoped_refptr layer = Layer::Create(); layer->SetLayerTreeHost(layer_tree_host_.get()); proto::LayerProperties properties; properties.set_id(layer->id()); @@ -2638,7 +2616,7 @@ TEST_F(LayerSerializationTest, ScrollAndClipLayers) { } TEST_F(LayerTest, ElementIdAndMutablePropertiesArePushed) { - scoped_refptr test_layer = Layer::Create(layer_settings_); + scoped_refptr test_layer = Layer::Create(); scoped_ptr impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); diff --git a/cc/layers/layer_utils_unittest.cc b/cc/layers/layer_utils_unittest.cc index 6d16c5c..e915c41 100644 --- a/cc/layers/layer_utils_unittest.cc +++ b/cc/layers/layer_utils_unittest.cc @@ -25,18 +25,10 @@ float diagonal(float width, float height) { return std::sqrt(width * width + height * height); } -class LayerTreeSettingsForAnimationBoundsTest : public LayerTreeSettings { - public: - LayerTreeSettingsForAnimationBoundsTest() { - use_compositor_animation_timelines = true; - } -}; - class LayerUtilsGetAnimationBoundsTest : public testing::Test { public: LayerUtilsGetAnimationBoundsTest() - : host_impl_(LayerTreeSettingsForAnimationBoundsTest(), - &task_runner_provider_, + : host_impl_(&task_runner_provider_, &shared_bitmap_manager_, &task_graph_runner_), root_(CreateTwoForkTree(&host_impl_)), diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc index 218f1da..e2dc92f 100644 --- a/cc/layers/nine_patch_layer.cc +++ b/cc/layers/nine_patch_layer.cc @@ -12,15 +12,12 @@ namespace cc { -scoped_refptr NinePatchLayer::Create( - const LayerSettings& settings) { - return make_scoped_refptr(new NinePatchLayer(settings)); +scoped_refptr NinePatchLayer::Create() { + return make_scoped_refptr(new NinePatchLayer()); } -NinePatchLayer::NinePatchLayer(const LayerSettings& settings) - : UIResourceLayer(settings), - fill_center_(false), - nearest_neighbor_(false) {} +NinePatchLayer::NinePatchLayer() + : UIResourceLayer(), fill_center_(false), nearest_neighbor_(false) {} NinePatchLayer::~NinePatchLayer() {} diff --git a/cc/layers/nine_patch_layer.h b/cc/layers/nine_patch_layer.h index a2c37e1..20b5e49 100644 --- a/cc/layers/nine_patch_layer.h +++ b/cc/layers/nine_patch_layer.h @@ -20,7 +20,7 @@ class ScopedUIResource; class CC_EXPORT NinePatchLayer : public UIResourceLayer { public: - static scoped_refptr Create(const LayerSettings& settings); + static scoped_refptr Create(); void PushPropertiesTo(LayerImpl* layer) override; @@ -42,7 +42,7 @@ class CC_EXPORT NinePatchLayer : public UIResourceLayer { void SetNearestNeighbor(bool nearest_neighbor); private: - explicit NinePatchLayer(const LayerSettings& settings); + NinePatchLayer(); ~NinePatchLayer() override; scoped_ptr CreateLayerImpl(LayerTreeImpl* tree_impl) override; diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc index 5f14c09..381c024 100644 --- a/cc/layers/nine_patch_layer_unittest.cc +++ b/cc/layers/nine_patch_layer_unittest.cc @@ -4,7 +4,6 @@ #include "cc/layers/nine_patch_layer.h" -#include "cc/layers/layer_settings.h" #include "cc/resources/resource_provider.h" #include "cc/resources/scoped_ui_resource.h" #include "cc/test/fake_layer_tree_host.h" @@ -47,8 +46,7 @@ class NinePatchLayerTest : public testing::Test { }; TEST_F(NinePatchLayerTest, SetLayerProperties) { - scoped_refptr test_layer = - NinePatchLayer::Create(LayerSettings()); + scoped_refptr test_layer = NinePatchLayer::Create(); ASSERT_TRUE(test_layer.get()); test_layer->SetIsDrawable(true); test_layer->SetBounds(gfx::Size(100, 100)); diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc index 8815abb..e0e0859 100644 --- a/cc/layers/painted_scrollbar_layer.cc +++ b/cc/layers/painted_scrollbar_layer.cc @@ -31,18 +31,15 @@ scoped_ptr PaintedScrollbarLayer::CreateLayerImpl( } scoped_refptr PaintedScrollbarLayer::Create( - const LayerSettings& settings, scoped_ptr scrollbar, int scroll_layer_id) { - return make_scoped_refptr(new PaintedScrollbarLayer( - settings, std::move(scrollbar), scroll_layer_id)); + return make_scoped_refptr( + new PaintedScrollbarLayer(std::move(scrollbar), scroll_layer_id)); } -PaintedScrollbarLayer::PaintedScrollbarLayer(const LayerSettings& settings, - scoped_ptr scrollbar, +PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr scrollbar, int scroll_layer_id) - : Layer(settings), - scrollbar_(std::move(scrollbar)), + : scrollbar_(std::move(scrollbar)), scroll_layer_id_(scroll_layer_id), internal_contents_scale_(1.f), thumb_thickness_(scrollbar_->ThumbThickness()), diff --git a/cc/layers/painted_scrollbar_layer.h b/cc/layers/painted_scrollbar_layer.h index 27dc2c3..1d452bc 100644 --- a/cc/layers/painted_scrollbar_layer.h +++ b/cc/layers/painted_scrollbar_layer.h @@ -22,7 +22,6 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, scoped_ptr CreateLayerImpl(LayerTreeImpl* tree_impl) override; static scoped_refptr Create( - const LayerSettings& settings, scoped_ptr scrollbar, int scroll_layer_id); @@ -45,9 +44,7 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, } protected: - PaintedScrollbarLayer(const LayerSettings& settings, - scoped_ptr scrollbar, - int scroll_layer_id); + PaintedScrollbarLayer(scoped_ptr scrollbar, int scroll_layer_id); ~PaintedScrollbarLayer() override; // For unit tests diff --git a/cc/layers/painted_scrollbar_layer_unittest.cc b/cc/layers/painted_scrollbar_layer_unittest.cc index d170e8e..f5b49b9 100644 --- a/cc/layers/painted_scrollbar_layer_unittest.cc +++ b/cc/layers/painted_scrollbar_layer_unittest.cc @@ -4,7 +4,6 @@ #include "cc/layers/painted_scrollbar_layer.h" -#include "cc/layers/layer_settings.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/fake_layer_tree_host_client.h" #include "cc/test/fake_scrollbar.h" @@ -31,7 +30,6 @@ TEST(PaintedScrollbarLayerTest, NeedsPaint) { FakeLayerTreeHostClient fake_client_(FakeLayerTreeHostClient::DIRECT_3D); TestTaskGraphRunner task_graph_runner_; scoped_ptr layer_tree_host_; - LayerSettings layer_settings_; layer_tree_host_ = FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); @@ -41,8 +39,7 @@ TEST(PaintedScrollbarLayerTest, NeedsPaint) { MockScrollbar* scrollbar = new MockScrollbar(); scoped_refptr scrollbar_layer = - PaintedScrollbarLayer::Create(layer_settings_, - scoped_ptr(scrollbar), 1); + PaintedScrollbarLayer::Create(scoped_ptr(scrollbar), 1); scrollbar_layer->SetIsDrawable(true); scrollbar_layer->SetBounds(gfx::Size(100, 100)); diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc index b5a55c2..05cbb0c 100644 --- a/cc/layers/picture_image_layer.cc +++ b/cc/layers/picture_image_layer.cc @@ -16,14 +16,11 @@ namespace cc { -scoped_refptr PictureImageLayer::Create( - const LayerSettings& settings) { - return make_scoped_refptr(new PictureImageLayer(settings)); +scoped_refptr PictureImageLayer::Create() { + return make_scoped_refptr(new PictureImageLayer()); } -PictureImageLayer::PictureImageLayer(const LayerSettings& settings) - : PictureLayer(settings, this) { -} +PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} PictureImageLayer::~PictureImageLayer() { ClearClient(); diff --git a/cc/layers/picture_image_layer.h b/cc/layers/picture_image_layer.h index fd3c1a2..88dd2c9 100644 --- a/cc/layers/picture_image_layer.h +++ b/cc/layers/picture_image_layer.h @@ -20,7 +20,7 @@ namespace cc { class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { public: - static scoped_refptr Create(const LayerSettings& settings); + static scoped_refptr Create(); void SetImage(skia::RefPtr image); @@ -39,7 +39,7 @@ class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { bool HasDrawableContent() const override; private: - explicit PictureImageLayer(const LayerSettings& settings); + PictureImageLayer(); ~PictureImageLayer() override; skia::RefPtr image_; diff --git a/cc/layers/picture_image_layer_unittest.cc b/cc/layers/picture_image_layer_unittest.cc index b03ea22..a200731 100644 --- a/cc/layers/picture_image_layer_unittest.cc +++ b/cc/layers/picture_image_layer_unittest.cc @@ -4,7 +4,6 @@ #include "cc/layers/picture_image_layer.h" -#include "cc/layers/layer_settings.h" #include "cc/playback/display_item.h" #include "cc/test/skia_common.h" #include "testing/gtest/include/gtest/gtest.h" @@ -17,8 +16,7 @@ namespace cc { namespace { TEST(PictureImageLayerTest, PaintContentsToDisplayList) { - scoped_refptr layer = - PictureImageLayer::Create(LayerSettings()); + scoped_refptr layer = PictureImageLayer::Create(); gfx::Rect layer_rect(200, 200); unsigned char image_pixels[4 * 200 * 200] = {0}; diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index f528516..9d7ec69 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -19,25 +19,20 @@ namespace cc { -scoped_refptr PictureLayer::Create(const LayerSettings& settings, - ContentLayerClient* client) { - return make_scoped_refptr(new PictureLayer(settings, client)); +scoped_refptr PictureLayer::Create(ContentLayerClient* client) { + return make_scoped_refptr(new PictureLayer(client)); } -PictureLayer::PictureLayer(const LayerSettings& settings, - ContentLayerClient* client) - : Layer(settings), - client_(client), +PictureLayer::PictureLayer(ContentLayerClient* client) + : client_(client), instrumentation_object_tracker_(id()), update_source_frame_number_(-1), is_mask_(false), - nearest_neighbor_(false) { -} + nearest_neighbor_(false) {} -PictureLayer::PictureLayer(const LayerSettings& settings, - ContentLayerClient* client, +PictureLayer::PictureLayer(ContentLayerClient* client, scoped_ptr source) - : PictureLayer(settings, client) { + : PictureLayer(client) { recording_source_ = std::move(source); } diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h index b7e7152..248eee8 100644 --- a/cc/layers/picture_layer.h +++ b/cc/layers/picture_layer.h @@ -19,8 +19,7 @@ class ResourceUpdateQueue; class CC_EXPORT PictureLayer : public Layer { public: - static scoped_refptr Create(const LayerSettings& settings, - ContentLayerClient* client); + static scoped_refptr Create(ContentLayerClient* client); void ClearClient(); @@ -45,10 +44,9 @@ class CC_EXPORT PictureLayer : public Layer { } protected: - PictureLayer(const LayerSettings& settings, ContentLayerClient* client); + explicit PictureLayer(ContentLayerClient* client); // Allow tests to inject a recording source. - PictureLayer(const LayerSettings& settings, - ContentLayerClient* client, + PictureLayer(ContentLayerClient* client, scoped_ptr source); ~PictureLayer() override; diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 67a00a1..90800f2 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -16,7 +16,6 @@ #include "base/thread_task_runner_handle.h" #include "cc/base/math_util.h" #include "cc/layers/append_quads_data.h" -#include "cc/layers/layer_settings.h" #include "cc/layers/picture_layer.h" #include "cc/quads/draw_quad.h" #include "cc/quads/tile_draw_quad.h" @@ -400,7 +399,6 @@ class PictureLayerImplTest : public testing::Test { FakePictureLayerImpl* pending_layer_; FakePictureLayerImpl* old_pending_layer_; FakePictureLayerImpl* active_layer_; - LayerSettings layer_settings_; private: DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); @@ -4383,8 +4381,7 @@ void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { FakeContentLayerClient client; client.set_bounds(layer_bounds); - scoped_refptr layer = - PictureLayer::Create(layer_settings_, &client); + scoped_refptr layer = PictureLayer::Create(&client); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); TestTaskGraphRunner task_graph_runner; scoped_ptr host = @@ -4448,8 +4445,7 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { FakeContentLayerClient client; client.set_bounds(layer_bounds); - scoped_refptr layer = - PictureLayer::Create(layer_settings_, &client); + scoped_refptr layer = PictureLayer::Create(&client); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); TestTaskGraphRunner task_graph_runner; scoped_ptr host = diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc index a34e2f3..45a0610 100644 --- a/cc/layers/picture_layer_unittest.cc +++ b/cc/layers/picture_layer_unittest.cc @@ -10,7 +10,6 @@ #include "cc/layers/append_quads_data.h" #include "cc/layers/content_layer_client.h" #include "cc/layers/empty_content_layer_client.h" -#include "cc/layers/layer_settings.h" #include "cc/layers/picture_layer_impl.h" #include "cc/playback/display_item_list_settings.h" #include "cc/proto/layer.pb.h" @@ -21,7 +20,6 @@ #include "cc/test/fake_picture_layer.h" #include "cc/test/fake_picture_layer_impl.h" #include "cc/test/fake_proxy.h" -#include "cc/test/layer_tree_settings_for_testing.h" #include "cc/test/skia_common.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_task_graph_runner.h" @@ -35,7 +33,7 @@ class TestSerializationPictureLayer : public PictureLayer { static scoped_refptr Create( const gfx::Size& recording_source_viewport) { return make_scoped_refptr(new TestSerializationPictureLayer( - LayerSettings(), EmptyContentLayerClient::GetInstance(), + EmptyContentLayerClient::GetInstance(), FakeDisplayListRecordingSource::CreateFilledRecordingSource( recording_source_viewport), recording_source_viewport)); @@ -93,11 +91,10 @@ class TestSerializationPictureLayer : public PictureLayer { } private: - TestSerializationPictureLayer(const LayerSettings& settings, - ContentLayerClient* client, + TestSerializationPictureLayer(ContentLayerClient* client, scoped_ptr source, const gfx::Size& recording_source_viewport) - : PictureLayer(settings, client, std::move(source)), + : PictureLayer(client, std::move(source)), recording_source_viewport_(recording_source_viewport) {} ~TestSerializationPictureLayer() override {} @@ -144,15 +141,13 @@ TEST(PictureLayerTest, TestSetAllPropsSerializationDeserialization) { TEST(PictureLayerTest, TestSerializationDeserialization) { FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); TestTaskGraphRunner task_graph_runner; - LayerTreeSettings settings; - settings.use_compositor_animation_timelines = true; scoped_ptr fake_image_serialization_processor = make_scoped_ptr(new FakeImageSerializationProcessor); - scoped_ptr host = - FakeLayerTreeHost::Create(&host_client, &task_graph_runner, settings, - CompositorMode::SINGLE_THREADED, - fake_image_serialization_processor.get()); + scoped_ptr host = FakeLayerTreeHost::Create( + &host_client, &task_graph_runner, LayerTreeSettings(), + CompositorMode::SINGLE_THREADED, + fake_image_serialization_processor.get()); gfx::Size recording_source_viewport(256, 256); scoped_refptr layer = TestSerializationPictureLayer::Create(recording_source_viewport); @@ -183,8 +178,7 @@ TEST(PictureLayerTest, TestEmptySerializationDeserialization) { TEST(PictureLayerTest, NoTilesIfEmptyBounds) { ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); - scoped_refptr layer = - PictureLayer::Create(LayerSettings(), client); + scoped_refptr layer = PictureLayer::Create(client); layer->SetBounds(gfx::Size(10, 10)); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); @@ -211,7 +205,7 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) { scoped_ptr output_surface = FakeOutputSurface::CreateSoftware( make_scoped_ptr(new SoftwareOutputDevice)); - FakeLayerTreeHostImpl host_impl(LayerTreeSettingsForTesting(), + FakeLayerTreeHostImpl host_impl(LayerTreeSettings(), &impl_task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.InitializeRenderer(output_surface.get()); @@ -232,8 +226,7 @@ TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { client.set_bounds(layer_size); skia::RefPtr image = CreateDiscardableImage(layer_size); client.add_draw_image(image.get(), gfx::Point(), SkPaint()); - scoped_refptr layer = - PictureLayer::Create(LayerSettings(), &client); + scoped_refptr layer = PictureLayer::Create(&client); layer->SetBounds(gfx::Size(10, 10)); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); @@ -256,7 +249,7 @@ TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { TestSharedBitmapManager shared_bitmap_manager; scoped_ptr output_surface(FakeOutputSurface::Create3d()); - LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); + LayerTreeSettings layer_tree_settings = LayerTreeSettings(); layer_tree_settings.image_decode_tasks_enabled = true; FakeLayerTreeHostImpl host_impl(layer_tree_settings, &impl_task_runner_provider, @@ -314,7 +307,7 @@ TEST(PictureLayerTest, SuitableForGpuRasterization) { ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); scoped_refptr layer = FakePictureLayer::CreateWithRecordingSource( - LayerSettings(), client, std::move(recording_source_owned)); + client, std::move(recording_source_owned)); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); TestTaskGraphRunner task_graph_runner; @@ -345,7 +338,7 @@ TEST(PictureLayerTest, SuitableForGpuRasterization) { // non-monotonically. This executes that code path under this scenario allowing // for the code to verify correctness with DCHECKs. TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { - LayerTreeSettingsForTesting settings; + LayerTreeSettings settings; settings.single_thread_proxy_scheduler = false; settings.use_zero_copy = true; @@ -355,8 +348,7 @@ TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { TestTaskGraphRunner task_graph_runner; ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); - scoped_refptr layer = - FakePictureLayer::Create(LayerSettings(), client); + scoped_refptr layer = FakePictureLayer::Create(client); LayerTreeHost::InitParams params; params.client = &host_client1; diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index a592c50..7288882 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -37,24 +37,22 @@ namespace cc { namespace { -LayerImpl* LayerImplForScrollAreaAndScrollbar(const LayerSettings& settings, - FakeLayerTreeHost* host, +LayerImpl* LayerImplForScrollAreaAndScrollbar(FakeLayerTreeHost* host, scoped_ptr scrollbar, bool reverse_order, bool use_solid_color_scrollbar, int thumb_thickness, int track_start) { - scoped_refptr layer_tree_root = Layer::Create(settings); - scoped_refptr child1 = Layer::Create(settings); + scoped_refptr layer_tree_root = Layer::Create(); + scoped_refptr child1 = Layer::Create(); scoped_refptr child2; if (use_solid_color_scrollbar) { const bool kIsLeftSideVerticalScrollbar = false; child2 = SolidColorScrollbarLayer::Create( - settings, scrollbar->Orientation(), thumb_thickness, track_start, + scrollbar->Orientation(), thumb_thickness, track_start, kIsLeftSideVerticalScrollbar, child1->id()); } else { - child2 = PaintedScrollbarLayer::Create(settings, std::move(scrollbar), - child1->id()); + child2 = PaintedScrollbarLayer::Create(std::move(scrollbar), child1->id()); } layer_tree_root->AddChild(child1); layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1); @@ -139,13 +137,10 @@ class ScrollbarLayerTest : public testing::Test { EXPECT_FALSE(layer_tree_host_->output_surface_lost()); } - const LayerSettings& layer_settings() { return layer_settings_; } - protected: FakeLayerTreeHostClient fake_client_; TestTaskGraphRunner task_graph_runner_; LayerTreeSettings layer_tree_settings_; - LayerSettings layer_settings_; scoped_ptr layer_tree_host_; }; @@ -153,8 +148,7 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { // Create and attach a non-overlay scrollbar. scoped_ptr scrollbar(new FakeScrollbar); LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false, - false, 0, 0); + layer_tree_host_.get(), std::move(scrollbar), false, false, 0, 0); PaintedScrollbarLayerImpl* scrollbar_layer_impl = static_cast( layer_impl_tree_root->children()[1].get()); @@ -177,8 +171,7 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { scrollbar.reset(new FakeScrollbar(false, false, true)); layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false, - false, 0, 0); + layer_tree_host_.get(), std::move(scrollbar), false, false, 0, 0); scrollbar_layer_impl = static_cast( layer_impl_tree_root->children()[1].get()); layer_impl_tree_root->layer_tree_impl()->BuildPropertyTreesForTesting(); @@ -197,11 +190,11 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { scoped_ptr scrollbar(new FakeScrollbar); - scoped_refptr layer_tree_root = Layer::Create(layer_settings()); - scoped_refptr scroll_layer = Layer::Create(layer_settings()); - scoped_refptr content_layer = Layer::Create(layer_settings()); + scoped_refptr layer_tree_root = Layer::Create(); + scoped_refptr scroll_layer = Layer::Create(); + scoped_refptr content_layer = Layer::Create(); scoped_refptr scrollbar_layer = PaintedScrollbarLayer::Create( - layer_settings(), std::move(scrollbar), layer_tree_root->id()); + std::move(scrollbar), layer_tree_root->id()); // Choose bounds to give max_scroll_offset = (30, 50). layer_tree_root->SetBounds(gfx::Size(70, 150)); @@ -265,12 +258,11 @@ TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { } while (false) TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) { - scoped_refptr root_clip_layer = Layer::Create(layer_settings()); - scoped_refptr root_layer = Layer::Create(layer_settings()); - scoped_refptr content_layer = Layer::Create(layer_settings()); + scoped_refptr root_clip_layer = Layer::Create(); + scoped_refptr root_layer = Layer::Create(); + scoped_refptr content_layer = Layer::Create(); scoped_refptr scrollbar_layer = - FakePaintedScrollbarLayer::Create(layer_settings(), false, true, - root_layer->id()); + FakePaintedScrollbarLayer::Create(false, true, root_layer->id()); root_layer->SetScrollClipLayerId(root_clip_layer->id()); // Give the root-clip a size that will result in MaxScrollOffset = (80, 0). @@ -306,12 +298,11 @@ TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) { } TEST_F(ScrollbarLayerTest, ThumbRect) { - scoped_refptr root_clip_layer = Layer::Create(layer_settings()); - scoped_refptr root_layer = Layer::Create(layer_settings()); - scoped_refptr content_layer = Layer::Create(layer_settings()); + scoped_refptr root_clip_layer = Layer::Create(); + scoped_refptr root_layer = Layer::Create(); + scoped_refptr content_layer = Layer::Create(); scoped_refptr scrollbar_layer = - FakePaintedScrollbarLayer::Create(layer_settings(), false, true, - root_layer->id()); + FakePaintedScrollbarLayer::Create(false, true, root_layer->id()); root_layer->SetScrollClipLayerId(root_clip_layer->id()); // Give the root-clip a size that will result in MaxScrollOffset = (80, 0). @@ -391,8 +382,8 @@ TEST_F(ScrollbarLayerTest, SolidColorDrawQuads) { scoped_ptr scrollbar(new FakeScrollbar(false, true, true)); LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false, - true, kThumbThickness, kTrackStart); + layer_tree_host_.get(), std::move(scrollbar), false, true, + kThumbThickness, kTrackStart); ScrollbarLayerImplBase* scrollbar_layer_impl = static_cast( layer_impl_tree_root->children()[1].get()); @@ -452,15 +443,15 @@ TEST_F(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { scoped_ptr scrollbar(new FakeScrollbar(false, true, true)); { - scoped_refptr layer_tree_root = Layer::Create(layer_settings()); - scoped_refptr scroll_layer = Layer::Create(layer_settings()); + scoped_refptr layer_tree_root = Layer::Create(); + scoped_refptr scroll_layer = Layer::Create(); scroll_layer->SetScrollClipLayerId(layer_tree_root->id()); - scoped_refptr child1 = Layer::Create(layer_settings()); + scoped_refptr child1 = Layer::Create(); scoped_refptr child2; const bool kIsLeftSideVerticalScrollbar = false; child2 = SolidColorScrollbarLayer::Create( - layer_settings(), scrollbar->Orientation(), kThumbThickness, - kTrackStart, kIsLeftSideVerticalScrollbar, child1->id()); + scrollbar->Orientation(), kThumbThickness, kTrackStart, + kIsLeftSideVerticalScrollbar, child1->id()); child2->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id()); scroll_layer->AddChild(child1); scroll_layer->InsertChild(child2, 1); @@ -612,12 +603,12 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest { void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; } void BeginTest() override { - scroll_layer_ = Layer::Create(layer_settings()); + scroll_layer_ = Layer::Create(); layer_tree_host()->root_layer()->AddChild(scroll_layer_); scoped_ptr scrollbar(new FakeScrollbar); - scrollbar_layer_ = PaintedScrollbarLayer::Create( - layer_settings(), std::move(scrollbar), scroll_layer_->id()); + scrollbar_layer_ = PaintedScrollbarLayer::Create(std::move(scrollbar), + scroll_layer_->id()); scrollbar_layer_->SetScrollLayer(scroll_layer_->id()); scrollbar_layer_->SetLayerTreeHost(layer_tree_host()); scrollbar_layer_->SetBounds(bounds_); @@ -676,19 +667,19 @@ class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest { int expected_deleted, bool use_solid_color_scrollbar) { scoped_ptr scrollbar(new FakeScrollbar(false, true, false)); - scoped_refptr layer_tree_root = Layer::Create(layer_settings()); - scoped_refptr content_layer = Layer::Create(layer_settings()); + scoped_refptr layer_tree_root = Layer::Create(); + scoped_refptr content_layer = Layer::Create(); scoped_refptr scrollbar_layer; if (use_solid_color_scrollbar) { const int kThumbThickness = 3; const int kTrackStart = 0; const bool kIsLeftSideVerticalScrollbar = false; scrollbar_layer = SolidColorScrollbarLayer::Create( - layer_settings(), scrollbar->Orientation(), kThumbThickness, - kTrackStart, kIsLeftSideVerticalScrollbar, layer_tree_root->id()); + scrollbar->Orientation(), kThumbThickness, kTrackStart, + kIsLeftSideVerticalScrollbar, layer_tree_root->id()); } else { - scrollbar_layer = PaintedScrollbarLayer::Create( - layer_settings(), std::move(scrollbar), layer_tree_root->id()); + scrollbar_layer = PaintedScrollbarLayer::Create(std::move(scrollbar), + layer_tree_root->id()); } layer_tree_root->AddChild(content_layer); layer_tree_root->AddChild(scrollbar_layer); @@ -741,11 +732,10 @@ TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TestResourceUpdate) { gfx::Point scrollbar_location(0, 185); - scoped_refptr layer_tree_root = Layer::Create(layer_settings()); - scoped_refptr content_layer = Layer::Create(layer_settings()); + scoped_refptr layer_tree_root = Layer::Create(); + scoped_refptr content_layer = Layer::Create(); scoped_refptr scrollbar_layer = - FakePaintedScrollbarLayer::Create(layer_settings(), false, true, - layer_tree_root->id()); + FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id()); layer_tree_root->AddChild(content_layer); layer_tree_root->AddChild(scrollbar_layer); @@ -884,11 +874,10 @@ class ScaledScrollbarLayerTestResourceCreation : public ScrollbarLayerTest { public: void TestResourceUpload(const float test_scale) { gfx::Point scrollbar_location(0, 185); - scoped_refptr layer_tree_root = Layer::Create(layer_settings()); - scoped_refptr content_layer = Layer::Create(layer_settings()); + scoped_refptr layer_tree_root = Layer::Create(); + scoped_refptr content_layer = Layer::Create(); scoped_refptr scrollbar_layer = - FakePaintedScrollbarLayer::Create(layer_settings(), false, true, - layer_tree_root->id()); + FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id()); layer_tree_root->AddChild(content_layer); layer_tree_root->AddChild(scrollbar_layer); @@ -956,10 +945,10 @@ class ScaledScrollbarLayerTestScaledRasterization : public ScrollbarLayerTest { void TestScale(const gfx::Rect scrollbar_rect, const float test_scale) { bool paint_during_update = true; bool has_thumb = false; - scoped_refptr layer_tree_root = Layer::Create(layer_settings()); + scoped_refptr layer_tree_root = Layer::Create(); scoped_refptr scrollbar_layer = - FakePaintedScrollbarLayer::Create(layer_settings(), paint_during_update, - has_thumb, layer_tree_root->id()); + FakePaintedScrollbarLayer::Create(paint_during_update, has_thumb, + layer_tree_root->id()); layer_tree_root->AddChild(scrollbar_layer); diff --git a/cc/layers/solid_color_layer.cc b/cc/layers/solid_color_layer.cc index 2fbaca1..176f1e3 100644 --- a/cc/layers/solid_color_layer.cc +++ b/cc/layers/solid_color_layer.cc @@ -13,14 +13,11 @@ scoped_ptr SolidColorLayer::CreateLayerImpl( return SolidColorLayerImpl::Create(tree_impl, id()); } -scoped_refptr SolidColorLayer::Create( - const LayerSettings& settings) { - return make_scoped_refptr(new SolidColorLayer(settings)); +scoped_refptr SolidColorLayer::Create() { + return make_scoped_refptr(new SolidColorLayer()); } -SolidColorLayer::SolidColorLayer(const LayerSettings& settings) - : Layer(settings) { -} +SolidColorLayer::SolidColorLayer() {} SolidColorLayer::~SolidColorLayer() {} diff --git a/cc/layers/solid_color_layer.h b/cc/layers/solid_color_layer.h index 9a16f1a..d1f108a 100644 --- a/cc/layers/solid_color_layer.h +++ b/cc/layers/solid_color_layer.h @@ -16,14 +16,14 @@ namespace cc { // SetBackgroundColor() on the base class. class CC_EXPORT SolidColorLayer : public Layer { public: - static scoped_refptr Create(const LayerSettings& settings); + static scoped_refptr Create(); scoped_ptr CreateLayerImpl(LayerTreeImpl* tree_impl) override; void SetBackgroundColor(SkColor color) override; protected: - explicit SolidColorLayer(const LayerSettings& settings); + SolidColorLayer(); private: ~SolidColorLayer() override; diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc index a4d1bfa..9ad01f2 100644 --- a/cc/layers/solid_color_layer_impl_unittest.cc +++ b/cc/layers/solid_color_layer_impl_unittest.cc @@ -9,7 +9,6 @@ #include #include "cc/layers/append_quads_data.h" -#include "cc/layers/layer_settings.h" #include "cc/layers/solid_color_layer.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/test/fake_impl_task_runner_provider.h" @@ -134,14 +133,11 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { gfx::Size layer_size = gfx::Size(100, 100); gfx::Rect visible_layer_rect = gfx::Rect(layer_size); - LayerSettings layer_settings; - - scoped_refptr layer = - SolidColorLayer::Create(layer_settings); + scoped_refptr layer = SolidColorLayer::Create(); layer->SetBounds(layer_size); layer->SetForceRenderSurface(true); - scoped_refptr root = Layer::Create(layer_settings); + scoped_refptr root = Layer::Create(); root->AddChild(layer); FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); diff --git a/cc/layers/solid_color_scrollbar_layer.cc b/cc/layers/solid_color_scrollbar_layer.cc index 62a3180..9df9167 100644 --- a/cc/layers/solid_color_scrollbar_layer.cc +++ b/cc/layers/solid_color_scrollbar_layer.cc @@ -23,31 +23,27 @@ scoped_ptr SolidColorScrollbarLayer::CreateLayerImpl( } scoped_refptr SolidColorScrollbarLayer::Create( - const LayerSettings& settings, ScrollbarOrientation orientation, int thumb_thickness, int track_start, bool is_left_side_vertical_scrollbar, int scroll_layer_id) { return make_scoped_refptr(new SolidColorScrollbarLayer( - settings, orientation, thumb_thickness, track_start, + orientation, thumb_thickness, track_start, is_left_side_vertical_scrollbar, scroll_layer_id)); } SolidColorScrollbarLayer::SolidColorScrollbarLayer( - const LayerSettings& settings, ScrollbarOrientation orientation, int thumb_thickness, int track_start, bool is_left_side_vertical_scrollbar, int scroll_layer_id) - : Layer(settings), - scroll_layer_id_(Layer::INVALID_ID), + : scroll_layer_id_(Layer::INVALID_ID), orientation_(orientation), thumb_thickness_(thumb_thickness), track_start_(track_start), - is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) { -} + is_left_side_vertical_scrollbar_(is_left_side_vertical_scrollbar) {} SolidColorScrollbarLayer::~SolidColorScrollbarLayer() {} diff --git a/cc/layers/solid_color_scrollbar_layer.h b/cc/layers/solid_color_scrollbar_layer.h index 8f0c00c..1ed52ef 100644 --- a/cc/layers/solid_color_scrollbar_layer.h +++ b/cc/layers/solid_color_scrollbar_layer.h @@ -18,7 +18,6 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, scoped_ptr CreateLayerImpl(LayerTreeImpl* tree_impl) override; static scoped_refptr Create( - const LayerSettings& settings, ScrollbarOrientation orientation, int thumb_thickness, int track_start, @@ -40,8 +39,7 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, ScrollbarOrientation orientation() const override; protected: - SolidColorScrollbarLayer(const LayerSettings& settings, - ScrollbarOrientation orientation, + SolidColorScrollbarLayer(ScrollbarOrientation orientation, int thumb_thickness, int track_start, bool is_left_side_vertical_scrollbar, diff --git a/cc/layers/surface_layer.cc b/cc/layers/surface_layer.cc index 71ceb46..f31a8ae 100644 --- a/cc/layers/surface_layer.cc +++ b/cc/layers/surface_layer.cc @@ -40,21 +40,17 @@ class SatisfySwapPromise : public SwapPromise { }; scoped_refptr SurfaceLayer::Create( - const LayerSettings& settings, const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback) { return make_scoped_refptr( - new SurfaceLayer(settings, satisfy_callback, require_callback)); + new SurfaceLayer(satisfy_callback, require_callback)); } -SurfaceLayer::SurfaceLayer(const LayerSettings& settings, - const SatisfyCallback& satisfy_callback, +SurfaceLayer::SurfaceLayer(const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback) - : Layer(settings), - surface_scale_(1.f), + : surface_scale_(1.f), satisfy_callback_(satisfy_callback), - require_callback_(require_callback) { -} + require_callback_(require_callback) {} SurfaceLayer::~SurfaceLayer() { DCHECK(!layer_tree_host()); diff --git a/cc/layers/surface_layer.h b/cc/layers/surface_layer.h index c2e8a2d..b4166d3 100644 --- a/cc/layers/surface_layer.h +++ b/cc/layers/surface_layer.h @@ -28,7 +28,6 @@ class CC_EXPORT SurfaceLayer : public Layer { using RequireCallback = base::Callback; static scoped_refptr Create( - const LayerSettings& settings, const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback); @@ -40,8 +39,7 @@ class CC_EXPORT SurfaceLayer : public Layer { void PushPropertiesTo(LayerImpl* layer) override; protected: - SurfaceLayer(const LayerSettings& settings, - const SatisfyCallback& satisfy_callback, + SurfaceLayer(const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback); bool HasDrawableContent() const override; diff --git a/cc/layers/surface_layer_unittest.cc b/cc/layers/surface_layer_unittest.cc index 2f8d5cd..0c15b5c 100644 --- a/cc/layers/surface_layer_unittest.cc +++ b/cc/layers/surface_layer_unittest.cc @@ -49,7 +49,6 @@ class SurfaceLayerTest : public testing::Test { FakeLayerTreeHostClient fake_client_; TestTaskGraphRunner task_graph_runner_; scoped_ptr layer_tree_host_; - LayerSettings layer_settings_; }; void SatisfyCallback(SurfaceSequence* out, SurfaceSequence in) { @@ -72,7 +71,7 @@ TEST_F(SurfaceLayerTest, MultipleFramesOneSurface) { SurfaceId required_id; std::set required_seq; scoped_refptr layer(SurfaceLayer::Create( - layer_settings_, base::Bind(&SatisfyCallback, &blank_change), + base::Bind(&SatisfyCallback, &blank_change), base::Bind(&RequireCallback, &required_id, &required_seq))); layer->SetSurfaceId(SurfaceId(1), 1.f, gfx::Size(1, 1)); layer_tree_host_->set_surface_id_namespace(1); @@ -81,7 +80,7 @@ TEST_F(SurfaceLayerTest, MultipleFramesOneSurface) { scoped_ptr layer_tree_host2 = FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); scoped_refptr layer2(SurfaceLayer::Create( - layer_settings_, base::Bind(&SatisfyCallback, &blank_change), + base::Bind(&SatisfyCallback, &blank_change), base::Bind(&RequireCallback, &required_id, &required_seq))); layer2->SetSurfaceId(SurfaceId(1), 1.f, gfx::Size(1, 1)); layer_tree_host2->set_surface_id_namespace(2); @@ -128,7 +127,7 @@ class SurfaceLayerSwapPromise : public LayerTreeTest { void BeginTest() override { layer_tree_host()->set_surface_id_namespace(1); layer_ = SurfaceLayer::Create( - layer_settings(), base::Bind(&SatisfyCallback, &satisfied_sequence_), + base::Bind(&SatisfyCallback, &satisfied_sequence_), base::Bind(&RequireCallback, &required_id_, &required_set_)); layer_->SetSurfaceId(SurfaceId(1), 1.f, gfx::Size(1, 1)); @@ -146,7 +145,7 @@ class SurfaceLayerSwapPromise : public LayerTreeTest { gfx::Size bounds(100, 100); layer_tree_host()->SetViewportSize(bounds); - blank_layer_ = SolidColorLayer::Create(layer_settings()); + blank_layer_ = SolidColorLayer::Create(); blank_layer_->SetIsDrawable(true); blank_layer_->SetBounds(gfx::Size(10, 10)); diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index 85df0f2..a656955 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc @@ -20,15 +20,12 @@ namespace cc { scoped_refptr TextureLayer::CreateForMailbox( - const LayerSettings& settings, TextureLayerClient* client) { - return scoped_refptr(new TextureLayer(settings, client)); + return scoped_refptr(new TextureLayer(client)); } -TextureLayer::TextureLayer(const LayerSettings& settings, - TextureLayerClient* client) - : Layer(settings), - client_(client), +TextureLayer::TextureLayer(TextureLayerClient* client) + : client_(client), flipped_(true), nearest_neighbor_(false), uv_top_left_(0.f, 0.f), diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index 6b529dd..3601b23 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h @@ -91,7 +91,6 @@ class CC_EXPORT TextureLayer : public Layer { // Used when mailbox names are specified instead of texture IDs. static scoped_refptr CreateForMailbox( - const LayerSettings& settings, TextureLayerClient* client); // Resets the client, which also resets the texture. @@ -146,7 +145,7 @@ class CC_EXPORT TextureLayer : public Layer { void PushPropertiesTo(LayerImpl* layer) override; protected: - TextureLayer(const LayerSettings& settings, TextureLayerClient* client); + explicit TextureLayer(TextureLayerClient* client); ~TextureLayer() override; bool HasDrawableContent() const override; diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 6b28008..b02dd52 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -235,12 +235,11 @@ class TextureLayerTest : public testing::Test { scoped_ptr output_surface_; FakeLayerTreeHostImpl host_impl_; CommonMailboxObjects test_data_; - LayerSettings layer_settings_; }; TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); // Test properties that should call SetNeedsCommit. All properties need to @@ -277,7 +276,7 @@ class TextureLayerWithMailboxTest : public TextureLayerTest { TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); @@ -334,7 +333,7 @@ TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { TEST_F(TextureLayerTest, SetTextureMailboxWithoutReleaseCallback) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); // These use the same gpu::Mailbox, but different sync points. @@ -416,7 +415,7 @@ class TextureLayerMailboxHolderTest : public TextureLayerTest { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -469,7 +468,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -523,7 +522,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -577,7 +576,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_SecondImplRefShortcut) { scoped_refptr test_layer = - TextureLayer::CreateForMailbox(layer_settings_, nullptr); + TextureLayer::CreateForMailbox(nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -680,10 +679,10 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); gfx::Size bounds(100, 100); - root_ = Layer::Create(layer_settings()); + root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -797,10 +796,10 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { void BeginTest() override { gfx::Size bounds(100, 100); - root_ = Layer::Create(layer_settings()); + root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1095,11 +1094,11 @@ class TextureLayerNoExtraCommitForMailboxTest } void SetupTree() override { - scoped_refptr root = Layer::Create(layer_settings()); + scoped_refptr root = Layer::Create(); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); - texture_layer_ = TextureLayer::CreateForMailbox(layer_settings(), this); + texture_layer_ = TextureLayer::CreateForMailbox(this); texture_layer_->SetBounds(gfx::Size(10, 10)); texture_layer_->SetIsDrawable(true); root->AddChild(texture_layer_); @@ -1193,22 +1192,22 @@ class TextureLayerChangeInvisibleMailboxTest } void SetupTree() override { - scoped_refptr root = Layer::Create(layer_settings()); + scoped_refptr root = Layer::Create(); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); - solid_layer_ = SolidColorLayer::Create(layer_settings()); + solid_layer_ = SolidColorLayer::Create(); solid_layer_->SetBounds(gfx::Size(10, 10)); solid_layer_->SetIsDrawable(true); solid_layer_->SetBackgroundColor(SK_ColorWHITE); root->AddChild(solid_layer_); - parent_layer_ = Layer::Create(layer_settings()); + parent_layer_ = Layer::Create(); parent_layer_->SetBounds(gfx::Size(10, 10)); parent_layer_->SetIsDrawable(true); root->AddChild(parent_layer_); - texture_layer_ = TextureLayer::CreateForMailbox(layer_settings(), this); + texture_layer_ = TextureLayer::CreateForMailbox(this); texture_layer_->SetBounds(gfx::Size(10, 10)); texture_layer_->SetIsDrawable(true); parent_layer_->AddChild(texture_layer_); @@ -1324,7 +1323,7 @@ class TextureLayerReleaseResourcesBase LayerTreeTest::SetupTree(); scoped_refptr texture_layer = - TextureLayer::CreateForMailbox(layer_settings(), this); + TextureLayer::CreateForMailbox(this); texture_layer->SetBounds(gfx::Size(10, 10)); texture_layer->SetIsDrawable(true); @@ -1390,10 +1389,10 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { void SetupTree() override { gfx::Size bounds(100, 100); - root_ = Layer::Create(layer_settings()); + root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1461,10 +1460,10 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { void SetupTree() override { gfx::Size bounds(100, 100); - root_ = Layer::Create(layer_settings()); + root_ = Layer::Create(); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); + layer_ = TextureLayer::CreateForMailbox(nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); diff --git a/cc/layers/ui_resource_layer.cc b/cc/layers/ui_resource_layer.cc index 6b5f877..6842851 100644 --- a/cc/layers/ui_resource_layer.cc +++ b/cc/layers/ui_resource_layer.cc @@ -49,13 +49,12 @@ class SharedUIResourceHolder : public UIResourceLayer::UIResourceHolder { UIResourceLayer::UIResourceHolder::~UIResourceHolder() {} -scoped_refptr UIResourceLayer::Create( - const LayerSettings& settings) { - return make_scoped_refptr(new UIResourceLayer(settings)); +scoped_refptr UIResourceLayer::Create() { + return make_scoped_refptr(new UIResourceLayer()); } -UIResourceLayer::UIResourceLayer(const LayerSettings& settings) - : Layer(settings), uv_top_left_(0.f, 0.f), uv_bottom_right_(1.f, 1.f) { +UIResourceLayer::UIResourceLayer() + : uv_top_left_(0.f, 0.f), uv_bottom_right_(1.f, 1.f) { vertex_opacity_[0] = 1.0f; vertex_opacity_[1] = 1.0f; vertex_opacity_[2] = 1.0f; diff --git a/cc/layers/ui_resource_layer.h b/cc/layers/ui_resource_layer.h index 52a45b7..794a86c 100644 --- a/cc/layers/ui_resource_layer.h +++ b/cc/layers/ui_resource_layer.h @@ -19,7 +19,7 @@ class ScopedUIResource; class CC_EXPORT UIResourceLayer : public Layer { public: - static scoped_refptr Create(const LayerSettings& settings); + static scoped_refptr Create(); void PushPropertiesTo(LayerImpl* layer) override; @@ -49,7 +49,7 @@ class CC_EXPORT UIResourceLayer : public Layer { }; protected: - explicit UIResourceLayer(const LayerSettings& settings); + UIResourceLayer(); ~UIResourceLayer() override; bool HasDrawableContent() const override; diff --git a/cc/layers/ui_resource_layer_unittest.cc b/cc/layers/ui_resource_layer_unittest.cc index fa27710..94efef4 100644 --- a/cc/layers/ui_resource_layer_unittest.cc +++ b/cc/layers/ui_resource_layer_unittest.cc @@ -5,7 +5,6 @@ #include "cc/layers/ui_resource_layer.h" #include "base/thread_task_runner_handle.h" -#include "cc/layers/layer_settings.h" #include "cc/resources/resource_provider.h" #include "cc/resources/scoped_ui_resource.h" #include "cc/test/fake_layer_tree_host.h" @@ -30,9 +29,8 @@ namespace { class TestUIResourceLayer : public UIResourceLayer { public: - static scoped_refptr Create( - const LayerSettings& settings) { - return make_scoped_refptr(new TestUIResourceLayer(settings)); + static scoped_refptr Create() { + return make_scoped_refptr(new TestUIResourceLayer()); } UIResourceId GetUIResourceId() { @@ -42,10 +40,7 @@ class TestUIResourceLayer : public UIResourceLayer { } protected: - explicit TestUIResourceLayer(const LayerSettings& settings) - : UIResourceLayer(settings) { - SetIsDrawable(true); - } + TestUIResourceLayer() : UIResourceLayer() { SetIsDrawable(true); } ~TestUIResourceLayer() override {} }; @@ -68,12 +63,10 @@ class UIResourceLayerTest : public testing::Test { FakeLayerTreeHostClient fake_client_; TestTaskGraphRunner task_graph_runner_; scoped_ptr layer_tree_host_; - LayerSettings layer_settings_; }; TEST_F(UIResourceLayerTest, SetBitmap) { - scoped_refptr test_layer = - TestUIResourceLayer::Create(layer_settings_); + scoped_refptr test_layer = TestUIResourceLayer::Create(); ASSERT_TRUE(test_layer.get()); test_layer->SetBounds(gfx::Size(100, 100)); @@ -97,8 +90,7 @@ TEST_F(UIResourceLayerTest, SetBitmap) { } TEST_F(UIResourceLayerTest, SetUIResourceId) { - scoped_refptr test_layer = - TestUIResourceLayer::Create(layer_settings_); + scoped_refptr test_layer = TestUIResourceLayer::Create(); ASSERT_TRUE(test_layer.get()); test_layer->SetBounds(gfx::Size(100, 100)); @@ -130,8 +122,7 @@ TEST_F(UIResourceLayerTest, SetUIResourceId) { } TEST_F(UIResourceLayerTest, BitmapClearedOnSetUIResourceId) { - scoped_refptr test_layer = - TestUIResourceLayer::Create(layer_settings_); + scoped_refptr test_layer = TestUIResourceLayer::Create(); ASSERT_TRUE(test_layer.get()); test_layer->SetBounds(gfx::Size(100, 100)); diff --git a/cc/layers/video_layer.cc b/cc/layers/video_layer.cc index 49d6490..b55d82a 100644 --- a/cc/layers/video_layer.cc +++ b/cc/layers/video_layer.cc @@ -9,16 +9,14 @@ namespace cc { scoped_refptr VideoLayer::Create( - const LayerSettings& settings, VideoFrameProvider* provider, media::VideoRotation video_rotation) { - return make_scoped_refptr(new VideoLayer(settings, provider, video_rotation)); + return make_scoped_refptr(new VideoLayer(provider, video_rotation)); } -VideoLayer::VideoLayer(const LayerSettings& settings, - VideoFrameProvider* provider, +VideoLayer::VideoLayer(VideoFrameProvider* provider, media::VideoRotation video_rotation) - : Layer(settings), provider_(provider), video_rotation_(video_rotation) { + : provider_(provider), video_rotation_(video_rotation) { DCHECK(provider_); } diff --git a/cc/layers/video_layer.h b/cc/layers/video_layer.h index fdc9753..4828468 100644 --- a/cc/layers/video_layer.h +++ b/cc/layers/video_layer.h @@ -9,7 +9,6 @@ #include "base/macros.h" #include "cc/base/cc_export.h" #include "cc/layers/layer.h" -#include "cc/layers/layer_settings.h" #include "media/base/video_rotation.h" namespace media { class VideoFrame; } @@ -22,8 +21,7 @@ class VideoLayerImpl; // A Layer that contains a Video element. class CC_EXPORT VideoLayer : public Layer { public: - static scoped_refptr Create(const LayerSettings& settings, - VideoFrameProvider* provider, + static scoped_refptr Create(VideoFrameProvider* provider, media::VideoRotation video_rotation); scoped_ptr CreateLayerImpl(LayerTreeImpl* tree_impl) override; @@ -31,9 +29,7 @@ class CC_EXPORT VideoLayer : public Layer { bool Update() override; private: - VideoLayer(const LayerSettings& settings, - VideoFrameProvider* provider, - media::VideoRotation video_rotation); + VideoLayer(VideoFrameProvider* provider, media::VideoRotation video_rotation); ~VideoLayer() override; // This pointer is only for passing to VideoLayerImpl's constructor. It should -- cgit v1.1