diff options
author | loyso <loyso@chromium.org> | 2015-05-24 20:26:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-25 03:27:26 +0000 |
commit | a6edaaff54e9b948c64a896edff992c04e63205d (patch) | |
tree | af7fe7c050ec5d675d33d3d92acb69170b0a29ed | |
parent | 6f6374ee312ec0f8e07e208056a8f9135d97087f (diff) | |
download | chromium_src-a6edaaff54e9b948c64a896edff992c04e63205d.zip chromium_src-a6edaaff54e9b948c64a896edff992c04e63205d.tar.gz chromium_src-a6edaaff54e9b948c64a896edff992c04e63205d.tar.bz2 |
CC: Plumb LayerSettings parameter for cc::Layer construction.
Next episode:
https://codereview.chromium.org/1101823002/
This is a prerequisite to implement compositor animation timelines.
https://codereview.chromium.org/947033002/
BUG=394777
R=ajuma@chromium.org
R=vollick@chromium.org
R=piman@chromium.org
R=danakj@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1122393003
Cr-Commit-Position: refs/heads/master@{#331256}
145 files changed, 1769 insertions, 1316 deletions
diff --git a/android_webview/browser/hardware_renderer.cc b/android_webview/browser/hardware_renderer.cc index 8ee14f5..844dcf5 100644 --- a/android_webview/browser/hardware_renderer.cc +++ b/android_webview/browser/hardware_renderer.cc @@ -31,6 +31,12 @@ #include "ui/gfx/transform.h" #include "ui/gl/gl_bindings.h" +namespace { +cc::LayerSettings HardwareRendererLayerSettings() { + return cc::LayerSettings(); +} +} + namespace android_webview { HardwareRenderer::HardwareRenderer(SharedRendererState* state) @@ -39,7 +45,7 @@ HardwareRenderer::HardwareRenderer(SharedRendererState* state) stencil_enabled_(false), viewport_clip_valid_for_dcheck_(false), gl_surface_(new AwGLSurface), - root_layer_(cc::Layer::Create()), + root_layer_(cc::Layer::Create(HardwareRendererLayerSettings())), resource_collection_(new cc::DelegatedFrameResourceCollection), output_surface_(NULL) { DCHECK(last_egl_context_); @@ -134,7 +140,8 @@ void HardwareRenderer::CommitFrame() { frame_provider_ = new cc::DelegatedFrameProvider( resource_collection_.get(), frame->delegated_frame_data.Pass()); - delegated_layer_ = cc::DelegatedRendererLayer::Create(frame_provider_); + delegated_layer_ = cc::DelegatedRendererLayer::Create( + HardwareRendererLayerSettings(), frame_provider_); delegated_layer_->SetBounds(frame_size_); delegated_layer_->SetIsDrawable(true); diff --git a/cc/blink/web_content_layer_impl.cc b/cc/blink/web_content_layer_impl.cc index a480a06..9e31bb6 100644 --- a/cc/blink/web_content_layer_impl.cc +++ b/cc/blink/web_content_layer_impl.cc @@ -39,9 +39,11 @@ PaintingControlToWeb( WebContentLayerImpl::WebContentLayerImpl(blink::WebContentLayerClient* client) : client_(client) { if (WebLayerImpl::UsingPictureLayer()) - layer_ = make_scoped_ptr(new WebLayerImpl(PictureLayer::Create(this))); + layer_ = make_scoped_ptr(new WebLayerImpl( + PictureLayer::Create(WebLayerImpl::LayerSettings(), this))); else - layer_ = make_scoped_ptr(new WebLayerImpl(ContentLayer::Create(this))); + layer_ = make_scoped_ptr(new WebLayerImpl( + ContentLayer::Create(WebLayerImpl::LayerSettings(), this))); layer_->layer()->SetIsDrawable(true); } diff --git a/cc/blink/web_external_texture_layer_impl.cc b/cc/blink/web_external_texture_layer_impl.cc index 8d29aa1..0b6bbdb 100644 --- a/cc/blink/web_external_texture_layer_impl.cc +++ b/cc/blink/web_external_texture_layer_impl.cc @@ -26,7 +26,8 @@ WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( blink::WebExternalTextureLayerClient* client) : client_(client) { cc::TextureLayerClient* cc_client = client_ ? this : nullptr; - scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(cc_client); + scoped_refptr<TextureLayer> layer = + TextureLayer::CreateForMailbox(WebLayerImpl::LayerSettings(), cc_client); layer->SetIsDrawable(true); layer_.reset(new WebLayerImpl(layer)); } diff --git a/cc/blink/web_image_layer_impl.cc b/cc/blink/web_image_layer_impl.cc index afd551a..1cc6e80 100644 --- a/cc/blink/web_image_layer_impl.cc +++ b/cc/blink/web_image_layer_impl.cc @@ -13,9 +13,11 @@ namespace cc_blink { WebImageLayerImpl::WebImageLayerImpl() { if (WebLayerImpl::UsingPictureLayer()) - layer_.reset(new WebLayerImplFixedBounds(cc::PictureImageLayer::Create())); + layer_.reset(new WebLayerImplFixedBounds( + cc::PictureImageLayer::Create(WebLayerImpl::LayerSettings()))); else - layer_.reset(new WebLayerImpl(cc::ImageLayer::Create())); + layer_.reset(new WebLayerImpl( + cc::ImageLayer::Create(WebLayerImpl::LayerSettings()))); } WebImageLayerImpl::~WebImageLayerImpl() { diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc index 8bad92a..bfe4616 100644 --- a/cc/blink/web_layer_impl.cc +++ b/cc/blink/web_layer_impl.cc @@ -48,9 +48,12 @@ namespace { bool g_impl_side_painting_enabled = false; +base::LazyInstance<cc::LayerSettings> g_layer_settings = + LAZY_INSTANCE_INITIALIZER; + } // namespace -WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { +WebLayerImpl::WebLayerImpl() : layer_(Layer::Create(LayerSettings())) { web_layer_client_ = nullptr; layer_->SetLayerClient(this); } @@ -76,6 +79,16 @@ void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { g_impl_side_painting_enabled = enabled; } +// static +void WebLayerImpl::SetLayerSettings(const cc::LayerSettings& settings) { + g_layer_settings.Get() = settings; +} + +// static +const cc::LayerSettings& WebLayerImpl::LayerSettings() { + return g_layer_settings.Get(); +} + int WebLayerImpl::id() const { return layer_->id(); } diff --git a/cc/blink/web_layer_impl.h b/cc/blink/web_layer_impl.h index beaf3b5..cf4eaae 100644 --- a/cc/blink/web_layer_impl.h +++ b/cc/blink/web_layer_impl.h @@ -39,6 +39,7 @@ class ConvertableToTraceFormat; namespace cc { class Layer; +class LayerSettings; } namespace cc_blink { @@ -54,6 +55,10 @@ class WebLayerImpl : public blink::WebLayer, public cc::LayerClient { static bool UsingPictureLayer(); CC_BLINK_EXPORT static void SetImplSidePaintingEnabled(bool enabled); + CC_BLINK_EXPORT static void SetLayerSettings( + const cc::LayerSettings& settings); + CC_BLINK_EXPORT static const cc::LayerSettings& LayerSettings(); + CC_BLINK_EXPORT cc::Layer* layer() const; // WebLayer implementation. diff --git a/cc/blink/web_layer_impl_fixed_bounds_unittest.cc b/cc/blink/web_layer_impl_fixed_bounds_unittest.cc index c9fd4fa..6bdc2db 100644 --- a/cc/blink/web_layer_impl_fixed_bounds_unittest.cc +++ b/cc/blink/web_layer_impl_fixed_bounds_unittest.cc @@ -88,15 +88,16 @@ void CompareFixedBoundsLayerAndNormalLayer(const WebFloatPoint& anchor_point, scoped_ptr<WebLayerImplFixedBounds> root_layer(new WebLayerImplFixedBounds()); - WebLayerImplFixedBounds* fixed_bounds_layer = - new WebLayerImplFixedBounds(cc::PictureImageLayer::Create()); + WebLayerImplFixedBounds* fixed_bounds_layer = new WebLayerImplFixedBounds( + cc::PictureImageLayer::Create(WebLayerImpl::LayerSettings())); fixed_bounds_layer->setBounds(bounds); fixed_bounds_layer->SetFixedBounds(fixed_bounds); fixed_bounds_layer->setTransform(transform.matrix()); fixed_bounds_layer->setPosition(position); root_layer->addChild(fixed_bounds_layer); - WebLayerImpl* normal_layer(new WebLayerImpl(cc::PictureImageLayer::Create())); + WebLayerImpl* normal_layer( + new WebLayerImpl(cc::PictureImageLayer::Create(cc::LayerSettings()))); normal_layer->setBounds(bounds); normal_layer->setTransform(transform.matrix()); diff --git a/cc/blink/web_nine_patch_layer_impl.cc b/cc/blink/web_nine_patch_layer_impl.cc index 0943491..8dd9980 100644 --- a/cc/blink/web_nine_patch_layer_impl.cc +++ b/cc/blink/web_nine_patch_layer_impl.cc @@ -14,7 +14,8 @@ namespace cc_blink { WebNinePatchLayerImpl::WebNinePatchLayerImpl() { - layer_.reset(new WebLayerImpl(cc::NinePatchLayer::Create())); + layer_.reset(new WebLayerImpl( + cc::NinePatchLayer::Create(WebLayerImpl::LayerSettings()))); } WebNinePatchLayerImpl::~WebNinePatchLayerImpl() { diff --git a/cc/blink/web_scrollbar_layer_impl.cc b/cc/blink/web_scrollbar_layer_impl.cc index c94f2c5..a6813cb 100644 --- a/cc/blink/web_scrollbar_layer_impl.cc +++ b/cc/blink/web_scrollbar_layer_impl.cc @@ -31,6 +31,7 @@ WebScrollbarLayerImpl::WebScrollbarLayerImpl( blink::WebScrollbarThemePainter painter, blink::WebScrollbarThemeGeometry* geometry) : layer_(new WebLayerImpl(PaintedScrollbarLayer::Create( + WebLayerImpl::LayerSettings(), scoped_ptr<cc::Scrollbar>( new ScrollbarImpl(make_scoped_ptr(scrollbar), painter, @@ -44,7 +45,8 @@ WebScrollbarLayerImpl::WebScrollbarLayerImpl( int track_start, bool is_left_side_vertical_scrollbar) : layer_(new WebLayerImpl( - SolidColorScrollbarLayer::Create(ConvertOrientation(orientation), + SolidColorScrollbarLayer::Create(WebLayerImpl::LayerSettings(), + ConvertOrientation(orientation), thumb_thickness, track_start, is_left_side_vertical_scrollbar, diff --git a/cc/debug/micro_benchmark_controller_unittest.cc b/cc/debug/micro_benchmark_controller_unittest.cc index 2a8dce4..87a3b42 100644 --- a/cc/debug/micro_benchmark_controller_unittest.cc +++ b/cc/debug/micro_benchmark_controller_unittest.cc @@ -28,7 +28,7 @@ class MicroBenchmarkControllerTest : public testing::Test { impl_proxy_.get(), shared_bitmap_manager_.get(), nullptr)); layer_tree_host_ = FakeLayerTreeHost::Create(&layer_tree_host_client_); - layer_tree_host_->SetRootLayer(Layer::Create()); + layer_tree_host_->SetRootLayer(Layer::Create(LayerSettings())); layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy)); } diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index 7efa1c2..2955773 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -30,12 +30,14 @@ void ContentLayerPainter::Paint(SkCanvas* canvas, ContentLayerClient::PAINTING_BEHAVIOR_NORMAL); } -scoped_refptr<ContentLayer> ContentLayer::Create(ContentLayerClient* client) { - return make_scoped_refptr(new ContentLayer(client)); +scoped_refptr<ContentLayer> ContentLayer::Create(const LayerSettings& settings, + ContentLayerClient* client) { + return make_scoped_refptr(new ContentLayer(settings, client)); } -ContentLayer::ContentLayer(ContentLayerClient* client) - : TiledLayer(), client_(client) { +ContentLayer::ContentLayer(const LayerSettings& settings, + ContentLayerClient* client) + : TiledLayer(settings), client_(client) { } ContentLayer::~ContentLayer() {} diff --git a/cc/layers/content_layer.h b/cc/layers/content_layer.h index 5d6ac15..f8b9f20 100644 --- a/cc/layers/content_layer.h +++ b/cc/layers/content_layer.h @@ -34,7 +34,8 @@ class CC_EXPORT ContentLayerPainter : public LayerPainter { // A layer that renders its contents into an SkCanvas. class CC_EXPORT ContentLayer : public TiledLayer { public: - static scoped_refptr<ContentLayer> Create(ContentLayerClient* client); + static scoped_refptr<ContentLayer> Create(const LayerSettings& settings, + ContentLayerClient* client); void ClearClient(); @@ -51,7 +52,7 @@ class CC_EXPORT ContentLayer : public TiledLayer { void OnOutputSurfaceCreated() override; protected: - explicit ContentLayer(ContentLayerClient* client); + ContentLayer(const LayerSettings& settings, ContentLayerClient* client); ~ContentLayer() override; bool HasDrawableContent() const override; diff --git a/cc/layers/contents_scaling_layer.cc b/cc/layers/contents_scaling_layer.cc index b44830f..c50575b 100644 --- a/cc/layers/contents_scaling_layer.cc +++ b/cc/layers/contents_scaling_layer.cc @@ -14,9 +14,11 @@ gfx::Size ContentsScalingLayer::ComputeContentBoundsForScale( return gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale_x, scale_y)); } -ContentsScalingLayer::ContentsScalingLayer() - : last_update_contents_scale_x_(0.f), - last_update_contents_scale_y_(0.f) {} +ContentsScalingLayer::ContentsScalingLayer(const LayerSettings& settings) + : Layer(settings), + last_update_contents_scale_x_(0.f), + last_update_contents_scale_y_(0.f) { +} ContentsScalingLayer::~ContentsScalingLayer() { } diff --git a/cc/layers/contents_scaling_layer.h b/cc/layers/contents_scaling_layer.h index 15faa00..1ac6863 100644 --- a/cc/layers/contents_scaling_layer.h +++ b/cc/layers/contents_scaling_layer.h @@ -23,7 +23,7 @@ class CC_EXPORT ContentsScalingLayer : public Layer { const OcclusionTracker<Layer>* occlusion) override; protected: - ContentsScalingLayer(); + explicit ContentsScalingLayer(const LayerSettings& settings); ~ContentsScalingLayer() override; gfx::Size ComputeContentBoundsForScale(float scale_x, float scale_y) const; diff --git a/cc/layers/contents_scaling_layer_unittest.cc b/cc/layers/contents_scaling_layer_unittest.cc index 38385a0..efad264 100644 --- a/cc/layers/contents_scaling_layer_unittest.cc +++ b/cc/layers/contents_scaling_layer_unittest.cc @@ -15,8 +15,8 @@ namespace { class MockContentsScalingLayer : public ContentsScalingLayer { public: - MockContentsScalingLayer() - : ContentsScalingLayer() {} + explicit MockContentsScalingLayer(const LayerSettings& settings) + : ContentsScalingLayer(settings) {} void SetNeedsDisplayRect(const gfx::Rect& dirty_rect) override { last_needs_display_rect_ = dirty_rect; @@ -42,13 +42,15 @@ static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) { } TEST(ContentsScalingLayerTest, CheckContentsBounds) { + LayerSettings layer_settings; + FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); scoped_refptr<MockContentsScalingLayer> test_layer = - make_scoped_refptr(new MockContentsScalingLayer()); + make_scoped_refptr(new MockContentsScalingLayer(layer_settings)); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings); root->AddChild(test_layer); host->SetRootLayer(root); diff --git a/cc/layers/delegated_frame_provider_unittest.cc b/cc/layers/delegated_frame_provider_unittest.cc index b54b9d4..aab9436 100644 --- a/cc/layers/delegated_frame_provider_unittest.cc +++ b/cc/layers/delegated_frame_provider_unittest.cc @@ -9,6 +9,7 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/resources/returned_resource.h" #include "cc/resources/transferable_resource.h" +#include "cc/trees/layer_tree_settings.h" #include "testing/gtest/include/gtest/gtest.h" namespace cc { @@ -89,6 +90,7 @@ class DelegatedFrameProviderTest scoped_refptr<DelegatedFrameProvider> frame_provider_; bool resources_available_; ReturnedResourceArray resources_; + LayerSettings layer_settings_; }; TEST_F(DelegatedFrameProviderTest, SameResources) { @@ -152,9 +154,9 @@ TEST_F(DelegatedFrameProviderTest, RefResources) { SetFrameProvider(frame.Pass()); scoped_refptr<DelegatedRendererLayer> observer1 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); scoped_refptr<DelegatedRendererLayer> observer2 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); gfx::RectF damage; @@ -210,9 +212,9 @@ TEST_F(DelegatedFrameProviderTest, RefResourcesInFrameProvider) { SetFrameProvider(frame.Pass()); scoped_refptr<DelegatedRendererLayer> observer1 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); scoped_refptr<DelegatedRendererLayer> observer2 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); gfx::RectF damage; @@ -252,9 +254,9 @@ TEST_F(DelegatedFrameProviderTest, RefResourcesInFrameProviderUntilDestroy) { SetFrameProvider(frame.Pass()); scoped_refptr<DelegatedRendererLayer> observer1 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); scoped_refptr<DelegatedRendererLayer> observer2 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); gfx::RectF damage; @@ -296,9 +298,9 @@ TEST_F(DelegatedFrameProviderTest, Damage) { SetFrameProvider(frame.Pass()); scoped_refptr<DelegatedRendererLayer> observer1 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); scoped_refptr<DelegatedRendererLayer> observer2 = - DelegatedRendererLayer::Create(frame_provider_); + DelegatedRendererLayer::Create(layer_settings_, frame_provider_); gfx::RectF damage; diff --git a/cc/layers/delegated_renderer_layer.cc b/cc/layers/delegated_renderer_layer.cc index f95c9bd..99f089f 100644 --- a/cc/layers/delegated_renderer_layer.cc +++ b/cc/layers/delegated_renderer_layer.cc @@ -12,14 +12,16 @@ namespace cc { scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create( + const LayerSettings& settings, const scoped_refptr<DelegatedFrameProvider>& frame_provider) { return scoped_refptr<DelegatedRendererLayer>( - new DelegatedRendererLayer(frame_provider)); + new DelegatedRendererLayer(settings, frame_provider)); } DelegatedRendererLayer::DelegatedRendererLayer( + const LayerSettings& settings, const scoped_refptr<DelegatedFrameProvider>& frame_provider) - : Layer(), + : Layer(settings), frame_provider_(frame_provider), should_collect_new_frame_(true), frame_data_(nullptr), diff --git a/cc/layers/delegated_renderer_layer.h b/cc/layers/delegated_renderer_layer.h index 39d2696..14c2e34 100644 --- a/cc/layers/delegated_renderer_layer.h +++ b/cc/layers/delegated_renderer_layer.h @@ -19,6 +19,7 @@ namespace cc { class CC_EXPORT DelegatedRendererLayer : public Layer { public: static scoped_refptr<DelegatedRendererLayer> Create( + const LayerSettings& settings, const scoped_refptr<DelegatedFrameProvider>& frame_provider); scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; @@ -34,6 +35,7 @@ class CC_EXPORT DelegatedRendererLayer : public Layer { protected: DelegatedRendererLayer( + const LayerSettings& settings, const scoped_refptr<DelegatedFrameProvider>& frame_provider); ~DelegatedRendererLayer() override; diff --git a/cc/layers/delegated_renderer_layer_unittest.cc b/cc/layers/delegated_renderer_layer_unittest.cc index f243d73..96b62af 100644 --- a/cc/layers/delegated_renderer_layer_unittest.cc +++ b/cc/layers/delegated_renderer_layer_unittest.cc @@ -44,10 +44,11 @@ class DelegatedRendererLayerTestSimple : public DelegatedRendererLayerTest { frame_data->render_pass_list.push_back(root_pass.Pass()); resources_ = new DelegatedFrameResourceCollection; provider_ = new DelegatedFrameProvider(resources_, frame_data.Pass()); - root_layer_ = SolidColorLayer::Create(); - layer_before_ = SolidColorLayer::Create(); + LayerSettings layer_settings; + root_layer_ = SolidColorLayer::Create(layer_settings); + layer_before_ = SolidColorLayer::Create(layer_settings); delegated_renderer_layer_ = - FakeDelegatedRendererLayer::Create(provider_.get()); + FakeDelegatedRendererLayer::Create(layer_settings, provider_.get()); } protected: diff --git a/cc/layers/heads_up_display_layer.cc b/cc/layers/heads_up_display_layer.cc index 5dd4bd2..388c2ad2 100644 --- a/cc/layers/heads_up_display_layer.cc +++ b/cc/layers/heads_up_display_layer.cc @@ -12,11 +12,13 @@ namespace cc { -scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() { - return make_scoped_refptr(new HeadsUpDisplayLayer()); +scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create( + const LayerSettings& settings) { + return make_scoped_refptr(new HeadsUpDisplayLayer(settings)); } -HeadsUpDisplayLayer::HeadsUpDisplayLayer() { +HeadsUpDisplayLayer::HeadsUpDisplayLayer(const LayerSettings& settings) + : Layer(settings) { SetIsDrawable(true); UpdateDrawsContent(HasDrawableContent()); } diff --git a/cc/layers/heads_up_display_layer.h b/cc/layers/heads_up_display_layer.h index ddc34f2..0760353 100644 --- a/cc/layers/heads_up_display_layer.h +++ b/cc/layers/heads_up_display_layer.h @@ -15,7 +15,8 @@ namespace cc { class CC_EXPORT HeadsUpDisplayLayer : public Layer { public: - static scoped_refptr<HeadsUpDisplayLayer> Create(); + static scoped_refptr<HeadsUpDisplayLayer> Create( + const LayerSettings& settings); void PrepareForCalculateDrawProperties( const gfx::Size& device_viewport, float device_scale_factor); @@ -23,7 +24,7 @@ class CC_EXPORT HeadsUpDisplayLayer : public Layer { scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; protected: - HeadsUpDisplayLayer(); + explicit HeadsUpDisplayLayer(const LayerSettings& settings); bool HasDrawableContent() const override; private: diff --git a/cc/layers/heads_up_display_unittest.cc b/cc/layers/heads_up_display_unittest.cc index 312e482..532a169 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() {} + DrawsContentLayer() : Layer(LayerSettings()) {} ~DrawsContentLayer() override {} }; diff --git a/cc/layers/image_layer.cc b/cc/layers/image_layer.cc index 67e620c..19173b0 100644 --- a/cc/layers/image_layer.cc +++ b/cc/layers/image_layer.cc @@ -13,11 +13,12 @@ namespace cc { -scoped_refptr<ImageLayer> ImageLayer::Create() { - return make_scoped_refptr(new ImageLayer()); +scoped_refptr<ImageLayer> ImageLayer::Create(const LayerSettings& settings) { + return make_scoped_refptr(new ImageLayer(settings)); } -ImageLayer::ImageLayer() : TiledLayer() {} +ImageLayer::ImageLayer(const LayerSettings& settings) : TiledLayer(settings) { +} ImageLayer::~ImageLayer() {} diff --git a/cc/layers/image_layer.h b/cc/layers/image_layer.h index ed2a2a3..a81b599 100644 --- a/cc/layers/image_layer.h +++ b/cc/layers/image_layer.h @@ -16,7 +16,7 @@ class ImageLayerUpdater; // A Layer that contains only an Image element. class CC_EXPORT ImageLayer : public TiledLayer { public: - static scoped_refptr<ImageLayer> Create(); + static scoped_refptr<ImageLayer> Create(const LayerSettings& settings); // Layer implementation. void SetTexturePriorities(const PriorityCalculator& priority_calc) override; @@ -34,7 +34,7 @@ class CC_EXPORT ImageLayer : public TiledLayer { bool HasDrawableContent() const override; private: - ImageLayer(); + explicit ImageLayer(const LayerSettings& settings); ~ImageLayer() override; // TiledLayer Implementation. diff --git a/cc/layers/io_surface_layer.cc b/cc/layers/io_surface_layer.cc index 05d5fb9..0962a21 100644 --- a/cc/layers/io_surface_layer.cc +++ b/cc/layers/io_surface_layer.cc @@ -8,11 +8,14 @@ namespace cc { -scoped_refptr<IOSurfaceLayer> IOSurfaceLayer::Create() { - return make_scoped_refptr(new IOSurfaceLayer()); +scoped_refptr<IOSurfaceLayer> IOSurfaceLayer::Create( + const LayerSettings& settings) { + return make_scoped_refptr(new IOSurfaceLayer(settings)); } -IOSurfaceLayer::IOSurfaceLayer() : Layer(), io_surface_id_(0) {} +IOSurfaceLayer::IOSurfaceLayer(const LayerSettings& settings) + : Layer(settings), io_surface_id_(0) { +} IOSurfaceLayer::~IOSurfaceLayer() {} diff --git a/cc/layers/io_surface_layer.h b/cc/layers/io_surface_layer.h index 90bcf3e..9c5dd8f 100644 --- a/cc/layers/io_surface_layer.h +++ b/cc/layers/io_surface_layer.h @@ -12,7 +12,7 @@ namespace cc { class CC_EXPORT IOSurfaceLayer : public Layer { public: - static scoped_refptr<IOSurfaceLayer> Create(); + static scoped_refptr<IOSurfaceLayer> Create(const LayerSettings& settings); void SetIOSurfaceProperties(uint32_t io_surface_id, const gfx::Size& size); @@ -23,7 +23,7 @@ class CC_EXPORT IOSurfaceLayer : public Layer { protected: bool HasDrawableContent() const override; - IOSurfaceLayer(); + explicit IOSurfaceLayer(const LayerSettings& settings); private: ~IOSurfaceLayer() override; diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 60145c9..361e296 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -34,11 +34,11 @@ namespace cc { base::StaticAtomicSequenceNumber g_next_layer_id; -scoped_refptr<Layer> Layer::Create() { - return make_scoped_refptr(new Layer()); +scoped_refptr<Layer> Layer::Create(const LayerSettings& settings) { + return make_scoped_refptr(new Layer(settings)); } -Layer::Layer() +Layer::Layer(const LayerSettings& settings) : needs_push_properties_(false), num_dependents_need_push_properties_(false), stacking_order_changed_(false), diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 9c7138e..b0a1d66 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -58,6 +58,7 @@ class CopyOutputRequest; class LayerAnimationEventObserver; class LayerClient; class LayerImpl; +class LayerSettings; class LayerTreeHost; class LayerTreeHostCommon; class LayerTreeImpl; @@ -84,7 +85,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, INVALID_ID = -1, }; - static scoped_refptr<Layer> Create(); + static scoped_refptr<Layer> Create(const LayerSettings& settings); int id() const { return layer_id_; } @@ -564,7 +565,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, friend class TreeSynchronizer; ~Layer() override; - Layer(); + explicit Layer(const LayerSettings& settings); // These SetNeeds functions are in order of severity of update: // diff --git a/cc/layers/layer_iterator_unittest.cc b/cc/layers/layer_iterator_unittest.cc index cdc1473..b53daee 100644 --- a/cc/layers/layer_iterator_unittest.cc +++ b/cc/layers/layer_iterator_unittest.cc @@ -23,8 +23,8 @@ namespace { class TestLayer : public Layer { public: - static scoped_refptr<TestLayer> Create() { - return make_scoped_refptr(new TestLayer()); + static scoped_refptr<TestLayer> Create(const LayerSettings& settings) { + return make_scoped_refptr(new TestLayer(settings)); } int count_representing_target_surface_; @@ -35,7 +35,8 @@ class TestLayer : public Layer { void set_draws_content(bool draws_content) { draws_content_ = draws_content; } private: - TestLayer() : Layer(), draws_content_(true) { + explicit TestLayer(const LayerSettings& settings) + : Layer(settings), draws_content_(true) { SetBounds(gfx::Size(100, 100)); SetPosition(gfx::Point()); } @@ -100,11 +101,12 @@ TEST(LayerIteratorTest, EmptyTree) { } TEST(LayerIteratorTest, SimpleTree) { - scoped_refptr<TestLayer> root_layer = TestLayer::Create(); - scoped_refptr<TestLayer> first = TestLayer::Create(); - scoped_refptr<TestLayer> second = TestLayer::Create(); - scoped_refptr<TestLayer> third = TestLayer::Create(); - scoped_refptr<TestLayer> fourth = TestLayer::Create(); + LayerSettings settings; + scoped_refptr<TestLayer> root_layer = TestLayer::Create(settings); + scoped_refptr<TestLayer> first = TestLayer::Create(settings); + scoped_refptr<TestLayer> second = TestLayer::Create(settings); + scoped_refptr<TestLayer> third = TestLayer::Create(settings); + scoped_refptr<TestLayer> fourth = TestLayer::Create(settings); root_layer->AddChild(first); root_layer->AddChild(second); @@ -129,15 +131,16 @@ TEST(LayerIteratorTest, SimpleTree) { } TEST(LayerIteratorTest, ComplexTree) { - scoped_refptr<TestLayer> root_layer = TestLayer::Create(); - scoped_refptr<TestLayer> root1 = TestLayer::Create(); - scoped_refptr<TestLayer> root2 = TestLayer::Create(); - scoped_refptr<TestLayer> root3 = TestLayer::Create(); - scoped_refptr<TestLayer> root21 = TestLayer::Create(); - scoped_refptr<TestLayer> root22 = TestLayer::Create(); - scoped_refptr<TestLayer> root23 = TestLayer::Create(); - scoped_refptr<TestLayer> root221 = TestLayer::Create(); - scoped_refptr<TestLayer> root231 = TestLayer::Create(); + LayerSettings settings; + scoped_refptr<TestLayer> root_layer = TestLayer::Create(settings); + scoped_refptr<TestLayer> root1 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root2 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root3 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root21 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root22 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root23 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root221 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root231 = TestLayer::Create(settings); root_layer->AddChild(root1); root_layer->AddChild(root2); @@ -170,15 +173,16 @@ TEST(LayerIteratorTest, ComplexTree) { } TEST(LayerIteratorTest, ComplexTreeMultiSurface) { - scoped_refptr<TestLayer> root_layer = TestLayer::Create(); - scoped_refptr<TestLayer> root1 = TestLayer::Create(); - scoped_refptr<TestLayer> root2 = TestLayer::Create(); - scoped_refptr<TestLayer> root3 = TestLayer::Create(); - scoped_refptr<TestLayer> root21 = TestLayer::Create(); - scoped_refptr<TestLayer> root22 = TestLayer::Create(); - scoped_refptr<TestLayer> root23 = TestLayer::Create(); - scoped_refptr<TestLayer> root221 = TestLayer::Create(); - scoped_refptr<TestLayer> root231 = TestLayer::Create(); + LayerSettings settings; + scoped_refptr<TestLayer> root_layer = TestLayer::Create(settings); + scoped_refptr<TestLayer> root1 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root2 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root3 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root21 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root22 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root23 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root221 = TestLayer::Create(settings); + scoped_refptr<TestLayer> root231 = TestLayer::Create(settings); root_layer->AddChild(root1); root_layer->AddChild(root2); diff --git a/cc/layers/layer_perftest.cc b/cc/layers/layer_perftest.cc index c7cac01..fbe00f3 100644 --- a/cc/layers/layer_perftest.cc +++ b/cc/layers/layer_perftest.cc @@ -60,7 +60,7 @@ class LayerPerfTest : public testing::Test { }; TEST_F(LayerPerfTest, PushPropertiesTo) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(LayerSettings()); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 6b4d36b..16893a1 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc @@ -115,13 +115,13 @@ class LayerTest : public testing::Test { } void CreateSimpleTestTree() { - parent_ = Layer::Create(); - child1_ = Layer::Create(); - child2_ = Layer::Create(); - child3_ = Layer::Create(); - grand_child1_ = Layer::Create(); - grand_child2_ = Layer::Create(); - grand_child3_ = Layer::Create(); + 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_); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); layer_tree_host_->SetRootLayer(parent_); @@ -152,10 +152,12 @@ class LayerTest : public testing::Test { scoped_refptr<Layer> grand_child1_; scoped_refptr<Layer> grand_child2_; scoped_refptr<Layer> grand_child3_; + + LayerSettings layer_settings_; }; TEST_F(LayerTest, BasicCreateAndDestroy) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); @@ -167,8 +169,8 @@ TEST_F(LayerTest, BasicCreateAndDestroy) { } TEST_F(LayerTest, AddAndRemoveChild) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); // Upon creation, layers should not have children or parent. ASSERT_EQ(0U, parent->children().size()); @@ -188,8 +190,8 @@ TEST_F(LayerTest, AddAndRemoveChild) { TEST_F(LayerTest, AddSameChildTwice) { EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); layer_tree_host_->SetRootLayer(parent); @@ -205,11 +207,11 @@ TEST_F(LayerTest, AddSameChildTwice) { } TEST_F(LayerTest, InsertChild) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); - scoped_refptr<Layer> child3 = Layer::Create(); - scoped_refptr<Layer> child4 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child3 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -250,9 +252,9 @@ TEST_F(LayerTest, InsertChild) { } TEST_F(LayerTest, InsertChildPastEndOfList) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); ASSERT_EQ(0U, parent->children().size()); @@ -271,9 +273,9 @@ TEST_F(LayerTest, InsertChildPastEndOfList) { } TEST_F(LayerTest, InsertSameChildTwice) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -300,7 +302,7 @@ TEST_F(LayerTest, InsertSameChildTwice) { TEST_F(LayerTest, ReplaceChildWithNewChild) { CreateSimpleTestTree(); - scoped_refptr<Layer> child4 = Layer::Create(); + scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); EXPECT_FALSE(child4->parent()); @@ -325,8 +327,8 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) { CreateSimpleTestTree(); // create another simple tree with test_layer and child4. - scoped_refptr<Layer> test_layer = Layer::Create(); - scoped_refptr<Layer> child4 = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); + scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); test_layer->AddChild(child4); ASSERT_EQ(1U, test_layer->children().size()); EXPECT_EQ(child4, test_layer->children()[0]); @@ -348,9 +350,9 @@ TEST_F(LayerTest, ReplaceChildWithNewChildThatHasOtherParent) { } TEST_F(LayerTest, DeleteRemovedScrollParent) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -377,9 +379,9 @@ TEST_F(LayerTest, DeleteRemovedScrollParent) { } TEST_F(LayerTest, DeleteRemovedScrollChild) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); @@ -429,11 +431,11 @@ TEST_F(LayerTest, RemoveAllChildren) { } TEST_F(LayerTest, SetChildren) { - scoped_refptr<Layer> old_parent = Layer::Create(); - scoped_refptr<Layer> new_parent = Layer::Create(); + scoped_refptr<Layer> old_parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> new_parent = Layer::Create(layer_settings_); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings_); LayerList new_children; new_children.push_back(child1); @@ -460,17 +462,17 @@ TEST_F(LayerTest, SetChildren) { } TEST_F(LayerTest, HasAncestor) { - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); EXPECT_FALSE(parent->HasAncestor(parent.get())); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); parent->AddChild(child); EXPECT_FALSE(child->HasAncestor(child.get())); EXPECT_TRUE(child->HasAncestor(parent.get())); EXPECT_FALSE(parent->HasAncestor(child.get())); - scoped_refptr<Layer> child_child = Layer::Create(); + scoped_refptr<Layer> child_child = Layer::Create(layer_settings_); child->AddChild(child_child); EXPECT_FALSE(child_child->HasAncestor(child_child.get())); @@ -486,7 +488,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<Layer> child4 = Layer::Create(); + scoped_refptr<Layer> child4 = Layer::Create(layer_settings_); EXPECT_EQ(parent_.get(), parent_->RootLayer()); EXPECT_EQ(parent_.get(), child1_->RootLayer()); @@ -541,7 +543,7 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { // 2. indirectly calls SetNeedsUpdate, exactly once for each call to // SetNeedsDisplay. - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); EXPECT_SET_NEEDS_FULL_TREE_SYNC( 1, layer_tree_host_->SetRootLayer(test_layer)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); @@ -594,13 +596,13 @@ TEST_F(LayerTest, CheckSetNeedsDisplayCausesCorrectBehavior) { } TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); EXPECT_SET_NEEDS_FULL_TREE_SYNC( 1, layer_tree_host_->SetRootLayer(test_layer)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetIsDrawable(true)); - scoped_refptr<Layer> dummy_layer1 = Layer::Create(); - scoped_refptr<Layer> dummy_layer2 = Layer::Create(); + scoped_refptr<Layer> dummy_layer1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> dummy_layer2 = Layer::Create(layer_settings_); // sanity check of initial test condition EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); @@ -653,7 +655,7 @@ TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) { } TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -682,7 +684,7 @@ TEST_F(LayerTest, PushPropertiesAccumulatesUpdateRect) { } TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -701,7 +703,7 @@ TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForTransform) { } TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForOpacity) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -719,7 +721,7 @@ TEST_F(LayerTest, PushPropertiesCausesLayerPropertyChangedForOpacity) { TEST_F(LayerTest, PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyTransformAnim) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -761,7 +763,7 @@ TEST_F(LayerTest, TEST_F(LayerTest, PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyOpacityAnim) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -802,7 +804,7 @@ TEST_F(LayerTest, TEST_F(LayerTest, PushPropsDoesntCauseLayerPropertyChangedDuringImplOnlyFilterAnim) { - scoped_refptr<Layer> test_layer = Layer::Create(); + scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); @@ -839,14 +841,15 @@ TEST_F(LayerTest, } TEST_F(LayerTest, MaskAndReplicaHasParent) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> mask = Layer::Create(); - scoped_refptr<Layer> replica = Layer::Create(); - scoped_refptr<Layer> replica_mask = Layer::Create(); - scoped_refptr<Layer> mask_replacement = Layer::Create(); - scoped_refptr<Layer> replica_replacement = Layer::Create(); - scoped_refptr<Layer> replica_mask_replacement = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask_replacement = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_replacement = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_mask_replacement = + Layer::Create(layer_settings_); parent->AddChild(child); child->SetMaskLayer(mask.get()); @@ -874,7 +877,7 @@ TEST_F(LayerTest, MaskAndReplicaHasParent) { } TEST_F(LayerTest, CheckTranformIsInvertible) { - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); @@ -905,7 +908,7 @@ TEST_F(LayerTest, CheckTranformIsInvertible) { } TEST_F(LayerTest, TranformIsInvertibleAnimation) { - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings_); scoped_ptr<LayerImpl> impl_layer = LayerImpl::Create(host_impl_.active_tree(), 1); EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(1); @@ -974,12 +977,18 @@ void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { AssertLayerTreeHostMatchesForSubtree(layer->replica_layer(), host); } -TEST(LayerLayerTreeHostTest, EnteringTree) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> mask = Layer::Create(); - scoped_refptr<Layer> replica = Layer::Create(); - scoped_refptr<Layer> replica_mask = Layer::Create(); +class LayerLayerTreeHostTest : public testing::Test { + public: + protected: + LayerSettings layer_settings_; +}; + +TEST_F(LayerLayerTreeHostTest, EnteringTree) { + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); // Set up a detached tree of layers. The host pointer should be nil for these // layers. @@ -1005,8 +1014,8 @@ TEST(LayerLayerTreeHostTest, EnteringTree) { AssertLayerTreeHostMatchesForSubtree(parent.get(), nullptr); } -TEST(LayerLayerTreeHostTest, AddingLayerSubtree) { - scoped_refptr<Layer> parent = Layer::Create(); +TEST_F(LayerLayerTreeHostTest, AddingLayerSubtree) { + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); LayerTreeHostFactory factory; scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); @@ -1016,16 +1025,16 @@ TEST(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<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings_); child->AddChild(grand_child); // Masks, replicas, and replica masks should pick up the new host too. - scoped_refptr<Layer> child_mask = Layer::Create(); + scoped_refptr<Layer> child_mask = Layer::Create(layer_settings_); child->SetMaskLayer(child_mask.get()); - scoped_refptr<Layer> child_replica = Layer::Create(); + scoped_refptr<Layer> child_replica = Layer::Create(layer_settings_); child->SetReplicaLayer(child_replica.get()); - scoped_refptr<Layer> child_replica_mask = Layer::Create(); + scoped_refptr<Layer> child_replica_mask = Layer::Create(layer_settings_); child_replica->SetMaskLayer(child_replica_mask.get()); parent->AddChild(child); @@ -1034,12 +1043,12 @@ TEST(LayerLayerTreeHostTest, AddingLayerSubtree) { layer_tree_host->SetRootLayer(nullptr); } -TEST(LayerLayerTreeHostTest, ChangeHost) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> mask = Layer::Create(); - scoped_refptr<Layer> replica = Layer::Create(); - scoped_refptr<Layer> replica_mask = Layer::Create(); +TEST_F(LayerLayerTreeHostTest, ChangeHost) { + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_mask = Layer::Create(layer_settings_); // Same setup as the previous test. parent->AddChild(child); @@ -1065,12 +1074,12 @@ TEST(LayerLayerTreeHostTest, ChangeHost) { second_layer_tree_host->SetRootLayer(nullptr); } -TEST(LayerLayerTreeHostTest, ChangeHostInSubtree) { - scoped_refptr<Layer> first_parent = Layer::Create(); - scoped_refptr<Layer> first_child = Layer::Create(); - scoped_refptr<Layer> second_parent = Layer::Create(); - scoped_refptr<Layer> second_child = Layer::Create(); - scoped_refptr<Layer> second_grand_child = Layer::Create(); +TEST_F(LayerLayerTreeHostTest, ChangeHostInSubtree) { + scoped_refptr<Layer> first_parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> first_child = Layer::Create(layer_settings_); + scoped_refptr<Layer> second_parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> second_child = Layer::Create(layer_settings_); + scoped_refptr<Layer> second_grand_child = Layer::Create(layer_settings_); // First put all children under the first parent and set the first host. first_parent->AddChild(first_child); @@ -1101,14 +1110,14 @@ TEST(LayerLayerTreeHostTest, ChangeHostInSubtree) { second_layer_tree_host->SetRootLayer(nullptr); } -TEST(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> mask = Layer::Create(); - scoped_refptr<Layer> replica = Layer::Create(); - scoped_refptr<Layer> mask_child = Layer::Create(); - scoped_refptr<Layer> replica_child = Layer::Create(); - scoped_refptr<Layer> mask_replacement = Layer::Create(); - scoped_refptr<Layer> replica_replacement = Layer::Create(); +TEST_F(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { + scoped_refptr<Layer> parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask_child = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_child = Layer::Create(layer_settings_); + scoped_refptr<Layer> mask_replacement = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_replacement = Layer::Create(layer_settings_); parent->SetMaskLayer(mask.get()); parent->SetReplicaLayer(replica.get()); @@ -1135,9 +1144,9 @@ TEST(LayerLayerTreeHostTest, ReplaceMaskAndReplicaLayer) { layer_tree_host->SetRootLayer(nullptr); } -TEST(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); +TEST_F(LayerLayerTreeHostTest, DestroyHostWithNonNullRootLayer) { + scoped_refptr<Layer> root = Layer::Create(layer_settings_); + scoped_refptr<Layer> child = Layer::Create(layer_settings_); root->AddChild(child); LayerTreeHostFactory factory; scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); @@ -1156,8 +1165,8 @@ static bool AddTestAnimation(Layer* layer) { return layer->AddAnimation(animation.Pass()); } -TEST(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { - scoped_refptr<Layer> layer = Layer::Create(); +TEST_F(LayerLayerTreeHostTest, ShouldNotAddAnimationWithoutAnimationRegistrar) { + scoped_refptr<Layer> layer = Layer::Create(layer_settings_); // Case 1: without a LayerTreeHost and without an AnimationRegistrar, the // animation should not be accepted. @@ -1185,7 +1194,7 @@ TEST_F(LayerTest, SafeOpaqueBackgroundColor) { LayerTreeHostFactory factory; scoped_ptr<LayerTreeHost> layer_tree_host = factory.Create(); - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings_); layer_tree_host->SetRootLayer(layer); for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { @@ -1214,8 +1223,9 @@ TEST_F(LayerTest, SafeOpaqueBackgroundColor) { class DrawsContentChangeLayer : public Layer { public: - static scoped_refptr<DrawsContentChangeLayer> Create() { - return make_scoped_refptr(new DrawsContentChangeLayer()); + static scoped_refptr<DrawsContentChangeLayer> Create( + const LayerSettings& settings) { + return make_scoped_refptr(new DrawsContentChangeLayer(settings)); } void SetLayerTreeHost(LayerTreeHost* host) override { @@ -1233,18 +1243,19 @@ class DrawsContentChangeLayer : public Layer { } private: - DrawsContentChangeLayer() : Layer(), fake_draws_content_(false) {} + explicit DrawsContentChangeLayer(const LayerSettings& settings) + : Layer(settings), fake_draws_content_(false) {} ~DrawsContentChangeLayer() override {} bool fake_draws_content_; }; TEST_F(LayerTest, DrawsContentChangedInSetLayerTreeHost) { - scoped_refptr<Layer> root_layer = Layer::Create(); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings_); scoped_refptr<DrawsContentChangeLayer> becomes_not_draws_content = - DrawsContentChangeLayer::Create(); + DrawsContentChangeLayer::Create(layer_settings_); scoped_refptr<DrawsContentChangeLayer> becomes_draws_content = - DrawsContentChangeLayer::Create(); + DrawsContentChangeLayer::Create(layer_settings_); root_layer->SetIsDrawable(true); becomes_not_draws_content->SetIsDrawable(true); becomes_not_draws_content->SetFakeDrawsContent(true); @@ -1263,7 +1274,7 @@ void ReceiveCopyOutputResult(int* result_count, } TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings_); int result_count = 0; // Create identical requests without the source being set, and expect the @@ -1281,7 +1292,7 @@ TEST_F(LayerTest, DedupesCopyOutputRequestsBySource) { layer = nullptr; EXPECT_EQ(2, result_count); - layer = Layer::Create(); + layer = Layer::Create(layer_settings_); result_count = 0; // Create identical requests, but this time the source is being set. Expect diff --git a/cc/layers/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc index ad8f04d..9062905 100644 --- a/cc/layers/nine_patch_layer.cc +++ b/cc/layers/nine_patch_layer.cc @@ -14,11 +14,14 @@ namespace cc { -scoped_refptr<NinePatchLayer> NinePatchLayer::Create() { - return make_scoped_refptr(new NinePatchLayer()); +scoped_refptr<NinePatchLayer> NinePatchLayer::Create( + const LayerSettings& settings) { + return make_scoped_refptr(new NinePatchLayer(settings)); } -NinePatchLayer::NinePatchLayer() : fill_center_(false) {} +NinePatchLayer::NinePatchLayer(const LayerSettings& settings) + : UIResourceLayer(settings), fill_center_(false) { +} NinePatchLayer::~NinePatchLayer() {} diff --git a/cc/layers/nine_patch_layer.h b/cc/layers/nine_patch_layer.h index 9054610..714a407 100644 --- a/cc/layers/nine_patch_layer.h +++ b/cc/layers/nine_patch_layer.h @@ -19,7 +19,7 @@ class ScopedUIResource; class CC_EXPORT NinePatchLayer : public UIResourceLayer { public: - static scoped_refptr<NinePatchLayer> Create(); + static scoped_refptr<NinePatchLayer> Create(const LayerSettings& settings); void PushPropertiesTo(LayerImpl* layer) override; @@ -40,7 +40,7 @@ class CC_EXPORT NinePatchLayer : public UIResourceLayer { void SetFillCenter(bool fill_center); private: - NinePatchLayer(); + explicit NinePatchLayer(const LayerSettings& settings); ~NinePatchLayer() override; scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc index 1783ba9..b9fab76 100644 --- a/cc/layers/nine_patch_layer_unittest.cc +++ b/cc/layers/nine_patch_layer_unittest.cc @@ -47,7 +47,8 @@ class NinePatchLayerTest : public testing::Test { }; TEST_F(NinePatchLayerTest, SetLayerProperties) { - scoped_refptr<NinePatchLayer> test_layer = NinePatchLayer::Create(); + scoped_refptr<NinePatchLayer> test_layer = + NinePatchLayer::Create(LayerSettings()); 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 d82ef98..100ada6 100644 --- a/cc/layers/painted_scrollbar_layer.cc +++ b/cc/layers/painted_scrollbar_layer.cc @@ -32,15 +32,18 @@ scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( } scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( + const LayerSettings& settings, scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id) { return make_scoped_refptr( - new PaintedScrollbarLayer(scrollbar.Pass(), scroll_layer_id)); + new PaintedScrollbarLayer(settings, scrollbar.Pass(), scroll_layer_id)); } -PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, +PaintedScrollbarLayer::PaintedScrollbarLayer(const LayerSettings& settings, + scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id) - : scrollbar_(scrollbar.Pass()), + : Layer(settings), + scrollbar_(scrollbar.Pass()), scroll_layer_id_(scroll_layer_id), clip_layer_id_(Layer::INVALID_ID), internal_contents_scale_(0.f), diff --git a/cc/layers/painted_scrollbar_layer.h b/cc/layers/painted_scrollbar_layer.h index ae2b125..dbc581e 100644 --- a/cc/layers/painted_scrollbar_layer.h +++ b/cc/layers/painted_scrollbar_layer.h @@ -22,6 +22,7 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; static scoped_refptr<PaintedScrollbarLayer> Create( + const LayerSettings& settings, scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id); @@ -47,7 +48,9 @@ class CC_EXPORT PaintedScrollbarLayer : public ScrollbarLayerInterface, } protected: - PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, int scroll_layer_id); + PaintedScrollbarLayer(const LayerSettings& settings, + scoped_ptr<Scrollbar> scrollbar, + int scroll_layer_id); ~PaintedScrollbarLayer() override; // For unit tests diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc index 345ee2b4..f9d13d72 100644 --- a/cc/layers/picture_image_layer.cc +++ b/cc/layers/picture_image_layer.cc @@ -12,11 +12,14 @@ namespace cc { -scoped_refptr<PictureImageLayer> PictureImageLayer::Create() { - return make_scoped_refptr(new PictureImageLayer()); +scoped_refptr<PictureImageLayer> PictureImageLayer::Create( + const LayerSettings& settings) { + return make_scoped_refptr(new PictureImageLayer(settings)); } -PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} +PictureImageLayer::PictureImageLayer(const LayerSettings& settings) + : PictureLayer(settings, this) { +} PictureImageLayer::~PictureImageLayer() { ClearClient(); diff --git a/cc/layers/picture_image_layer.h b/cc/layers/picture_image_layer.h index a12a1b9..0c1adb5 100644 --- a/cc/layers/picture_image_layer.h +++ b/cc/layers/picture_image_layer.h @@ -15,7 +15,7 @@ namespace cc { class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { public: - static scoped_refptr<PictureImageLayer> Create(); + static scoped_refptr<PictureImageLayer> Create(const LayerSettings& settings); void SetBitmap(const SkBitmap& image); @@ -37,7 +37,7 @@ class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { bool HasDrawableContent() const override; private: - PictureImageLayer(); + explicit PictureImageLayer(const LayerSettings& settings); ~PictureImageLayer() override; SkBitmap bitmap_; diff --git a/cc/layers/picture_image_layer_unittest.cc b/cc/layers/picture_image_layer_unittest.cc index 786e309..76f9cf5 100644 --- a/cc/layers/picture_image_layer_unittest.cc +++ b/cc/layers/picture_image_layer_unittest.cc @@ -6,6 +6,7 @@ #include "cc/playback/display_item.h" #include "cc/test/skia_common.h" +#include "cc/trees/layer_tree_settings.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -15,7 +16,8 @@ namespace cc { namespace { TEST(PictureImageLayerTest, PaintContentsToDisplayList) { - scoped_refptr<PictureImageLayer> layer = PictureImageLayer::Create(); + scoped_refptr<PictureImageLayer> layer = + PictureImageLayer::Create(LayerSettings()); gfx::Rect layer_rect(200, 200); SkBitmap image_bitmap; @@ -47,7 +49,8 @@ TEST(PictureImageLayerTest, PaintContentsToDisplayList) { } TEST(PictureImageLayerTest, PaintContentsToCachedDisplayList) { - scoped_refptr<PictureImageLayer> layer = PictureImageLayer::Create(); + scoped_refptr<PictureImageLayer> layer = + PictureImageLayer::Create(LayerSettings()); gfx::Rect layer_rect(200, 200); SkBitmap image_bitmap; diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index 9993632..eb037ad 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -16,21 +16,25 @@ namespace cc { -scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { - return make_scoped_refptr(new PictureLayer(client)); +scoped_refptr<PictureLayer> PictureLayer::Create(const LayerSettings& settings, + ContentLayerClient* client) { + return make_scoped_refptr(new PictureLayer(settings, client)); } -PictureLayer::PictureLayer(ContentLayerClient* client) - : client_(client), +PictureLayer::PictureLayer(const LayerSettings& settings, + ContentLayerClient* client) + : Layer(settings), + client_(client), instrumentation_object_tracker_(id()), update_source_frame_number_(-1), is_mask_(false), nearest_neighbor_(false) { } -PictureLayer::PictureLayer(ContentLayerClient* client, +PictureLayer::PictureLayer(const LayerSettings& settings, + ContentLayerClient* client, scoped_ptr<RecordingSource> source) - : PictureLayer(client) { + : PictureLayer(settings, client) { recording_source_ = source.Pass(); } diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h index 767de27..c602ea5 100644 --- a/cc/layers/picture_layer.h +++ b/cc/layers/picture_layer.h @@ -19,7 +19,8 @@ class ResourceUpdateQueue; class CC_EXPORT PictureLayer : public Layer { public: - static scoped_refptr<PictureLayer> Create(ContentLayerClient* client); + static scoped_refptr<PictureLayer> Create(const LayerSettings& settings, + ContentLayerClient* client); void ClearClient(); @@ -45,9 +46,11 @@ class CC_EXPORT PictureLayer : public Layer { } protected: - explicit PictureLayer(ContentLayerClient* client); + PictureLayer(const LayerSettings& settings, ContentLayerClient* client); // Allow tests to inject a recording source. - PictureLayer(ContentLayerClient* client, scoped_ptr<RecordingSource> source); + PictureLayer(const LayerSettings& settings, + ContentLayerClient* client, + scoped_ptr<RecordingSource> source); ~PictureLayer() override; bool HasDrawableContent() const override; diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 4fe28d9..c29510f 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -342,6 +342,7 @@ class PictureLayerImplTest : public testing::Test { FakePictureLayerImpl* pending_layer_; FakePictureLayerImpl* old_pending_layer_; FakePictureLayerImpl* active_layer_; + LayerSettings layer_settings_; private: DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); @@ -4613,7 +4614,8 @@ void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { gfx::Rect layer_rect(layer_bounds); FakeContentLayerClient client; - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(layer_settings_, &client); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); host->SetRootLayer(layer); @@ -4676,7 +4678,8 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { gfx::Rect layer_rect(layer_bounds); FakeContentLayerClient client; - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(layer_settings_, &client); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); host->SetRootLayer(layer); diff --git a/cc/layers/picture_layer_unittest.cc b/cc/layers/picture_layer_unittest.cc index 3707012..edbc621 100644 --- a/cc/layers/picture_layer_unittest.cc +++ b/cc/layers/picture_layer_unittest.cc @@ -36,7 +36,8 @@ class MockContentLayerClient : public ContentLayerClient { TEST(PictureLayerTest, NoTilesIfEmptyBounds) { MockContentLayerClient client; - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(LayerSettings(), &client); layer->SetBounds(gfx::Size(10, 10)); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); @@ -79,7 +80,8 @@ TEST(PictureLayerTest, NoTilesIfEmptyBounds) { TEST(PictureLayerTest, SuitableForGpuRasterization) { MockContentLayerClient client; - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(LayerSettings(), &client); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); host->SetRootLayer(layer); @@ -100,7 +102,8 @@ TEST(PictureLayerTest, UseTileGridSize) { settings.default_tile_grid_size = gfx::Size(123, 123); MockContentLayerClient client; - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(LayerSettings(), &client); FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client, settings); @@ -127,7 +130,8 @@ TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { new TestSharedBitmapManager()); MockContentLayerClient client; - scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client); + scoped_refptr<FakePictureLayer> layer = + FakePictureLayer::Create(LayerSettings(), &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 97d1c80..74882a1 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -35,24 +35,24 @@ namespace cc { namespace { -LayerImpl* LayerImplForScrollAreaAndScrollbar(FakeLayerTreeHost* host, +LayerImpl* LayerImplForScrollAreaAndScrollbar(const LayerSettings& settings, + FakeLayerTreeHost* host, scoped_ptr<Scrollbar> scrollbar, bool reverse_order, bool use_solid_color_scrollbar, int thumb_thickness, int track_start) { - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(settings); + scoped_refptr<Layer> child1 = Layer::Create(settings); scoped_refptr<Layer> child2; if (use_solid_color_scrollbar) { const bool kIsLeftSideVerticalScrollbar = false; - child2 = SolidColorScrollbarLayer::Create(scrollbar->Orientation(), - thumb_thickness, - track_start, - kIsLeftSideVerticalScrollbar, - child1->id()); + child2 = SolidColorScrollbarLayer::Create( + settings, scrollbar->Orientation(), thumb_thickness, track_start, + kIsLeftSideVerticalScrollbar, child1->id()); } else { - child2 = PaintedScrollbarLayer::Create(scrollbar.Pass(), child1->id()); + child2 = + PaintedScrollbarLayer::Create(settings, scrollbar.Pass(), child1->id()); } child2->ToScrollbarLayer()->SetClipLayer(layer_tree_root->id()); layer_tree_root->AddChild(child1); @@ -134,16 +134,20 @@ class ScrollbarLayerTest : public testing::Test { EXPECT_FALSE(layer_tree_host_->output_surface_lost()); } + const LayerSettings& layer_settings() { return layer_settings_; } + protected: FakeLayerTreeHostClient fake_client_; LayerTreeSettings layer_tree_settings_; + LayerSettings layer_settings_; scoped_ptr<FakeResourceTrackingLayerTreeHost> layer_tree_host_; }; TEST_F(ScrollbarLayerTest, ResolveScrollLayerPointer) { scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0); + layer_settings(), layer_tree_host_.get(), scrollbar.Pass(), false, false, + 0, 0); LayerImpl* cc_child1 = layer_impl_tree_root->children()[0]; PaintedScrollbarLayerImpl* cc_child2 = @@ -157,7 +161,8 @@ TEST_F(ScrollbarLayerTest, ResolveScrollLayerPointer) { TEST_F(ScrollbarLayerTest, ResolveScrollLayerPointer_ReverseOrder) { scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_tree_host_.get(), scrollbar.Pass(), true, false, 0, 0); + layer_settings(), layer_tree_host_.get(), scrollbar.Pass(), true, false, + 0, 0); PaintedScrollbarLayerImpl* cc_child1 = static_cast<PaintedScrollbarLayerImpl*>( @@ -172,7 +177,8 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { // Create and attach a non-overlay scrollbar. scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0); + layer_settings(), layer_tree_host_.get(), scrollbar.Pass(), false, false, + 0, 0); PaintedScrollbarLayerImpl* scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( layer_impl_tree_root->children()[1]); @@ -189,7 +195,8 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { scrollbar.reset(new FakeScrollbar(false, false, true)); layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0); + layer_settings(), layer_tree_host_.get(), scrollbar.Pass(), false, false, + 0, 0); scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( layer_impl_tree_root->children()[1]); @@ -203,11 +210,11 @@ TEST_F(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) { TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> scroll_layer = Layer::Create(); - scoped_refptr<Layer> content_layer = Layer::Create(); - scoped_refptr<Layer> scrollbar_layer = - PaintedScrollbarLayer::Create(scrollbar.Pass(), layer_tree_root->id()); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> scrollbar_layer = PaintedScrollbarLayer::Create( + layer_settings(), scrollbar.Pass(), layer_tree_root->id()); // Choose bounds to give max_scroll_offset = (30, 50). layer_tree_root->SetBounds(gfx::Size(70, 150)); @@ -272,11 +279,12 @@ TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { } while (false) TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) { - scoped_refptr<Layer> root_clip_layer = Layer::Create(); - scoped_refptr<Layer> root_layer = Layer::Create(); - scoped_refptr<Layer> content_layer = Layer::Create(); + scoped_refptr<Layer> root_clip_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = - FakePaintedScrollbarLayer::Create(false, true, root_layer->id()); + FakePaintedScrollbarLayer::Create(layer_settings(), 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). @@ -313,11 +321,12 @@ TEST_F(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) { } TEST_F(ScrollbarLayerTest, ThumbRect) { - scoped_refptr<Layer> root_clip_layer = Layer::Create(); - scoped_refptr<Layer> root_layer = Layer::Create(); - scoped_refptr<Layer> content_layer = Layer::Create(); + scoped_refptr<Layer> root_clip_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = - FakePaintedScrollbarLayer::Create(false, true, root_layer->id()); + FakePaintedScrollbarLayer::Create(layer_settings(), 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). @@ -397,8 +406,8 @@ TEST_F(ScrollbarLayerTest, SolidColorDrawQuads) { scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( - layer_tree_host_.get(), scrollbar.Pass(), false, true, kThumbThickness, - kTrackStart); + layer_settings(), layer_tree_host_.get(), scrollbar.Pass(), false, true, + kThumbThickness, kTrackStart); ScrollbarLayerImplBase* scrollbar_layer_impl = static_cast<SolidColorScrollbarLayerImpl*>( layer_impl_tree_root->children()[1]); @@ -472,17 +481,15 @@ TEST_F(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true)); { - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> scroll_layer = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); scroll_layer->SetScrollClipLayerId(layer_tree_root->id()); - scoped_refptr<Layer> child1 = Layer::Create(); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings()); scoped_refptr<Layer> child2; const bool kIsLeftSideVerticalScrollbar = false; - child2 = SolidColorScrollbarLayer::Create(scrollbar->Orientation(), - kThumbThickness, - kTrackStart, - kIsLeftSideVerticalScrollbar, - child1->id()); + child2 = SolidColorScrollbarLayer::Create( + layer_settings(), scrollbar->Orientation(), kThumbThickness, + kTrackStart, kIsLeftSideVerticalScrollbar, child1->id()); child2->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id()); child2->ToScrollbarLayer()->SetClipLayer(layer_tree_root->id()); scroll_layer->AddChild(child1); @@ -631,12 +638,12 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest { void SetScrollbarBounds(const gfx::Size& bounds) { bounds_ = bounds; } void BeginTest() override { - scroll_layer_ = Layer::Create(); + scroll_layer_ = Layer::Create(layer_settings()); layer_tree_host()->root_layer()->AddChild(scroll_layer_); scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); - scrollbar_layer_ = - PaintedScrollbarLayer::Create(scrollbar.Pass(), scroll_layer_->id()); + scrollbar_layer_ = PaintedScrollbarLayer::Create( + layer_settings(), scrollbar.Pass(), scroll_layer_->id()); scrollbar_layer_->SetScrollLayer(scroll_layer_->id()); scrollbar_layer_->SetLayerTreeHost(layer_tree_host()); scrollbar_layer_->SetBounds(bounds_); @@ -695,22 +702,19 @@ class ScrollbarLayerTestResourceCreationAndRelease : public ScrollbarLayerTest { int expected_deleted, bool use_solid_color_scrollbar) { scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, false)); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> content_layer = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); scoped_refptr<Layer> scrollbar_layer; if (use_solid_color_scrollbar) { const int kThumbThickness = 3; const int kTrackStart = 0; const bool kIsLeftSideVerticalScrollbar = false; - scrollbar_layer = - SolidColorScrollbarLayer::Create(scrollbar->Orientation(), - kThumbThickness, - kTrackStart, - kIsLeftSideVerticalScrollbar, - layer_tree_root->id()); + scrollbar_layer = SolidColorScrollbarLayer::Create( + layer_settings(), scrollbar->Orientation(), kThumbThickness, + kTrackStart, kIsLeftSideVerticalScrollbar, layer_tree_root->id()); } else { - scrollbar_layer = PaintedScrollbarLayer::Create(scrollbar.Pass(), - layer_tree_root->id()); + scrollbar_layer = PaintedScrollbarLayer::Create( + layer_settings(), scrollbar.Pass(), layer_tree_root->id()); } layer_tree_root->AddChild(content_layer); layer_tree_root->AddChild(scrollbar_layer); @@ -773,10 +777,11 @@ TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TEST_F(ScrollbarLayerTestResourceCreationAndRelease, TestResourceUpdate) { gfx::Point scrollbar_location(0, 185); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> content_layer = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = - FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id()); + FakePaintedScrollbarLayer::Create(layer_settings(), false, true, + layer_tree_root->id()); layer_tree_root->AddChild(content_layer); layer_tree_root->AddChild(scrollbar_layer); @@ -910,10 +915,11 @@ class ScaledScrollbarLayerTestResourceCreation : public ScrollbarLayerTest { public: void TestResourceUpload(const float test_scale) { gfx::Point scrollbar_location(0, 185); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> content_layer = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = - FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id()); + FakePaintedScrollbarLayer::Create(layer_settings(), false, true, + layer_tree_root->id()); layer_tree_root->AddChild(content_layer); layer_tree_root->AddChild(scrollbar_layer); @@ -986,11 +992,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> layer_tree_root = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = - FakePaintedScrollbarLayer::Create(paint_during_update, - has_thumb, - layer_tree_root->id()); + FakePaintedScrollbarLayer::Create(layer_settings(), 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 25e0ab8..2fbaca1 100644 --- a/cc/layers/solid_color_layer.cc +++ b/cc/layers/solid_color_layer.cc @@ -13,12 +13,14 @@ scoped_ptr<LayerImpl> SolidColorLayer::CreateLayerImpl( return SolidColorLayerImpl::Create(tree_impl, id()); } -scoped_refptr<SolidColorLayer> SolidColorLayer::Create() { - return make_scoped_refptr(new SolidColorLayer()); +scoped_refptr<SolidColorLayer> SolidColorLayer::Create( + const LayerSettings& settings) { + return make_scoped_refptr(new SolidColorLayer(settings)); } -SolidColorLayer::SolidColorLayer() - : Layer() {} +SolidColorLayer::SolidColorLayer(const LayerSettings& settings) + : Layer(settings) { +} SolidColorLayer::~SolidColorLayer() {} diff --git a/cc/layers/solid_color_layer.h b/cc/layers/solid_color_layer.h index 8dc9860..b544f66 100644 --- a/cc/layers/solid_color_layer.h +++ b/cc/layers/solid_color_layer.h @@ -15,14 +15,14 @@ namespace cc { // SetBackgroundColor() on the base class. class CC_EXPORT SolidColorLayer : public Layer { public: - static scoped_refptr<SolidColorLayer> Create(); + static scoped_refptr<SolidColorLayer> Create(const LayerSettings& settings); scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; void SetBackgroundColor(SkColor color) override; protected: - SolidColorLayer(); + explicit SolidColorLayer(const LayerSettings& settings); private: ~SolidColorLayer() override; diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc index f35b82a..5035ec7 100644 --- a/cc/layers/solid_color_layer_impl_unittest.cc +++ b/cc/layers/solid_color_layer_impl_unittest.cc @@ -131,11 +131,14 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { gfx::Size layer_size = gfx::Size(100, 100); gfx::Rect visible_content_rect = gfx::Rect(layer_size); - scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); + LayerSettings layer_settings; + + scoped_refptr<SolidColorLayer> layer = + SolidColorLayer::Create(layer_settings); layer->SetBounds(layer_size); layer->SetForceRenderSurface(true); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings); 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 b2c1ed4..4ed55ca 100644 --- a/cc/layers/solid_color_scrollbar_layer.cc +++ b/cc/layers/solid_color_scrollbar_layer.cc @@ -23,31 +23,32 @@ scoped_ptr<LayerImpl> SolidColorScrollbarLayer::CreateLayerImpl( } scoped_refptr<SolidColorScrollbarLayer> 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(orientation, - thumb_thickness, - track_start, - is_left_side_vertical_scrollbar, - scroll_layer_id)); + return make_scoped_refptr(new SolidColorScrollbarLayer( + settings, 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) - : scroll_layer_id_(Layer::INVALID_ID), + : Layer(settings), + scroll_layer_id_(Layer::INVALID_ID), clip_layer_id_(scroll_layer_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 fc6306e..6097014 100644 --- a/cc/layers/solid_color_scrollbar_layer.h +++ b/cc/layers/solid_color_scrollbar_layer.h @@ -17,6 +17,7 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; static scoped_refptr<SolidColorScrollbarLayer> Create( + const LayerSettings& settings, ScrollbarOrientation orientation, int thumb_thickness, int track_start, @@ -40,7 +41,8 @@ class CC_EXPORT SolidColorScrollbarLayer : public ScrollbarLayerInterface, ScrollbarOrientation orientation() const override; protected: - SolidColorScrollbarLayer(ScrollbarOrientation orientation, + SolidColorScrollbarLayer(const LayerSettings& settings, + 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 67a2632..dc88810 100644 --- a/cc/layers/surface_layer.cc +++ b/cc/layers/surface_layer.cc @@ -36,15 +36,17 @@ class SatisfySwapPromise : public SwapPromise { }; scoped_refptr<SurfaceLayer> SurfaceLayer::Create( + const LayerSettings& settings, const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback) { return make_scoped_refptr( - new SurfaceLayer(satisfy_callback, require_callback)); + new SurfaceLayer(settings, satisfy_callback, require_callback)); } -SurfaceLayer::SurfaceLayer(const SatisfyCallback& satisfy_callback, +SurfaceLayer::SurfaceLayer(const LayerSettings& settings, + const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback) - : Layer(), + : Layer(settings), surface_scale_(1.f), satisfy_callback_(satisfy_callback), require_callback_(require_callback) { diff --git a/cc/layers/surface_layer.h b/cc/layers/surface_layer.h index 381369f..d30d308 100644 --- a/cc/layers/surface_layer.h +++ b/cc/layers/surface_layer.h @@ -27,6 +27,7 @@ class CC_EXPORT SurfaceLayer : public Layer { using RequireCallback = base::Callback<void(SurfaceId, SurfaceSequence)>; static scoped_refptr<SurfaceLayer> Create( + const LayerSettings& settings, const SatisfyCallback& satisfy_callback, const RequireCallback& require_callback); @@ -42,7 +43,8 @@ class CC_EXPORT SurfaceLayer : public Layer { gfx::Size* content_bounds) override; protected: - SurfaceLayer(const SatisfyCallback& satisfy_callback, + SurfaceLayer(const LayerSettings& settings, + 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 6661a1a..5b656a5 100644 --- a/cc/layers/surface_layer_unittest.cc +++ b/cc/layers/surface_layer_unittest.cc @@ -46,6 +46,7 @@ class SurfaceLayerTest : public testing::Test { scoped_ptr<FakeLayerTreeHost> layer_tree_host_; FakeLayerTreeHostClient fake_client_; TestSharedBitmapManager shared_bitmap_manager_; + LayerSettings layer_settings_; }; void SatisfyCallback(SurfaceSequence* out, SurfaceSequence in) { @@ -68,7 +69,7 @@ TEST_F(SurfaceLayerTest, MultipleFramesOneSurface) { SurfaceId required_id; std::set<SurfaceSequence> required_seq; scoped_refptr<SurfaceLayer> layer(SurfaceLayer::Create( - base::Bind(&SatisfyCallback, &blank_change), + layer_settings_, 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); @@ -77,7 +78,7 @@ TEST_F(SurfaceLayerTest, MultipleFramesOneSurface) { scoped_ptr<FakeLayerTreeHost> layer_tree_host2 = FakeLayerTreeHost::Create(&fake_client_); scoped_refptr<SurfaceLayer> layer2(SurfaceLayer::Create( - base::Bind(&SatisfyCallback, &blank_change), + layer_settings_, 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); @@ -129,7 +130,7 @@ TEST_F(SurfaceLayerTest, ScaleSurface) { SurfaceId required_id; std::set<SurfaceSequence> required_seq; scoped_refptr<SurfaceLayer> layer(SurfaceLayer::Create( - base::Bind(&SatisfyCallback, &blank_change), + layer_settings_, base::Bind(&SatisfyCallback, &blank_change), base::Bind(&RequireCallback, &required_id, &required_seq))); gfx::Size surface_size(10, 15); layer->SetSurfaceId(SurfaceId(1), 2.f, surface_size); @@ -154,7 +155,7 @@ class SurfaceLayerSwapPromise : public LayerTreeTest { void BeginTest() override { layer_tree_host()->set_surface_id_namespace(1); layer_ = SurfaceLayer::Create( - base::Bind(&SatisfyCallback, &satisfied_sequence_), + layer_settings(), base::Bind(&SatisfyCallback, &satisfied_sequence_), base::Bind(&RequireCallback, &required_id_, &required_set_)); layer_->SetSurfaceId(SurfaceId(1), 1.f, gfx::Size(1, 1)); @@ -185,7 +186,7 @@ class SurfaceLayerSwapPromise : public LayerTreeTest { switch (commit_count_) { case 1: // Remove SurfaceLayer from tree to cause SwapPromise to be created. - blank_layer_ = SolidColorLayer::Create(); + blank_layer_ = SolidColorLayer::Create(layer_settings()); blank_layer_->SetIsDrawable(true); blank_layer_->SetBounds(gfx::Size(10, 10)); layer_tree_host()->SetRootLayer(blank_layer_); diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index cf1149b..87c2c49 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc @@ -19,12 +19,14 @@ namespace cc { scoped_refptr<TextureLayer> TextureLayer::CreateForMailbox( + const LayerSettings& settings, TextureLayerClient* client) { - return scoped_refptr<TextureLayer>(new TextureLayer(client)); + return scoped_refptr<TextureLayer>(new TextureLayer(settings, client)); } -TextureLayer::TextureLayer(TextureLayerClient* client) - : Layer(), +TextureLayer::TextureLayer(const LayerSettings& settings, + TextureLayerClient* client) + : Layer(settings), client_(client), flipped_(true), nearest_neighbor_(false), diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index 00c9e74..c4b1efa 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h @@ -86,6 +86,7 @@ class CC_EXPORT TextureLayer : public Layer { // Used when mailbox names are specified instead of texture IDs. static scoped_refptr<TextureLayer> CreateForMailbox( + const LayerSettings& settings, TextureLayerClient* client); // Resets the client, which also resets the texture. @@ -147,7 +148,7 @@ class CC_EXPORT TextureLayer : public Layer { SimpleEnclosedRegion VisibleContentOpaqueRegion() const override; protected: - explicit TextureLayer(TextureLayerClient* client); + TextureLayer(const LayerSettings& settings, 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 4a1e76d..c3c6fd5 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -211,11 +211,12 @@ class TextureLayerTest : public testing::Test { TestTaskGraphRunner task_graph_runner_; FakeLayerTreeHostImpl host_impl_; CommonMailboxObjects test_data_; + LayerSettings layer_settings_; }; TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); // Test properties that should call SetNeedsCommit. All properties need to @@ -235,7 +236,8 @@ TEST_F(TextureLayerTest, VisibleContentOpaqueRegion) { const gfx::Rect layer_rect(layer_bounds); const Region layer_region(layer_rect); - scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(nullptr); + scoped_refptr<TextureLayer> layer = + TextureLayer::CreateForMailbox(layer_settings_, nullptr); layer->SetBounds(layer_bounds); layer->draw_properties().visible_content_rect = layer_rect; layer->SetBlendBackgroundColor(true); @@ -259,8 +261,8 @@ TEST_F(TextureLayerTest, VisibleContentOpaqueRegion) { TEST_F(TextureLayerTest, RateLimiter) { FakeTextureLayerClient client; - scoped_refptr<TextureLayer> test_layer = TextureLayer::CreateForMailbox( - &client); + scoped_refptr<TextureLayer> test_layer = + TextureLayer::CreateForMailbox(layer_settings_, &client); test_layer->SetIsDrawable(true); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); layer_tree_host_->SetRootLayer(test_layer); @@ -288,8 +290,7 @@ TEST_F(TextureLayerTest, RateLimiter) { Mock::VerifyAndClearExpectations(layer_tree_host_.get()); // Reset to a layer with a client, that started the rate limiter. - test_layer = TextureLayer::CreateForMailbox( - &client); + test_layer = TextureLayer::CreateForMailbox(layer_settings_, &client); test_layer->SetIsDrawable(true); test_layer->SetRateLimitContext(true); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); @@ -329,7 +330,7 @@ class TextureLayerWithMailboxTest : public TextureLayerTest { TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); ASSERT_TRUE(test_layer.get()); EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); @@ -387,7 +388,7 @@ TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { TEST_F(TextureLayerTest, SetTextureMailboxWithoutReleaseCallback) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); ASSERT_TRUE(test_layer.get()); // These use the same gpu::Mailbox, but different sync points. @@ -467,7 +468,7 @@ class TextureLayerMailboxHolderTest : public TextureLayerTest { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -517,7 +518,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_BothReleaseThenMain) { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -568,7 +569,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleaseBetween) { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -619,7 +620,7 @@ TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_MainReleasedFirst) { TEST_F(TextureLayerMailboxHolderTest, TwoCompositors_SecondImplRefShortcut) { scoped_refptr<TextureLayer> test_layer = - TextureLayer::CreateForMailbox(nullptr); + TextureLayer::CreateForMailbox(layer_settings_, nullptr); ASSERT_TRUE(test_layer.get()); main_thread_.message_loop()->task_runner()->PostTask( @@ -717,10 +718,10 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); gfx::Size bounds(100, 100); - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(nullptr); + layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -838,10 +839,10 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { void BeginTest() override { gfx::Size bounds(100, 100); - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(nullptr); + layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1139,11 +1140,11 @@ class TextureLayerNoExtraCommitForMailboxTest } void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); - texture_layer_ = TextureLayer::CreateForMailbox(this); + texture_layer_ = TextureLayer::CreateForMailbox(layer_settings(), this); texture_layer_->SetBounds(gfx::Size(10, 10)); texture_layer_->SetIsDrawable(true); root->AddChild(texture_layer_); @@ -1234,22 +1235,22 @@ class TextureLayerChangeInvisibleMailboxTest } void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); - solid_layer_ = SolidColorLayer::Create(); + solid_layer_ = SolidColorLayer::Create(layer_settings()); solid_layer_->SetBounds(gfx::Size(10, 10)); solid_layer_->SetIsDrawable(true); solid_layer_->SetBackgroundColor(SK_ColorWHITE); root->AddChild(solid_layer_); - parent_layer_ = Layer::Create(); + parent_layer_ = Layer::Create(layer_settings()); parent_layer_->SetBounds(gfx::Size(10, 10)); parent_layer_->SetIsDrawable(true); root->AddChild(parent_layer_); - texture_layer_ = TextureLayer::CreateForMailbox(this); + texture_layer_ = TextureLayer::CreateForMailbox(layer_settings(), this); texture_layer_->SetBounds(gfx::Size(10, 10)); texture_layer_->SetIsDrawable(true); parent_layer_->AddChild(texture_layer_); @@ -1364,7 +1365,7 @@ class TextureLayerReleaseResourcesBase LayerTreeTest::SetupTree(); scoped_refptr<TextureLayer> texture_layer = - TextureLayer::CreateForMailbox(this); + TextureLayer::CreateForMailbox(layer_settings(), this); texture_layer->SetBounds(gfx::Size(10, 10)); texture_layer->SetIsDrawable(true); @@ -1428,10 +1429,10 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { void SetupTree() override { gfx::Size bounds(100, 100); - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(nullptr); + layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); @@ -1497,10 +1498,10 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { void SetupTree() override { gfx::Size bounds(100, 100); - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->SetBounds(bounds); - layer_ = TextureLayer::CreateForMailbox(nullptr); + layer_ = TextureLayer::CreateForMailbox(layer_settings(), nullptr); layer_->SetIsDrawable(true); layer_->SetBounds(bounds); diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc index 55143be..972f5c8 100644 --- a/cc/layers/tiled_layer.cc +++ b/cc/layers/tiled_layer.cc @@ -84,8 +84,8 @@ class UpdatableTile : public LayerTilingData::Tile { DISALLOW_COPY_AND_ASSIGN(UpdatableTile); }; -TiledLayer::TiledLayer() - : ContentsScalingLayer(), +TiledLayer::TiledLayer(const LayerSettings& settings) + : ContentsScalingLayer(settings), texture_format_(RGBA_8888), skips_draw_(false), failed_update_(false), diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h index 8069760..c701e07 100644 --- a/cc/layers/tiled_layer.h +++ b/cc/layers/tiled_layer.h @@ -37,7 +37,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer { void OnOutputSurfaceCreated() override; protected: - TiledLayer(); + explicit TiledLayer(const LayerSettings& settings); ~TiledLayer() override; void UpdateTileSizeAndTilingOption(); diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index 7dbab99..eab54c1 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -108,7 +108,7 @@ class TiledLayerTest : public testing::Test { layer_tree_host_->SetLayerTreeHostClientReady(); CHECK(synchronous_output_surface_client_.EnsureOutputSurfaceCreated()); - layer_tree_host_->SetRootLayer(Layer::Create()); + layer_tree_host_->SetRootLayer(Layer::Create(layer_settings_)); CHECK(output_surface_->BindToClient(&output_surface_client_)); @@ -239,6 +239,7 @@ class TiledLayerTest : public testing::Test { public: Proxy* proxy_; LayerTreeSettings settings_; + LayerSettings layer_settings_; FakeOutputSurfaceClient output_surface_client_; scoped_ptr<OutputSurface> output_surface_; scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; @@ -256,8 +257,8 @@ class TiledLayerTest : public testing::Test { TEST_F(TiledLayerTest, PushDirtyTiles) { layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000)); - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -289,8 +290,8 @@ TEST_F(TiledLayerTest, Scale) { layer_tree_host_->SetDeviceScaleFactor(1.5); - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -308,8 +309,8 @@ TEST_F(TiledLayerTest, Scale) { } TEST_F(TiledLayerTest, PushOccludedDirtyTiles) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); TestOcclusionTracker occluded; @@ -351,8 +352,8 @@ TEST_F(TiledLayerTest, PushOccludedDirtyTiles) { TEST_F(TiledLayerTest, PushDeletedTiles) { layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000)); - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -390,8 +391,8 @@ TEST_F(TiledLayerTest, PushDeletedTiles) { } TEST_F(TiledLayerTest, PushIdlePaintTiles) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -430,8 +431,8 @@ TEST_F(TiledLayerTest, PushIdlePaintTiles) { } TEST_F(TiledLayerTest, PredictivePainting) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); @@ -509,12 +510,12 @@ TEST_F(TiledLayerTest, PushTilesAfterIdlePaintFailed) { // Start with 2mb of memory, but the test is going to try to use just more // than 1mb, so we reduce to 1mb later. resource_manager_->SetMaxMemoryLimitBytes(2 * 1024 * 1024); - scoped_refptr<FakeTiledLayer> layer1 = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl1 = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); - scoped_refptr<FakeTiledLayer> layer2 = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl2 = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 2)); RenderSurfaceLayerList render_surface_layer_list; @@ -570,8 +571,8 @@ TEST_F(TiledLayerTest, PushTilesAfterIdlePaintFailed) { } TEST_F(TiledLayerTest, PushIdlePaintedOccludedTiles) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -593,8 +594,8 @@ TEST_F(TiledLayerTest, PushIdlePaintedOccludedTiles) { } TEST_F(TiledLayerTest, PushTilesMarkedDirtyDuringPaint) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -617,10 +618,10 @@ TEST_F(TiledLayerTest, PushTilesMarkedDirtyDuringPaint) { } TEST_F(TiledLayerTest, PushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { - scoped_refptr<FakeTiledLayer> layer1 = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); - scoped_refptr<FakeTiledLayer> layer2 = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer1_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); scoped_ptr<FakeTiledLayerImpl> layer2_impl = @@ -648,10 +649,10 @@ TEST_F(TiledLayerTest, PushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { } TEST_F(TiledLayerTest, PushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer) { - scoped_refptr<FakeTiledLayer> layer1 = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); - scoped_refptr<FakeTiledLayer> layer2 = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer1 = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer2 = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer1_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); scoped_ptr<FakeTiledLayerImpl> layer2_impl = @@ -697,8 +698,8 @@ TEST_F(TiledLayerTest, PaintSmallAnimatedLayersImmediately) { resource_manager_->SetMaxMemoryLimitBytes(memory_for_layer); - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -744,8 +745,8 @@ TEST_F(TiledLayerTest, PaintSmallAnimatedLayersImmediately) { } TEST_F(TiledLayerTest, IdlePaintOutOfMemory) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -773,8 +774,8 @@ TEST_F(TiledLayerTest, IdlePaintOutOfMemory) { } TEST_F(TiledLayerTest, IdlePaintZeroSizedLayer) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); @@ -806,8 +807,8 @@ TEST_F(TiledLayerTest, IdlePaintZeroSizedLayer) { } TEST_F(TiledLayerTest, IdlePaintNonVisibleLayers) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); @@ -844,8 +845,8 @@ TEST_F(TiledLayerTest, IdlePaintNonVisibleLayers) { } TEST_F(TiledLayerTest, InvalidateFromPrepare) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -886,8 +887,9 @@ TEST_F(TiledLayerTest, InvalidateFromPrepare) { TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) { // The update rect (that indicates what was actually painted) should be in // layer space, not the content space. - scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr( - new FakeTiledLayerWithScaledBounds(resource_manager_.get())); + scoped_refptr<FakeTiledLayerWithScaledBounds> layer = + make_scoped_refptr(new FakeTiledLayerWithScaledBounds( + layer_settings_, resource_manager_.get())); layer_tree_host_->root_layer()->AddChild(layer); @@ -936,8 +938,8 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) { } TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); scoped_ptr<FakeTiledLayerImpl> layer_impl = make_scoped_ptr(new FakeTiledLayerImpl(host_impl_->active_tree(), 1)); RenderSurfaceLayerList render_surface_layer_list; @@ -1010,10 +1012,12 @@ TEST_F(TiledLayerTest, SkipsDrawGetsReset) { // We have enough memory for only one of the two layers. int memory_limit = 4 * 300 * 300; // 4 bytes per pixel. - scoped_refptr<FakeTiledLayer> root_layer = make_scoped_refptr( - new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); - scoped_refptr<FakeTiledLayer> child_layer = make_scoped_refptr( - new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> root_layer = + make_scoped_refptr(new FakeTiledLayer( + layer_settings_, layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> child_layer = + make_scoped_refptr(new FakeTiledLayer( + layer_settings_, layer_tree_host_->contents_texture_manager())); root_layer->AddChild(child_layer); root_layer->SetBounds(content_bounds); @@ -1050,8 +1054,8 @@ TEST_F(TiledLayerTest, SkipsDrawGetsReset) { } TEST_F(TiledLayerTest, ResizeToSmaller) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); layer_tree_host_->root_layer()->AddChild(layer); @@ -1069,8 +1073,8 @@ TEST_F(TiledLayerTest, ResizeToSmaller) { } TEST_F(TiledLayerTest, HugeLayerUpdateCrash) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); layer_tree_host_->root_layer()->AddChild(layer); @@ -1096,8 +1100,8 @@ TEST_F(TiledLayerPartialUpdateTest, PartialUpdates) { gfx::Size content_bounds(300, 200); gfx::Rect content_rect(content_bounds); - scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( - new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer( + layer_settings_, layer_tree_host_->contents_texture_manager())); layer->SetBounds(content_bounds); layer->SetPosition(gfx::PointF(0, 0)); layer->draw_properties().visible_content_rect = content_rect; @@ -1202,8 +1206,8 @@ TEST_F(TiledLayerPartialUpdateTest, PartialUpdates) { TEST_F(TiledLayerTest, TilesPaintedWithoutOcclusion) { layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000)); - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); RenderSurfaceLayerList render_surface_layer_list; layer_tree_host_->root_layer()->AddChild(layer); @@ -1220,8 +1224,8 @@ TEST_F(TiledLayerTest, TilesPaintedWithoutOcclusion) { } TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); RenderSurfaceLayerList render_surface_layer_list; TestOcclusionTracker occluded; occlusion_ = &occluded; @@ -1269,8 +1273,8 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) { } TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); RenderSurfaceLayerList render_surface_layer_list; TestOcclusionTracker occluded; occlusion_ = &occluded; @@ -1326,8 +1330,8 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) { } TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); RenderSurfaceLayerList render_surface_layer_list; TestOcclusionTracker occluded; occlusion_ = &occluded; @@ -1363,8 +1367,8 @@ TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) { } TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndTransforms) { - scoped_refptr<FakeTiledLayer> layer = - make_scoped_refptr(new FakeTiledLayer(resource_manager_.get())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr( + new FakeTiledLayer(layer_settings_, resource_manager_.get())); RenderSurfaceLayerList render_surface_layer_list; TestOcclusionTracker occluded; occlusion_ = &occluded; @@ -1398,13 +1402,13 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndTransforms) { TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) { scoped_refptr<FakeTiledLayer> layer = - new FakeTiledLayer(resource_manager_.get()); + new FakeTiledLayer(layer_settings_, resource_manager_.get()); RenderSurfaceLayerList render_surface_layer_list; TestOcclusionTracker occluded; occlusion_ = &occluded; scoped_refptr<FakeTiledLayer> scale_layer = - new FakeTiledLayer(resource_manager_.get()); + new FakeTiledLayer(layer_settings_, resource_manager_.get()); gfx::Transform scale_transform; scale_transform.Scale(2.0, 2.0); scale_layer->SetTransform(scale_transform); @@ -1487,13 +1491,13 @@ TEST_F(TiledLayerTest, DontAllocateContentsWhenTargetSurfaceCantBeAllocated) { gfx::Rect child_rect(0, 0, 300, 100); gfx::Rect child2_rect(0, 100, 300, 100); - scoped_refptr<FakeTiledLayer> root = make_scoped_refptr( - new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); - scoped_refptr<Layer> surface = Layer::Create(); - scoped_refptr<FakeTiledLayer> child = make_scoped_refptr( - new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); - scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr( - new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(new FakeTiledLayer( + layer_settings_, layer_tree_host_->contents_texture_manager())); + scoped_refptr<Layer> surface = Layer::Create(layer_settings_); + scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(new FakeTiledLayer( + layer_settings_, layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer( + layer_settings_, layer_tree_host_->contents_texture_manager())); root->SetBounds(root_rect.size()); root->draw_properties().drawable_content_rect = root_rect; @@ -1661,8 +1665,9 @@ class TrackingLayerPainter : public LayerPainter { class UpdateTrackingTiledLayer : public FakeTiledLayer { public: - explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) - : FakeTiledLayer(manager) { + explicit UpdateTrackingTiledLayer(const LayerSettings& settings, + PrioritizedResourceManager* manager) + : FakeTiledLayer(settings, manager) { scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); tracking_layer_painter_ = painter.get(); layer_updater_ = BitmapContentLayerUpdater::Create(painter.Pass(), 0); @@ -1681,8 +1686,8 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer { }; TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { - scoped_refptr<UpdateTrackingTiledLayer> layer = - make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); + scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr( + new UpdateTrackingTiledLayer(layer_settings_, resource_manager_.get())); layer_tree_host_->root_layer()->AddChild(layer); @@ -1721,8 +1726,8 @@ TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringInvalidation) { - scoped_refptr<UpdateTrackingTiledLayer> layer = - make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); + scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr( + new UpdateTrackingTiledLayer(layer_settings_, resource_manager_.get())); layer_tree_host_->root_layer()->AddChild(layer); diff --git a/cc/layers/ui_resource_layer.cc b/cc/layers/ui_resource_layer.cc index fd107b1..6a7f727 100644 --- a/cc/layers/ui_resource_layer.cc +++ b/cc/layers/ui_resource_layer.cc @@ -51,14 +51,13 @@ class SharedUIResourceHolder : public UIResourceLayer::UIResourceHolder { UIResourceLayer::UIResourceHolder::~UIResourceHolder() {} -scoped_refptr<UIResourceLayer> UIResourceLayer::Create() { - return make_scoped_refptr(new UIResourceLayer()); +scoped_refptr<UIResourceLayer> UIResourceLayer::Create( + const LayerSettings& settings) { + return make_scoped_refptr(new UIResourceLayer(settings)); } -UIResourceLayer::UIResourceLayer() - : Layer(), - uv_top_left_(0.f, 0.f), - uv_bottom_right_(1.f, 1.f) { +UIResourceLayer::UIResourceLayer(const LayerSettings& settings) + : Layer(settings), 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 dc2006e..600f245 100644 --- a/cc/layers/ui_resource_layer.h +++ b/cc/layers/ui_resource_layer.h @@ -18,7 +18,7 @@ class ScopedUIResource; class CC_EXPORT UIResourceLayer : public Layer { public: - static scoped_refptr<UIResourceLayer> Create(); + static scoped_refptr<UIResourceLayer> Create(const LayerSettings& settings); void PushPropertiesTo(LayerImpl* layer) override; @@ -48,7 +48,7 @@ class CC_EXPORT UIResourceLayer : public Layer { }; protected: - UIResourceLayer(); + explicit UIResourceLayer(const LayerSettings& settings); ~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 d0d356d..97d855b 100644 --- a/cc/layers/ui_resource_layer_unittest.cc +++ b/cc/layers/ui_resource_layer_unittest.cc @@ -31,8 +31,9 @@ namespace { class TestUIResourceLayer : public UIResourceLayer { public: - static scoped_refptr<TestUIResourceLayer> Create() { - return make_scoped_refptr(new TestUIResourceLayer()); + static scoped_refptr<TestUIResourceLayer> Create( + const LayerSettings& settings) { + return make_scoped_refptr(new TestUIResourceLayer(settings)); } UIResourceId GetUIResourceId() { @@ -42,7 +43,10 @@ class TestUIResourceLayer : public UIResourceLayer { } protected: - TestUIResourceLayer() : UIResourceLayer() { SetIsDrawable(true); } + explicit TestUIResourceLayer(const LayerSettings& settings) + : UIResourceLayer(settings) { + SetIsDrawable(true); + } ~TestUIResourceLayer() override {} }; @@ -63,10 +67,12 @@ class UIResourceLayerTest : public testing::Test { FakeLayerTreeHostClient fake_client_; scoped_ptr<FakeLayerTreeHost> layer_tree_host_; + LayerSettings layer_settings_; }; TEST_F(UIResourceLayerTest, SetBitmap) { - scoped_refptr<UIResourceLayer> test_layer = TestUIResourceLayer::Create(); + scoped_refptr<UIResourceLayer> test_layer = + TestUIResourceLayer::Create(layer_settings_); ASSERT_TRUE(test_layer.get()); test_layer->SetBounds(gfx::Size(100, 100)); @@ -93,7 +99,8 @@ TEST_F(UIResourceLayerTest, SetBitmap) { } TEST_F(UIResourceLayerTest, SetUIResourceId) { - scoped_refptr<TestUIResourceLayer> test_layer = TestUIResourceLayer::Create(); + scoped_refptr<TestUIResourceLayer> test_layer = + TestUIResourceLayer::Create(layer_settings_); ASSERT_TRUE(test_layer.get()); test_layer->SetBounds(gfx::Size(100, 100)); @@ -128,7 +135,8 @@ TEST_F(UIResourceLayerTest, SetUIResourceId) { } TEST_F(UIResourceLayerTest, BitmapClearedOnSetUIResourceId) { - scoped_refptr<UIResourceLayer> test_layer = TestUIResourceLayer::Create(); + scoped_refptr<UIResourceLayer> test_layer = + TestUIResourceLayer::Create(layer_settings_); 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 fe37fbf4..24e5524 100644 --- a/cc/layers/video_layer.cc +++ b/cc/layers/video_layer.cc @@ -9,14 +9,16 @@ namespace cc { scoped_refptr<VideoLayer> VideoLayer::Create( + const LayerSettings& settings, VideoFrameProvider* provider, media::VideoRotation video_rotation) { - return make_scoped_refptr(new VideoLayer(provider, video_rotation)); + return make_scoped_refptr(new VideoLayer(settings, provider, video_rotation)); } -VideoLayer::VideoLayer(VideoFrameProvider* provider, +VideoLayer::VideoLayer(const LayerSettings& settings, + VideoFrameProvider* provider, media::VideoRotation video_rotation) - : provider_(provider), video_rotation_(video_rotation) { + : Layer(settings), provider_(provider), video_rotation_(video_rotation) { DCHECK(provider_); } diff --git a/cc/layers/video_layer.h b/cc/layers/video_layer.h index bbcff36..298cd2c 100644 --- a/cc/layers/video_layer.h +++ b/cc/layers/video_layer.h @@ -20,7 +20,8 @@ class VideoLayerImpl; // A Layer that contains a Video element. class CC_EXPORT VideoLayer : public Layer { public: - static scoped_refptr<VideoLayer> Create(VideoFrameProvider* provider, + static scoped_refptr<VideoLayer> Create(const LayerSettings& settings, + VideoFrameProvider* provider, media::VideoRotation video_rotation); scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; @@ -29,7 +30,9 @@ class CC_EXPORT VideoLayer : public Layer { const OcclusionTracker<Layer>* occlusion) override; private: - VideoLayer(VideoFrameProvider* provider, media::VideoRotation video_rotation); + VideoLayer(const LayerSettings& settings, + VideoFrameProvider* provider, + media::VideoRotation video_rotation); ~VideoLayer() override; // This pointer is only for passing to VideoLayerImpl's constructor. It should diff --git a/cc/test/fake_content_layer.cc b/cc/test/fake_content_layer.cc index a0a01ee..52a2662 100644 --- a/cc/test/fake_content_layer.cc +++ b/cc/test/fake_content_layer.cc @@ -18,8 +18,9 @@ class FakeContentLayerUpdater : public ContentLayerUpdater { ~FakeContentLayerUpdater() override {} }; -FakeContentLayer::FakeContentLayer(ContentLayerClient* client) - : ContentLayer(client), +FakeContentLayer::FakeContentLayer(const LayerSettings& settings, + ContentLayerClient* client) + : ContentLayer(settings, client), update_count_(0), push_properties_count_(0), output_surface_created_count_(0), diff --git a/cc/test/fake_content_layer.h b/cc/test/fake_content_layer.h index fd09683..1fe156f 100644 --- a/cc/test/fake_content_layer.h +++ b/cc/test/fake_content_layer.h @@ -12,8 +12,9 @@ namespace cc { class FakeContentLayer : public ContentLayer { public: - static scoped_refptr<FakeContentLayer> Create(ContentLayerClient* client) { - return make_scoped_refptr(new FakeContentLayer(client)); + static scoped_refptr<FakeContentLayer> Create(const LayerSettings& settings, + ContentLayerClient* client) { + return make_scoped_refptr(new FakeContentLayer(settings, client)); } scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; @@ -43,7 +44,8 @@ class FakeContentLayer : public ContentLayer { bool HaveBackingAt(int i, int j); private: - explicit FakeContentLayer(ContentLayerClient* client); + explicit FakeContentLayer(const LayerSettings& settings, + ContentLayerClient* client); ~FakeContentLayer() override; size_t update_count_; diff --git a/cc/test/fake_delegated_renderer_layer.cc b/cc/test/fake_delegated_renderer_layer.cc index 1ae8c40..06d732a 100644 --- a/cc/test/fake_delegated_renderer_layer.cc +++ b/cc/test/fake_delegated_renderer_layer.cc @@ -9,8 +9,10 @@ namespace cc { FakeDelegatedRendererLayer::FakeDelegatedRendererLayer( + const LayerSettings& settings, DelegatedFrameProvider* frame_provider) - : DelegatedRendererLayer(frame_provider) {} + : DelegatedRendererLayer(settings, frame_provider) { +} FakeDelegatedRendererLayer::~FakeDelegatedRendererLayer() {} diff --git a/cc/test/fake_delegated_renderer_layer.h b/cc/test/fake_delegated_renderer_layer.h index a8a89a2..76e4c64 100644 --- a/cc/test/fake_delegated_renderer_layer.h +++ b/cc/test/fake_delegated_renderer_layer.h @@ -9,18 +9,22 @@ namespace cc { +class LayerSettings; + class FakeDelegatedRendererLayer : public DelegatedRendererLayer { public: static scoped_refptr<FakeDelegatedRendererLayer> Create( + const LayerSettings& settings, DelegatedFrameProvider* frame_provider) { return make_scoped_refptr( - new FakeDelegatedRendererLayer(frame_provider)); + new FakeDelegatedRendererLayer(settings, frame_provider)); } scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; protected: - explicit FakeDelegatedRendererLayer(DelegatedFrameProvider* frame_provider); + explicit FakeDelegatedRendererLayer(const LayerSettings& settings, + DelegatedFrameProvider* frame_provider); ~FakeDelegatedRendererLayer() override; }; diff --git a/cc/test/fake_painted_scrollbar_layer.cc b/cc/test/fake_painted_scrollbar_layer.cc index e74581a..4d0f6cc 100644 --- a/cc/test/fake_painted_scrollbar_layer.cc +++ b/cc/test/fake_painted_scrollbar_layer.cc @@ -11,19 +11,22 @@ namespace cc { scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( + const LayerSettings& settings, bool paint_during_update, bool has_thumb, int scrolling_layer_id) { FakeScrollbar* fake_scrollbar = new FakeScrollbar( paint_during_update, has_thumb, false); return make_scoped_refptr(new FakePaintedScrollbarLayer( - fake_scrollbar, scrolling_layer_id)); + settings, fake_scrollbar, scrolling_layer_id)); } FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( + const LayerSettings& settings, FakeScrollbar* fake_scrollbar, int scrolling_layer_id) - : PaintedScrollbarLayer(scoped_ptr<Scrollbar>(fake_scrollbar).Pass(), + : PaintedScrollbarLayer(settings, + scoped_ptr<Scrollbar>(fake_scrollbar).Pass(), scrolling_layer_id), update_count_(0), push_properties_count_(0), diff --git a/cc/test/fake_painted_scrollbar_layer.h b/cc/test/fake_painted_scrollbar_layer.h index 033d920..0f3b991 100644 --- a/cc/test/fake_painted_scrollbar_layer.h +++ b/cc/test/fake_painted_scrollbar_layer.h @@ -15,8 +15,11 @@ namespace cc { class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { public: - static scoped_refptr<FakePaintedScrollbarLayer> - Create(bool paint_during_update, bool has_thumb, int scrolling_layer_id); + static scoped_refptr<FakePaintedScrollbarLayer> Create( + const LayerSettings& settings, + bool paint_during_update, + bool has_thumb, + int scrolling_layer_id); int update_count() const { return update_count_; } void reset_update_count() { update_count_ = 0; } @@ -44,7 +47,8 @@ class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; private: - FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, + FakePaintedScrollbarLayer(const LayerSettings& settings, + FakeScrollbar* fake_scrollbar, int scrolling_layer_id); ~FakePaintedScrollbarLayer() override; diff --git a/cc/test/fake_picture_layer.cc b/cc/test/fake_picture_layer.cc index 25953cf..0b7707c 100644 --- a/cc/test/fake_picture_layer.cc +++ b/cc/test/fake_picture_layer.cc @@ -8,8 +8,9 @@ namespace cc { -FakePictureLayer::FakePictureLayer(ContentLayerClient* client) - : PictureLayer(client), +FakePictureLayer::FakePictureLayer(const LayerSettings& settings, + ContentLayerClient* client) + : PictureLayer(settings, client), update_count_(0), push_properties_count_(0), output_surface_created_count_(0), @@ -19,9 +20,10 @@ FakePictureLayer::FakePictureLayer(ContentLayerClient* client) SetIsDrawable(true); } -FakePictureLayer::FakePictureLayer(ContentLayerClient* client, +FakePictureLayer::FakePictureLayer(const LayerSettings& settings, + ContentLayerClient* client, scoped_ptr<RecordingSource> source) - : PictureLayer(client, source.Pass()), + : PictureLayer(settings, client, source.Pass()), update_count_(0), push_properties_count_(0), output_surface_created_count_(0), diff --git a/cc/test/fake_picture_layer.h b/cc/test/fake_picture_layer.h index 2421fee..19e365d 100644 --- a/cc/test/fake_picture_layer.h +++ b/cc/test/fake_picture_layer.h @@ -13,14 +13,17 @@ namespace cc { class FakePictureLayer : public PictureLayer { public: - static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) { - return make_scoped_refptr(new FakePictureLayer(client)); + static scoped_refptr<FakePictureLayer> Create(const LayerSettings& settings, + ContentLayerClient* client) { + return make_scoped_refptr(new FakePictureLayer(settings, client)); } static scoped_refptr<FakePictureLayer> CreateWithRecordingSource( + const LayerSettings& settings, ContentLayerClient* client, scoped_ptr<RecordingSource> source) { - return make_scoped_refptr(new FakePictureLayer(client, source.Pass())); + return make_scoped_refptr( + new FakePictureLayer(settings, client, source.Pass())); } scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; @@ -48,8 +51,9 @@ class FakePictureLayer : public PictureLayer { } private: - explicit FakePictureLayer(ContentLayerClient* client); - FakePictureLayer(ContentLayerClient* client, + FakePictureLayer(const LayerSettings& settings, ContentLayerClient* client); + FakePictureLayer(const LayerSettings& settings, + ContentLayerClient* client, scoped_ptr<RecordingSource> source); ~FakePictureLayer() override; diff --git a/cc/test/layer_tree_host_common_test.h b/cc/test/layer_tree_host_common_test.h index 9fdd1a9..ec77434 100644 --- a/cc/test/layer_tree_host_common_test.h +++ b/cc/test/layer_tree_host_common_test.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "cc/layers/layer_lists.h" #include "cc/test/fake_layer_tree_host_client.h" +#include "cc/trees/layer_tree_settings.h" #include "cc/trees/property_tree.h" #include "testing/gtest/include/gtest/gtest.h" @@ -122,9 +123,12 @@ class LayerTreeHostCommonTestBase { scoped_ptr<FakeLayerTreeHost> CreateFakeLayerTreeHost(); + const LayerSettings& layer_settings() { return layer_settings_; } + private: scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; scoped_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; + LayerSettings layer_settings_; FakeLayerTreeHostClient client_; int render_surface_layer_list_count_; diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc index b0b81f7..9d9163c 100644 --- a/cc/test/layer_tree_json_parser.cc +++ b/cc/test/layer_tree_json_parser.cc @@ -12,6 +12,7 @@ #include "cc/layers/picture_layer.h" #include "cc/layers/solid_color_layer.h" #include "cc/layers/texture_layer.h" +#include "cc/trees/layer_tree_settings.h" namespace cc { @@ -37,11 +38,13 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val, bool draws_content; success &= dict->GetBoolean("DrawsContent", &draws_content); + LayerSettings layer_settings; + scoped_refptr<Layer> new_layer; if (layer_type == "SolidColorLayer") { - new_layer = SolidColorLayer::Create(); + new_layer = SolidColorLayer::Create(layer_settings); } else if (layer_type == "ContentLayer") { - new_layer = ContentLayer::Create(content_client); + new_layer = ContentLayer::Create(layer_settings, content_client); } else if (layer_type == "NinePatchLayer") { success &= dict->GetList("ImageAperture", &list); int aperture_x, aperture_y, aperture_width, aperture_height; @@ -66,7 +69,8 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val, bool fill_center; success &= dict->GetBoolean("FillCenter", &fill_center); - scoped_refptr<NinePatchLayer> nine_patch_layer = NinePatchLayer::Create(); + scoped_refptr<NinePatchLayer> nine_patch_layer = + NinePatchLayer::Create(layer_settings); SkBitmap bitmap; bitmap.allocN32Pixels(image_width, image_height); @@ -80,11 +84,11 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val, new_layer = nine_patch_layer; } else if (layer_type == "TextureLayer") { - new_layer = TextureLayer::CreateForMailbox(NULL); + new_layer = TextureLayer::CreateForMailbox(layer_settings, NULL); } else if (layer_type == "PictureLayer") { - new_layer = PictureLayer::Create(content_client); + new_layer = PictureLayer::Create(layer_settings, content_client); } else { // Type "Layer" or "unknown" - new_layer = Layer::Create(); + new_layer = Layer::Create(layer_settings); } new_layer->SetPosition(gfx::PointF(position_x, position_y)); new_layer->SetBounds(gfx::Size(width, height)); diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index dbb9ba5..436f818 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -119,7 +119,8 @@ void LayerTreePixelTest::AfterTest() { scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( const gfx::Rect& rect, SkColor color) { - scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); + scoped_refptr<SolidColorLayer> layer = + SolidColorLayer::Create(layer_settings()); layer->SetIsDrawable(true); layer->SetBounds(rect.size()); layer->SetPosition(rect.origin()); @@ -176,7 +177,8 @@ scoped_refptr<SolidColorLayer> LayerTreePixelTest:: scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( const gfx::Rect& rect, const SkBitmap& bitmap) { - scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> layer = + TextureLayer::CreateForMailbox(layer_settings(), NULL); layer->SetIsDrawable(true); layer->SetBounds(rect.size()); layer->SetPosition(rect.origin()); @@ -229,7 +231,7 @@ void LayerTreePixelTest::RunPixelTestWithReadbackTarget( } void LayerTreePixelTest::SetupTree() { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(content_root_->bounds()); root->AddChild(content_root_); layer_tree_host()->SetRootLayer(root); diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index bad69c3..89c4048 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -695,7 +695,7 @@ void LayerTreeTest::DoBeginTest() { void LayerTreeTest::SetupTree() { if (!layer_tree_host_->root_layer()) { - scoped_refptr<Layer> root_layer = Layer::Create(); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings_); root_layer->SetBounds(gfx::Size(1, 1)); root_layer->SetIsDrawable(true); layer_tree_host_->SetRootLayer(root_layer); @@ -812,6 +812,7 @@ void LayerTreeTest::RunTest(bool threaded, settings_.impl_side_painting = impl_side_painting; settings_.verify_property_trees = verify_property_trees_; InitializeSettings(&settings_); + InitializeLayerSettings(&layer_settings_); main_task_runner_->PostTask( FROM_HERE, diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 7b48f3f..cbda75e 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -156,10 +156,13 @@ class LayerTreeTest : public testing::Test, public TestHooks { verify_property_trees_ = verify_property_trees; } + const LayerSettings& layer_settings() { return layer_settings_; } + protected: LayerTreeTest(); virtual void InitializeSettings(LayerTreeSettings* settings) {} + virtual void InitializeLayerSettings(LayerSettings* layer_settings) {} void RealEndTest(); @@ -221,6 +224,8 @@ class LayerTreeTest : public testing::Test, public TestHooks { private: LayerTreeSettings settings_; + LayerSettings layer_settings_; + scoped_ptr<LayerTreeHostClientForTesting> client_; scoped_ptr<LayerTreeHost> layer_tree_host_; FakeOutputSurface* output_surface_; diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 7d810d1..ea45f48 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -67,8 +67,9 @@ FakeTiledLayerImpl::FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id) FakeTiledLayerImpl::~FakeTiledLayerImpl() {} -FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resource_manager) - : TiledLayer(), +FakeTiledLayer::FakeTiledLayer(const LayerSettings& settings, + PrioritizedResourceManager* resource_manager) + : TiledLayer(settings), fake_updater_(make_scoped_refptr(new FakeLayerUpdater)), resource_manager_(resource_manager) { SetTileSize(tile_size()); @@ -80,8 +81,10 @@ FakeTiledLayer::FakeTiledLayer(PrioritizedResourceManager* resource_manager) } FakeTiledLayerWithScaledBounds::FakeTiledLayerWithScaledBounds( + const LayerSettings& settings, PrioritizedResourceManager* resource_manager) - : FakeTiledLayer(resource_manager) {} + : FakeTiledLayer(settings, resource_manager) { +} FakeTiledLayerWithScaledBounds::~FakeTiledLayerWithScaledBounds() {} diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index abf2de4..43f946d 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -92,7 +92,8 @@ class FakeTiledLayerImpl : public TiledLayerImpl { class FakeTiledLayer : public TiledLayer { public: - explicit FakeTiledLayer(PrioritizedResourceManager* resource_manager); + explicit FakeTiledLayer(const LayerSettings& settings, + PrioritizedResourceManager* resource_manager); static gfx::Size tile_size() { return gfx::Size(100, 100); } @@ -134,8 +135,8 @@ class FakeTiledLayer : public TiledLayer { class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { public: - explicit FakeTiledLayerWithScaledBounds( - PrioritizedResourceManager* resource_manager); + FakeTiledLayerWithScaledBounds(const LayerSettings& settings, + PrioritizedResourceManager* resource_manager); void SetContentBounds(const gfx::Size& content_bounds); void CalculateContentsScale(float ideal_contents_scale, diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index 6c4696e..92ec3ee 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -373,7 +373,7 @@ void LayerTreeHost::WillCommit() { void LayerTreeHost::UpdateHudLayer() { if (debug_state_.ShowHudInfo()) { if (!hud_layer_.get()) - hud_layer_ = HeadsUpDisplayLayer::Create(); + hud_layer_ = HeadsUpDisplayLayer::Create(settings_.hud_layer_settings); if (root_layer_.get() && !hud_layer_->parent()) root_layer_->AddChild(hud_layer_); diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 05ebfc7..81971cb 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -46,7 +46,8 @@ namespace { class LayerWithForcedDrawsContent : public Layer { public: - LayerWithForcedDrawsContent() {} + explicit LayerWithForcedDrawsContent(const LayerSettings& settings) + : Layer(settings) {} bool DrawsContent() const override; @@ -73,16 +74,19 @@ class MockContentLayerClient : public ContentLayerClient { }; scoped_refptr<FakePictureLayer> CreateDrawablePictureLayer( + const LayerSettings& settings, ContentLayerClient* delegate) { scoped_refptr<FakePictureLayer> to_return = - FakePictureLayer::Create(delegate); + FakePictureLayer::Create(settings, delegate); to_return->SetIsDrawable(true); return to_return; } scoped_refptr<ContentLayer> CreateDrawableContentLayer( + const LayerSettings& settings, ContentLayerClient* delegate) { - scoped_refptr<ContentLayer> to_return = ContentLayer::Create(delegate); + scoped_refptr<ContentLayer> to_return = + ContentLayer::Create(settings, delegate); to_return->SetIsDrawable(true); return to_return; } @@ -104,9 +108,9 @@ TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { // screen space transform, and the hierarchy passed on to children // layers should also be identity transforms. - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); parent->AddChild(child); child->AddChild(grand_child); @@ -148,9 +152,9 @@ TEST_F(LayerTreeHostCommonTest, TransformsForNoOpLayer) { } TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); parent->AddChild(child); child->AddChild(grand_child); @@ -195,9 +199,9 @@ TEST_F(LayerTreeHostCommonTest, DoNotSkipLayersWithHandlers) { TEST_F(LayerTreeHostCommonTest, TransformsForSingleLayer) { gfx::Transform identity_matrix; - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings()); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -393,10 +397,10 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); root->AddChild(parent); parent->AddChild(child); child->AddChild(grand_child); @@ -519,11 +523,11 @@ TEST_F(LayerTreeHostCommonTest, TransformsForSimpleHierarchy) { } TEST_F(LayerTreeHostCommonTest, TransformsForSingleRenderSurface) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(parent); parent->AddChild(child); child->AddChild(grand_child); @@ -614,12 +618,12 @@ TEST_F(LayerTreeHostCommonTest, TransformsForSingleRenderSurface) { } TEST_F(LayerTreeHostCommonTest, TransformsForReplica) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> child_replica = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_replica = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(parent); parent->AddChild(child); child->AddChild(grand_child); @@ -720,20 +724,20 @@ TEST_F(LayerTreeHostCommonTest, TransformsForRenderSurfaceHierarchy) { // - verifying that each layer has a reference to the correct render surface // and render target values. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); - scoped_refptr<Layer> render_surface2 = Layer::Create(); - scoped_refptr<Layer> child_of_root = Layer::Create(); - scoped_refptr<Layer> child_of_rs1 = Layer::Create(); - scoped_refptr<Layer> child_of_rs2 = Layer::Create(); - scoped_refptr<Layer> replica_of_rs1 = Layer::Create(); - scoped_refptr<Layer> replica_of_rs2 = Layer::Create(); - scoped_refptr<Layer> grand_child_of_root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_of_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_of_rs1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_of_rs2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> replica_of_rs1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> replica_of_rs2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child_of_root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(parent); parent->AddChild(render_surface1); parent->AddChild(child_of_root); @@ -1006,12 +1010,12 @@ TEST_F(LayerTreeHostCommonTest, TransformsForFlatteningLayer) { // Note that the way the code is currently implemented, it is not expected to // use a canonical orthographic projection. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> great_grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); gfx::Transform rotation_about_y_axis; rotation_about_y_axis.RotateAboutYAxis(30.0); @@ -1102,10 +1106,10 @@ TEST_F(LayerTreeHostCommonTest, TransformsForDegenerateIntermediateLayer) { // implicitly inherited by the rest of the subtree, which then is positioned // incorrectly as a result. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); // The child height is zero, but has non-zero width that should be accounted // for while computing draw transforms. @@ -1155,9 +1159,9 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { // to child layers instead of applied to the root RenderSurface. const gfx::Transform identity_matrix; scoped_refptr<LayerWithForcedDrawsContent> root = - new LayerWithForcedDrawsContent; + new LayerWithForcedDrawsContent(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - new LayerWithForcedDrawsContent; + new LayerWithForcedDrawsContent(layer_settings()); child->SetScrollClipLayerId(root->id()); root->AddChild(child); @@ -1309,10 +1313,10 @@ TEST_F(LayerTreeHostCommonTest, TransformAboveRootLayer) { TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForRenderSurfaceWithClippedLayer) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); host->SetRootLayer(parent); @@ -1363,10 +1367,10 @@ TEST_F(LayerTreeHostCommonTest, } TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); host->SetRootLayer(parent); @@ -1409,9 +1413,9 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForTransparentChild) { } TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); host->SetRootLayer(parent); @@ -1439,10 +1443,10 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) { } TEST_F(LayerTreeHostCommonTest, ForceRenderSurface) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); render_surface1->SetForceRenderSurface(true); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); @@ -1508,12 +1512,12 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfacesFlattenScreenSpaceTransform) { // Render surfaces act as a flattening point for their subtree, so should // always flatten the target-to-screen space transform seen by descendants. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); gfx::Transform rotation_about_y_axis; rotation_about_y_axis.RotateAboutYAxis(30.0); @@ -1590,14 +1594,14 @@ TEST_F(LayerTreeHostCommonTest, ClipRectCullsRenderSurfaces) { // const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); - scoped_refptr<Layer> great_grand_child = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); + scoped_refptr<Layer> great_grand_child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(child); child->AddChild(grand_child); grand_child->AddChild(great_grand_child); @@ -1691,11 +1695,11 @@ TEST_F(LayerTreeHostCommonTest, ClipRectCullsSurfaceWithoutVisibleContent) { // in the render_surface_layer_list. const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> leaf_node = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(child); child->AddChild(grand_child); grand_child->AddChild(leaf_node); @@ -1786,15 +1790,15 @@ TEST_F(LayerTreeHostCommonTest, IsClippedIsSetCorrectly) { // and propagates the clip to the subtree. const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child1 = Layer::Create(); - scoped_refptr<Layer> child2 = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(parent); parent->AddChild(child1); parent->AddChild(child2); @@ -1947,12 +1951,12 @@ TEST_F(LayerTreeHostCommonTest, DrawableContentRectForLayers) { // const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child1 = Layer::Create(); - scoped_refptr<Layer> grand_child2 = Layer::Create(); - scoped_refptr<Layer> grand_child3 = Layer::Create(); - scoped_refptr<Layer> grand_child4 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child3 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child4 = Layer::Create(layer_settings()); parent->AddChild(child); child->AddChild(grand_child1); @@ -2037,20 +2041,20 @@ TEST_F(LayerTreeHostCommonTest, ClipRectIsPropagatedCorrectlyToSurfaces) { // They may still have a clip rect of their own layer bounds, however, if // masksToBounds was true. const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child1 = Layer::Create(); - scoped_refptr<Layer> grand_child2 = Layer::Create(); - scoped_refptr<Layer> grand_child3 = Layer::Create(); - scoped_refptr<Layer> grand_child4 = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child3 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child4 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> leaf_node1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> leaf_node2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> leaf_node3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> leaf_node4 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(child); child->AddChild(grand_child1); @@ -2175,17 +2179,17 @@ TEST_F(LayerTreeHostCommonTest, ClipRectIsPropagatedCorrectlyToSurfaces) { } TEST_F(LayerTreeHostCommonTest, AnimationsForRenderSurfaceHierarchy) { - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); - scoped_refptr<Layer> render_surface2 = Layer::Create(); - scoped_refptr<Layer> child_of_root = Layer::Create(); - scoped_refptr<Layer> child_of_rs1 = Layer::Create(); - scoped_refptr<Layer> child_of_rs2 = Layer::Create(); - scoped_refptr<Layer> grand_child_of_root = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_of_root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_of_rs1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> child_of_rs2 = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child_of_root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> grand_child_of_rs2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(render_surface1); parent->AddChild(child_of_root); render_surface1->AddChild(child_of_rs1); @@ -2672,13 +2676,13 @@ TEST_F(LayerTreeHostCommonTest, VisibleRectForPerspectiveUnprojection) { } TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child1); root->AddChild(child2); root->AddChild(child3); @@ -2738,14 +2742,14 @@ TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSimpleLayers) { TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForLayersClippedByLayer) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> grand_child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> grand_child3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child); child->AddChild(grand_child1); child->AddChild(grand_child2); @@ -2816,10 +2820,10 @@ TEST_F(LayerTreeHostCommonTest, } TEST_F(LayerTreeHostCommonTest, VisibleContentRectWithClippingAndScaling) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child); child->AddChild(grand_child); @@ -2850,14 +2854,14 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectWithClippingAndScaling) { TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface1); render_surface1->AddChild(child1); render_surface1->AddChild(child2); @@ -2933,13 +2937,13 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, VisibleContentRectsForClippedSurfaceWithEmptyClip) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child1); root->AddChild(child2); root->AddChild(child3); @@ -2983,9 +2987,9 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForLayersWithUninvertibleTransform) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); @@ -3057,9 +3061,9 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, SingularTransformDoesNotPreventClearingDrawProperties) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); @@ -3104,7 +3108,7 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, SingularNonAnimatingTransformDoesNotPreventClearingDrawProperties) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); host->SetRootLayer(root); @@ -3132,14 +3136,14 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForLayersInClippedRenderSurface) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface1); render_surface1->AddChild(child1); render_surface1->AddChild(child2); @@ -3219,15 +3223,15 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsForSurfaceHierarchy) { // Check that clipping does not propagate down surfaces. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); - scoped_refptr<Layer> render_surface2 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child3 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface1); render_surface1->AddChild(render_surface2); render_surface2->AddChild(child1); @@ -3325,10 +3329,10 @@ TEST_F(LayerTreeHostCommonTest, // Layers that have non-axis aligned bounds (due to transforms) have an // expanded, axis-aligned DrawableContentRect and visible content rect. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface1); render_surface1->AddChild(child1); @@ -3394,10 +3398,10 @@ TEST_F(LayerTreeHostCommonTest, // Layers that have non-axis aligned bounds (due to transforms) have an // expanded, axis-aligned DrawableContentRect and visible content rect. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface1); render_surface1->AddChild(child1); @@ -3462,14 +3466,17 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, DrawableAndVisibleContentRectsInHighDPI) { MockContentLayerClient client; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<FakePictureLayer> render_surface1 = - CreateDrawablePictureLayer(&client); + CreateDrawablePictureLayer(layer_settings(), &client); scoped_refptr<FakePictureLayer> render_surface2 = - CreateDrawablePictureLayer(&client); - scoped_refptr<FakePictureLayer> child1 = CreateDrawablePictureLayer(&client); - scoped_refptr<FakePictureLayer> child2 = CreateDrawablePictureLayer(&client); - scoped_refptr<FakePictureLayer> child3 = CreateDrawablePictureLayer(&client); + CreateDrawablePictureLayer(layer_settings(), &client); + scoped_refptr<FakePictureLayer> child1 = + CreateDrawablePictureLayer(layer_settings(), &client); + scoped_refptr<FakePictureLayer> child2 = + CreateDrawablePictureLayer(layer_settings(), &client); + scoped_refptr<FakePictureLayer> child3 = + CreateDrawablePictureLayer(layer_settings(), &client); root->AddChild(render_surface1); render_surface1->AddChild(render_surface2); render_surface2->AddChild(child1); @@ -3568,27 +3575,27 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { // "flattened" to each parent layer according to current W3C spec. const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> front_facing_child_of_front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_child_of_front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> front_facing_child_of_back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_child_of_back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(front_facing_child); parent->AddChild(back_facing_child); @@ -3770,31 +3777,31 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) { // is used. const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> front_facing_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> - front_facing_child_of_front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + front_facing_child_of_front_facing_surface = + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> - back_facing_child_of_front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + back_facing_child_of_front_facing_surface = + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> - front_facing_child_of_back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + front_facing_child_of_back_facing_surface = + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> - back_facing_child_of_back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + back_facing_child_of_back_facing_surface = + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> dummy_replica_layer1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> dummy_replica_layer2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(front_facing_child); parent->AddChild(back_facing_child); @@ -3955,17 +3962,17 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithAnimatingTransforms) { // transforms should be treated as "unknown" so we can not be sure that their // back face is really showing. const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> animating_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child_of_animating_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> animating_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(child); parent->AddChild(animating_surface); @@ -4104,15 +4111,15 @@ TEST_F(LayerTreeHostCommonTest, // created when it flattens its subtree, and its parent has preserves-3d. const gfx::Transform identity_matrix; - scoped_refptr<Layer> parent = Layer::Create(); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> front_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> back_facing_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child1 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child2 = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); parent->AddChild(front_facing_surface); parent->AddChild(back_facing_surface); @@ -4214,8 +4221,10 @@ TEST_F(LayerTreeHostCommonTest, class NoScaleContentLayer : public ContentLayer { public: - static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) { - return make_scoped_refptr(new NoScaleContentLayer(client)); + static scoped_refptr<NoScaleContentLayer> Create( + const LayerSettings& settings, + ContentLayerClient* client) { + return make_scoped_refptr(new NoScaleContentLayer(settings, client)); } void CalculateContentsScale(float ideal_contents_scale, @@ -4230,15 +4239,16 @@ class NoScaleContentLayer : public ContentLayer { } protected: - explicit NoScaleContentLayer(ContentLayerClient* client) - : ContentLayer(client) {} + NoScaleContentLayer(const LayerSettings& settings, ContentLayerClient* client) + : ContentLayer(settings, client) {} ~NoScaleContentLayer() override {} }; scoped_refptr<NoScaleContentLayer> CreateNoScaleDrawableContentLayer( + const LayerSettings& settings, ContentLayerClient* delegate) { scoped_refptr<NoScaleContentLayer> to_return = - NoScaleContentLayer::Create(delegate); + NoScaleContentLayer::Create(settings, delegate); to_return->SetIsDrawable(true); return to_return; } @@ -4249,7 +4259,7 @@ TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) { gfx::Transform identity_matrix; scoped_refptr<FakePictureLayer> parent = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -4258,7 +4268,8 @@ TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) { false, true); - scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); + scoped_refptr<FakePictureLayer> child = + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -4268,7 +4279,7 @@ TEST_F(LayerTreeHostCommonTest, LayerTransformsInHighDPI) { true); scoped_refptr<FakePictureLayer> child_empty = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_empty.get(), identity_matrix, gfx::Point3F(), @@ -4369,10 +4380,10 @@ TEST_F(LayerTreeHostCommonTest, SurfaceLayerTransformsInHighDPI) { gfx::Transform scale_small_matrix; scale_small_matrix.Scale(SK_MScalar1 / 10.f, SK_MScalar1 / 12.f); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<FakePictureLayer> parent = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -4382,7 +4393,7 @@ TEST_F(LayerTreeHostCommonTest, SurfaceLayerTransformsInHighDPI) { true); scoped_refptr<FakePictureLayer> perspective_surface = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(perspective_surface.get(), perspective_matrix * scale_small_matrix, gfx::Point3F(), @@ -4392,7 +4403,7 @@ TEST_F(LayerTreeHostCommonTest, SurfaceLayerTransformsInHighDPI) { true); scoped_refptr<FakePictureLayer> scale_surface = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(scale_surface.get(), scale_small_matrix, gfx::Point3F(), @@ -4485,7 +4496,8 @@ TEST_F(LayerTreeHostCommonTest, MockContentLayerClient delegate; gfx::Transform identity_matrix; - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<ContentLayer> parent = + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -4494,7 +4506,8 @@ TEST_F(LayerTreeHostCommonTest, false, true); - scoped_refptr<ContentLayer> child = CreateDrawableContentLayer(&delegate); + scoped_refptr<ContentLayer> child = + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -4504,7 +4517,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<NoScaleContentLayer> child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_no_scale.get(), identity_matrix, gfx::Point3F(), @@ -4608,10 +4621,11 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { SkMScalar initial_child_scale = 1.25; child_scale_matrix.Scale(initial_child_scale, initial_child_scale); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<ContentLayer> parent = + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -4621,7 +4635,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { true); scoped_refptr<ContentLayer> child_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4631,7 +4645,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { true); scoped_refptr<ContentLayer> child_empty = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_empty.get(), child_scale_matrix, gfx::Point3F(), @@ -4641,7 +4655,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScale) { true); scoped_refptr<NoScaleContentLayer> child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4797,10 +4811,11 @@ TEST_F(LayerTreeHostCommonTest, SkMScalar initial_child_scale = 1.25; child_scale_matrix.Scale(initial_child_scale, initial_child_scale); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<ContentLayer> parent = + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -4810,7 +4825,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<ContentLayer> child_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4820,7 +4835,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<ContentLayer> child_empty = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_empty.get(), child_scale_matrix, gfx::Point3F(), @@ -4830,7 +4845,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<NoScaleContentLayer> child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4902,11 +4917,11 @@ TEST_F(LayerTreeHostCommonTest, SmallIdealScale) { SkMScalar initial_child_scale = 0.25; child_scale_matrix.Scale(initial_child_scale, initial_child_scale); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); scoped_refptr<FakePictureLayer> parent = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -4916,7 +4931,7 @@ TEST_F(LayerTreeHostCommonTest, SmallIdealScale) { true); scoped_refptr<FakePictureLayer> child_scale = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4970,10 +4985,11 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { SkMScalar initial_child_scale = 3.0; child_scale_matrix.Scale(initial_child_scale, initial_child_scale); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<ContentLayer> parent = + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -4983,7 +4999,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { true); scoped_refptr<ContentLayer> surface_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -4993,7 +5009,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { true); scoped_refptr<ContentLayer> surface_scale_child_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_scale_child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5003,7 +5019,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { true); scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5013,7 +5029,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { true); scoped_refptr<NoScaleContentLayer> surface_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5023,7 +5039,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { true); scoped_refptr<ContentLayer> surface_no_scale_child_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5033,7 +5049,7 @@ TEST_F(LayerTreeHostCommonTest, ContentsScaleForSurfaces) { true); scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5173,10 +5189,11 @@ TEST_F(LayerTreeHostCommonTest, SkMScalar initial_child_scale = 3.0; child_scale_matrix.Scale(initial_child_scale, initial_child_scale); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); - scoped_refptr<ContentLayer> parent = CreateDrawableContentLayer(&delegate); + scoped_refptr<ContentLayer> parent = + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -5186,7 +5203,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<ContentLayer> surface_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5196,7 +5213,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<ContentLayer> surface_scale_child_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_scale_child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5206,7 +5223,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<NoScaleContentLayer> surface_scale_child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_scale_child_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5216,7 +5233,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<NoScaleContentLayer> surface_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5226,7 +5243,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<ContentLayer> surface_no_scale_child_scale = - CreateDrawableContentLayer(&delegate); + CreateDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_no_scale_child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5236,7 +5253,7 @@ TEST_F(LayerTreeHostCommonTest, true); scoped_refptr<NoScaleContentLayer> surface_no_scale_child_no_scale = - CreateNoScaleDrawableContentLayer(&delegate); + CreateNoScaleDrawableContentLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(surface_no_scale_child_no_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5382,11 +5399,11 @@ TEST_F(LayerTreeHostCommonTest, IdealScaleForAnimatingLayer) { SkMScalar initial_child_scale = 1.25; child_scale_matrix.Scale(initial_child_scale, initial_child_scale); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); scoped_refptr<FakePictureLayer> parent = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), parent_scale_matrix, gfx::Point3F(), @@ -5396,7 +5413,7 @@ TEST_F(LayerTreeHostCommonTest, IdealScaleForAnimatingLayer) { true); scoped_refptr<FakePictureLayer> child_scale = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child_scale.get(), child_scale_matrix, gfx::Point3F(), @@ -5431,8 +5448,9 @@ TEST_F(LayerTreeHostCommonTest, IdealScaleForAnimatingLayer) { TEST_F(LayerTreeHostCommonTest, ChangeInContentBoundsOrScaleTriggersPushProperties) { MockContentLayerClient delegate; - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = CreateDrawableContentLayer(&delegate); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = + CreateDrawableContentLayer(layer_settings(), &delegate); root->AddChild(child); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); @@ -5494,7 +5512,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { gfx::Transform identity_matrix; scoped_refptr<FakePictureLayer> parent = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -5503,7 +5521,8 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { false, true); - scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); + scoped_refptr<FakePictureLayer> child = + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -5515,7 +5534,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { gfx::Transform replica_transform; replica_transform.Scale(1.0, -1.0); scoped_refptr<FakePictureLayer> replica = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), @@ -5527,7 +5546,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceTransformsInHighDPI) { // This layer should end up in the same surface as child, with the same draw // and screen space transforms. scoped_refptr<FakePictureLayer> duplicate_child_non_owner = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(duplicate_child_non_owner.get(), identity_matrix, gfx::Point3F(), @@ -5634,7 +5653,7 @@ TEST_F(LayerTreeHostCommonTest, gfx::Transform identity_matrix; scoped_refptr<FakePictureLayer> parent = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(parent.get(), identity_matrix, gfx::Point3F(), @@ -5643,7 +5662,8 @@ TEST_F(LayerTreeHostCommonTest, false, true); - scoped_refptr<FakePictureLayer> child = CreateDrawablePictureLayer(&delegate); + scoped_refptr<FakePictureLayer> child = + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -5655,7 +5675,7 @@ TEST_F(LayerTreeHostCommonTest, gfx::Transform replica_transform; replica_transform.Scale(1.0, -1.0); scoped_refptr<FakePictureLayer> replica = - CreateDrawablePictureLayer(&delegate); + CreateDrawablePictureLayer(layer_settings(), &delegate); SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), @@ -5705,11 +5725,11 @@ TEST_F(LayerTreeHostCommonTest, } TEST_F(LayerTreeHostCommonTest, SubtreeSearch) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grand_child = Layer::Create(); - scoped_refptr<Layer> mask_layer = Layer::Create(); - scoped_refptr<Layer> replica_layer = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); + scoped_refptr<Layer> mask_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); grand_child->SetReplicaLayer(replica_layer.get()); child->AddChild(grand_child.get()); @@ -5738,10 +5758,10 @@ TEST_F(LayerTreeHostCommonTest, SubtreeSearch) { } TEST_F(LayerTreeHostCommonTest, TransparentChildRenderSurfaceCreation) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grand_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); const gfx::Transform identity_matrix; SetLayerPropertiesForTesting(root.get(), @@ -6036,7 +6056,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { host_impl.CreatePendingTree(); const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -6046,7 +6066,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { false); root->SetIsDrawable(true); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -6056,7 +6076,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayer) { false); child->SetIsDrawable(true); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, gfx::Point3F(), @@ -6139,7 +6159,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { host_impl.CreatePendingTree(); const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -6149,7 +6169,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { false); root->SetIsDrawable(true); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(), @@ -6160,7 +6180,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayers) { child->SetIsDrawable(true); child->SetHideLayerAndSubtree(true); - scoped_refptr<Layer> grand_child = Layer::Create(); + scoped_refptr<Layer> grand_child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, gfx::Point3F(), @@ -6241,7 +6261,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { host_impl.CreatePendingTree(); const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -6251,7 +6271,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { false); root->SetIsDrawable(true); - scoped_refptr<Layer> copy_grand_parent = Layer::Create(); + scoped_refptr<Layer> copy_grand_parent = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_grand_parent.get(), identity_matrix, gfx::Point3F(), @@ -6261,7 +6281,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { false); copy_grand_parent->SetIsDrawable(true); - scoped_refptr<Layer> copy_parent = Layer::Create(); + scoped_refptr<Layer> copy_parent = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix, gfx::Point3F(), @@ -6272,7 +6292,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { copy_parent->SetIsDrawable(true); copy_parent->SetForceRenderSurface(true); - scoped_refptr<Layer> copy_layer = Layer::Create(); + scoped_refptr<Layer> copy_layer = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_layer.get(), identity_matrix, gfx::Point3F(), @@ -6282,7 +6302,7 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { false); copy_layer->SetIsDrawable(true); - scoped_refptr<Layer> copy_child = Layer::Create(); + scoped_refptr<Layer> copy_child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, gfx::Point3F(), @@ -6292,7 +6312,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { false); copy_child->SetIsDrawable(true); - scoped_refptr<Layer> copy_grand_parent_sibling_before = Layer::Create(); + scoped_refptr<Layer> copy_grand_parent_sibling_before = + Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_grand_parent_sibling_before.get(), identity_matrix, gfx::Point3F(), @@ -6302,7 +6323,8 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHiddenWithCopyRequest) { false); copy_grand_parent_sibling_before->SetIsDrawable(true); - scoped_refptr<Layer> copy_grand_parent_sibling_after = Layer::Create(); + scoped_refptr<Layer> copy_grand_parent_sibling_after = + Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_grand_parent_sibling_after.get(), identity_matrix, gfx::Point3F(), @@ -6388,7 +6410,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { host_impl.CreatePendingTree(); const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -6398,7 +6420,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { false); root->SetIsDrawable(true); - scoped_refptr<Layer> copy_parent = Layer::Create(); + scoped_refptr<Layer> copy_parent = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_parent.get(), identity_matrix, gfx::Point3F(), @@ -6409,7 +6431,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { copy_parent->SetIsDrawable(true); copy_parent->SetMasksToBounds(true); - scoped_refptr<Layer> copy_layer = Layer::Create(); + scoped_refptr<Layer> copy_layer = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_layer.get(), identity_matrix, gfx::Point3F(), @@ -6419,7 +6441,7 @@ TEST_F(LayerTreeHostCommonTest, ClippedOutCopyRequest) { false); copy_layer->SetIsDrawable(true); - scoped_refptr<Layer> copy_child = Layer::Create(); + scoped_refptr<Layer> copy_child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(copy_child.get(), identity_matrix, gfx::Point3F(), @@ -6463,7 +6485,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { host_impl.CreatePendingTree(); const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -6474,7 +6496,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { root->SetIsDrawable(true); // The surface is moved slightly outside of the viewport. - scoped_refptr<Layer> surface = Layer::Create(); + scoped_refptr<Layer> surface = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(), @@ -6484,7 +6506,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) { false); surface->SetForceRenderSurface(true); - scoped_refptr<Layer> surface_child = Layer::Create(); + scoped_refptr<Layer> surface_child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(surface_child.get(), identity_matrix, gfx::Point3F(), @@ -6524,12 +6546,12 @@ TEST_F(LayerTreeHostCommonTest, TransformedClipParent) { // // The render surface should be resized correctly and the clip child should // inherit the right clip rect. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface = Layer::Create(); - scoped_refptr<Layer> clip_parent = Layer::Create(); - scoped_refptr<Layer> intervening = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> clip_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface); render_surface->AddChild(clip_parent); @@ -6626,13 +6648,13 @@ TEST_F(LayerTreeHostCommonTest, ClipParentWithInterveningRenderSurface) { // + render_surface2 (also sets opacity) // + clip_child // - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> clip_parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); - scoped_refptr<Layer> intervening = Layer::Create(); - scoped_refptr<Layer> render_surface2 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> clip_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(clip_parent); clip_parent->AddChild(render_surface1); @@ -6753,13 +6775,13 @@ TEST_F(LayerTreeHostCommonTest, ClipParentScrolledInterveningLayer) { // + render_surface2 (also sets opacity) // + clip_child // - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> clip_parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); - scoped_refptr<Layer> intervening = Layer::Create(); - scoped_refptr<Layer> render_surface2 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); + scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> clip_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(clip_parent); clip_parent->AddChild(render_surface1); @@ -6879,12 +6901,12 @@ TEST_F(LayerTreeHostCommonTest, DescendantsOfClipChildren) { // + clip_child // + child // - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> clip_parent = Layer::Create(); - scoped_refptr<Layer> intervening = Layer::Create(); - scoped_refptr<Layer> clip_child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> intervening = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip_child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(clip_parent); clip_parent->AddChild(intervening); @@ -6963,14 +6985,14 @@ TEST_F(LayerTreeHostCommonTest, // + non_clip_child // // In this example render_surface2 should be unaffected by clip_child. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> clip_parent = Layer::Create(); - scoped_refptr<Layer> render_surface1 = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface1 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> clip_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); - scoped_refptr<Layer> render_surface2 = Layer::Create(); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); + scoped_refptr<Layer> render_surface2 = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> non_clip_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(clip_parent); clip_parent->AddChild(render_surface1); @@ -7172,10 +7194,10 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { } TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> render_surface = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> render_surface = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface); render_surface->AddChild(child); @@ -7244,13 +7266,13 @@ TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { // | + scroll_parent // + scroll_child // - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> scroll_parent_border = Layer::Create(); - scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> scroll_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(scroll_child); @@ -7313,11 +7335,11 @@ TEST_F(LayerTreeHostCommonTest, ClippedByScrollParent) { TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { scoped_refptr<LayerWithForcedDrawsContent> root = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> parent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(parent); parent->AddChild(child); @@ -7385,13 +7407,13 @@ TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollParent) { // + scroll_parent_clip // + scroll_parent // - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> scroll_parent_border = Layer::Create(); - scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> scroll_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(scroll_parent_border); scroll_parent_border->AddChild(scroll_parent_clip); @@ -7465,19 +7487,21 @@ TEST_F(LayerTreeHostCommonTest, ClippedByOutOfOrderScrollGrandparent) { // + scroll_grandparent_clip // + scroll_grandparent // - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> scroll_parent_border = Layer::Create(); - scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); - scoped_refptr<Layer> scroll_grandparent_border = Layer::Create(); - scoped_refptr<Layer> scroll_grandparent_clip = Layer::Create(); + scoped_refptr<Layer> scroll_grandparent_border = + Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_grandparent_clip = + Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> scroll_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(scroll_child); @@ -7590,24 +7614,26 @@ TEST_F(LayerTreeHostCommonTest, OutOfOrderClippingRequiresRSLLSorting) { // + render_surface2 // scoped_refptr<LayerWithForcedDrawsContent> root = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); - scoped_refptr<Layer> scroll_parent_border = Layer::Create(); - scoped_refptr<Layer> scroll_parent_clip = Layer::Create(); + scoped_refptr<Layer> scroll_parent_border = Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_parent_clip = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> render_surface1 = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); - scoped_refptr<Layer> scroll_grandparent_border = Layer::Create(); - scoped_refptr<Layer> scroll_grandparent_clip = Layer::Create(); + scoped_refptr<Layer> scroll_grandparent_border = + Layer::Create(layer_settings()); + scoped_refptr<Layer> scroll_grandparent_clip = + Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_grandparent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> render_surface2 = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> scroll_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(scroll_child); @@ -7742,13 +7768,13 @@ TEST_F(LayerTreeHostCommonTest, FixedPositionWithInterveningRenderSurface) { // + fixed // + child // - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> render_surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> fixed = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(render_surface); render_surface->AddChild(fixed); @@ -8727,7 +8753,7 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) { } TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), gfx::Transform(), gfx::Point3F(), @@ -8737,7 +8763,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { false); root->SetIsDrawable(true); - scoped_refptr<Layer> clip = Layer::Create(); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(clip.get(), gfx::Transform(), gfx::Point3F(), @@ -8747,7 +8773,7 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { false); clip->SetMasksToBounds(true); - scoped_refptr<Layer> content = Layer::Create(); + scoped_refptr<Layer> content = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(content.get(), gfx::Transform(), gfx::Point3F(), @@ -8850,9 +8876,9 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) { TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> animated = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(animated); @@ -8879,14 +8905,14 @@ TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayer) { TEST_F(LayerTreeHostCommonTest, VisibleContentRectForAnimatedLayerWithSingularTransform) { const gfx::Transform identity_matrix; - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> clip = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> animated = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> surface = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> descendant_of_animation = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(clip); clip->AddChild(animated); @@ -8956,9 +8982,9 @@ TEST_F(LayerTreeHostCommonTest, // Verify that having an animated filter (but no current filter, as these // are mutually exclusive) correctly creates a render surface. TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); - scoped_refptr<Layer> grandchild = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); + scoped_refptr<Layer> grandchild = Layer::Create(layer_settings()); root->AddChild(child); child->AddChild(grandchild); @@ -8993,10 +9019,10 @@ TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) { // Ensures that the property tree code accounts for offsets between fixed // position layers and their respective containers. TEST_F(LayerTreeHostCommonTest, PropertyTreesAccountForFixedParentOffset) { - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> grandchild = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child); child->AddChild(grandchild); @@ -9038,35 +9064,35 @@ TEST_F(LayerTreeHostCommonTest, CombineClipsUsingContentTarget) { rotate.Rotate(5); gfx::Transform identity; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(2500, 1500), true, false); - scoped_refptr<Layer> frame_clip = Layer::Create(); + scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(2500, 1500), true, false); frame_clip->SetMasksToBounds(true); - scoped_refptr<Layer> rotated = Layer::Create(); + scoped_refptr<Layer> rotated = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(rotated.get(), rotate, gfx::Point3F(1250, 250, 0), gfx::PointF(), gfx::Size(2500, 500), true, false); - scoped_refptr<Layer> surface = Layer::Create(); + scoped_refptr<Layer> surface = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(surface.get(), rotate, gfx::Point3F(), gfx::PointF(), gfx::Size(2500, 500), true, false); surface->SetOpacity(0.5); scoped_refptr<LayerWithForcedDrawsContent> container = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(container.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(300, 300), true, false); scoped_refptr<LayerWithForcedDrawsContent> box = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(box.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(100, 100), true, false); @@ -9087,19 +9113,19 @@ TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) { gfx::Transform translate_z; translate_z.Translate3d(0, 0, 10); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(800, 800), true, false); root->SetIsContainerForFixedPositionLayers(true); - scoped_refptr<Layer> frame_clip = Layer::Create(); + scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), gfx::PointF(500, 100), gfx::Size(100, 100), true, false); frame_clip->SetMasksToBounds(true); scoped_refptr<LayerWithForcedDrawsContent> fixed = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(1000, 1000), true, false); @@ -9126,19 +9152,19 @@ TEST_F(LayerTreeHostCommonTest, gfx::Transform translate_z; translate_z.Translate3d(0, 0, 10); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(800, 800), true, false); root->SetIsContainerForFixedPositionLayers(true); - scoped_refptr<Layer> frame_clip = Layer::Create(); + scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(), gfx::PointF(500, 100), gfx::Size(100, 100), true, false); frame_clip->SetMasksToBounds(true); scoped_refptr<LayerWithForcedDrawsContent> scroller = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(1000, 1000), true, false); @@ -9148,7 +9174,7 @@ TEST_F(LayerTreeHostCommonTest, scroller->SetScrollClipLayerId(frame_clip->id()); scoped_refptr<LayerWithForcedDrawsContent> fixed = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), true, false); @@ -9157,7 +9183,7 @@ TEST_F(LayerTreeHostCommonTest, fixed->SetPositionConstraint(constraint); scoped_refptr<LayerWithForcedDrawsContent> fixed_child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), true, false); @@ -9183,19 +9209,19 @@ TEST_F(LayerTreeHostCommonTest, TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { gfx::Transform identity; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(800, 800), true, false); root->SetIsContainerForFixedPositionLayers(true); - scoped_refptr<Layer> frame_clip = Layer::Create(); + scoped_refptr<Layer> frame_clip = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(frame_clip.get(), identity, gfx::Point3F(), gfx::PointF(500, 100), gfx::Size(100, 100), true, false); frame_clip->SetMasksToBounds(true); scoped_refptr<LayerWithForcedDrawsContent> scroller = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(1000, 1000), true, false); @@ -9204,7 +9230,7 @@ TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) { scroller->SetScrollClipLayerId(frame_clip->id()); scoped_refptr<LayerWithForcedDrawsContent> fixed = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(), gfx::PointF(100, 100), gfx::Size(50, 50), true, false); @@ -9236,7 +9262,7 @@ TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { translate.Translate(10, 10); rotate.Rotate(45); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(800, 800), true, false); root->SetIsContainerForFixedPositionLayers(true); @@ -9255,9 +9281,9 @@ TEST_F(LayerTreeHostCommonTest, ChangingAxisAlignmentTriggersRebuild) { } TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(child); scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); @@ -9281,11 +9307,11 @@ TEST_F(LayerTreeHostCommonTest, ChangeTransformOrigin) { } TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> scroll_parent = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> scroll_child = - make_scoped_refptr(new LayerWithForcedDrawsContent); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); root->AddChild(scroll_child); root->AddChild(scroll_parent); @@ -9323,13 +9349,13 @@ static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) { TEST_F(LayerTreeHostCommonTest, SkippingSubtreeMain) { gfx::Transform identity; FakeContentLayerClient client; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<LayerWithForcedDrawsContent> grandchild = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); scoped_refptr<FakeContentLayer> greatgrandchild( - FakeContentLayer::Create(&client)); + FakeContentLayer::Create(layer_settings(), &client)); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(100, 100), true, false); SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), @@ -9485,9 +9511,9 @@ TEST_F(LayerTreeHostCommonTest, SkippingSubtreeImpl) { TEST_F(LayerTreeHostCommonTest, SkippingLayer) { gfx::Transform identity; FakeContentLayerClient client; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<LayerWithForcedDrawsContent> child = - make_scoped_refptr(new LayerWithForcedDrawsContent()); + make_scoped_refptr(new LayerWithForcedDrawsContent(layer_settings())); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(100, 100), true, false); SetLayerPropertiesForTesting(child.get(), identity, gfx::Point3F(), @@ -9528,9 +9554,9 @@ TEST_F(LayerTreeHostCommonTest, SkippingLayer) { TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { // Ensure that the treewalk in LayerTreeHostCommom:: // PreCalculateMetaInformation happens when its required. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> parent = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> parent = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); root->AddChild(parent); parent->AddChild(child); @@ -9573,8 +9599,8 @@ TEST_F(LayerTreeHostCommonTest, LayerTreeRebuildTest) { TEST_F(LayerTreeHostCommonTest, InputHandlersRecursiveUpdateTest) { // Ensure that the treewalk in LayertreeHostCommon:: // PreCalculateMetaInformation updates input handlers correctly. - scoped_refptr<Layer> root = Layer::Create(); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); root->AddChild(child); @@ -9602,11 +9628,11 @@ TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { gfx::Transform translate_z; translate_z.Translate3d(0, 0, 10); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), gfx::PointF(), gfx::Size(800, 800), true, false); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); SetLayerPropertiesForTesting(child.get(), translate_z, gfx::Point3F(), gfx::PointF(), gfx::Size(100, 100), true, false); diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc index b31d3e8..e2715e3 100644 --- a/cc/trees/layer_tree_host_pixeltest_blending.cc +++ b/cc/trees/layer_tree_host_pixeltest_blending.cc @@ -137,7 +137,8 @@ class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest { canvas.drawRect( SkRect::MakeXYWH(0, i * kLaneHeight, kLaneWidth, kLaneHeight), paint); } - scoped_refptr<PictureImageLayer> layer = PictureImageLayer::Create(); + scoped_refptr<PictureImageLayer> layer = + PictureImageLayer::Create(layer_settings()); layer->SetIsDrawable(true); layer->SetBounds(gfx::Size(width, height)); layer->SetBitmap(backing_store); @@ -147,7 +148,8 @@ class LayerTreeHostBlendingPixelTest : public LayerTreeHostPixelResourceTest { void SetupMaskLayer(scoped_refptr<Layer> layer) { const int kMaskOffset = 2; gfx::Size bounds = layer->bounds(); - scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); + scoped_refptr<PictureImageLayer> mask = + PictureImageLayer::Create(layer_settings()); mask->SetIsDrawable(true); mask->SetIsMask(true); mask->SetBounds(bounds); diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc index 0cb6aea..086f3ea 100644 --- a/cc/trees/layer_tree_host_pixeltest_masks.cc +++ b/cc/trees/layer_tree_host_pixeltest_masks.cc @@ -67,7 +67,8 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfLayer) { gfx::Size mask_bounds(50, 50); MaskContentLayerClient client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); @@ -83,7 +84,8 @@ TEST_P(LayerTreeHostMasksPixelTest, ImageMaskOfLayer) { gfx::Size mask_bounds(50, 50); - scoped_refptr<PictureImageLayer> mask = PictureImageLayer::Create(); + scoped_refptr<PictureImageLayer> mask = + PictureImageLayer::Create(layer_settings()); mask->SetIsDrawable(true); mask->SetIsMask(true); mask->SetBounds(mask_bounds); @@ -111,7 +113,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfClippedLayer) { gfx::Rect(100, 100), SK_ColorWHITE); // Clip to the top half of the green layer. - scoped_refptr<Layer> clip = Layer::Create(); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); clip->SetPosition(gfx::Point(0, 0)); clip->SetBounds(gfx::Size(100, 50)); clip->SetMasksToBounds(true); @@ -123,7 +125,8 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfClippedLayer) { gfx::Size mask_bounds(50, 50); MaskContentLayerClient client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); @@ -140,7 +143,8 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplica) { gfx::Size mask_bounds(50, 50); MaskContentLayerClient client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); @@ -153,7 +157,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplica) { gfx::Transform replica_transform; replica_transform.Rotate(-90.0); - scoped_refptr<Layer> replica = Layer::Create(); + scoped_refptr<Layer> replica = Layer::Create(layer_settings()); replica->SetTransformOrigin(gfx::Point3F(25.f, 25.f, 0.f)); replica->SetPosition(gfx::Point(50, 50)); replica->SetTransform(replica_transform); @@ -169,14 +173,15 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) { gfx::Size mask_bounds(50, 50); MaskContentLayerClient client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); // Clip to the bottom half of the green layer, and the left half of the // replica. - scoped_refptr<Layer> clip = Layer::Create(); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); clip->SetPosition(gfx::Point(0, 25)); clip->SetBounds(gfx::Size(75, 75)); clip->SetMasksToBounds(true); @@ -190,7 +195,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskWithReplicaOfClippedLayer) { gfx::Transform replica_transform; replica_transform.Rotate(-90.0); - scoped_refptr<Layer> replica = Layer::Create(); + scoped_refptr<Layer> replica = Layer::Create(layer_settings()); replica->SetTransformOrigin(gfx::Point3F(25.f, 25.f, 0.f)); replica->SetPosition(gfx::Point(50, 50)); replica->SetTransform(replica_transform); @@ -207,7 +212,8 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfReplica) { gfx::Size mask_bounds(50, 50); MaskContentLayerClient client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); @@ -224,7 +230,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfReplica) { replica_transform.Rotate(180.0); replica_transform.Translate(50.0, 0.0); - scoped_refptr<Layer> replica = Layer::Create(); + scoped_refptr<Layer> replica = Layer::Create(layer_settings()); replica->SetTransformOrigin(gfx::Point3F(50.f, 50.f, 0.f)); replica->SetPosition(gfx::Point()); replica->SetTransform(replica_transform); @@ -241,13 +247,14 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfReplicaOfClippedLayer) { gfx::Size mask_bounds(50, 50); MaskContentLayerClient client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); // Clip to the bottom 3/4 of the green layer, and the top 3/4 of the replica. - scoped_refptr<Layer> clip = Layer::Create(); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); clip->SetPosition(gfx::Point(0, 12)); clip->SetBounds(gfx::Size(100, 75)); clip->SetMasksToBounds(true); @@ -265,7 +272,7 @@ TEST_P(LayerTreeHostMasksPixelTest, MaskOfReplicaOfClippedLayer) { replica_transform.Rotate(180.0); replica_transform.Translate(50.0, 0.0); - scoped_refptr<Layer> replica = Layer::Create(); + scoped_refptr<Layer> replica = Layer::Create(layer_settings()); replica->SetTransformOrigin(gfx::Point3F(50.f, 50.f, 0.f)); replica->SetPosition(gfx::Point()); replica->SetTransform(replica_transform); @@ -369,7 +376,8 @@ TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, gfx::Size picture_bounds(100, 100); CheckerContentLayerClient picture_client(picture_bounds, SK_ColorGREEN, true); - scoped_refptr<PictureLayer> picture = PictureLayer::Create(&picture_client); + scoped_refptr<PictureLayer> picture = + PictureLayer::Create(layer_settings(), &picture_client); picture->SetBounds(picture_bounds); picture->SetIsDrawable(true); @@ -384,7 +392,8 @@ TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, gfx::Size mask_bounds(100, 100); CircleContentLayerClient mask_client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&mask_client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &mask_client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); @@ -417,14 +426,14 @@ TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, CheckerContentLayerClient picture_client_vertical( picture_bounds, SK_ColorGREEN, true); scoped_refptr<PictureLayer> picture_vertical = - PictureLayer::Create(&picture_client_vertical); + PictureLayer::Create(layer_settings(), &picture_client_vertical); picture_vertical->SetBounds(picture_bounds); picture_vertical->SetIsDrawable(true); CheckerContentLayerClient picture_client_horizontal( picture_bounds, SK_ColorMAGENTA, false); scoped_refptr<PictureLayer> picture_horizontal = - PictureLayer::Create(&picture_client_horizontal); + PictureLayer::Create(layer_settings(), &picture_client_horizontal); picture_horizontal->SetBounds(picture_bounds); picture_horizontal->SetIsDrawable(true); picture_horizontal->SetContentsOpaque(false); @@ -435,7 +444,8 @@ TEST_P(LayerTreeHostMasksForBackgroundFiltersPixelTest, gfx::Size mask_bounds(128, 128); CircleContentLayerClient mask_client(mask_bounds); - scoped_refptr<PictureLayer> mask = PictureLayer::Create(&mask_client); + scoped_refptr<PictureLayer> mask = + PictureLayer::Create(layer_settings(), &mask_client); mask->SetBounds(mask_bounds); mask->SetIsDrawable(true); mask->SetIsMask(true); diff --git a/cc/trees/layer_tree_host_pixeltest_readback.cc b/cc/trees/layer_tree_host_pixeltest_readback.cc index b372904..6af0bb2 100644 --- a/cc/trees/layer_tree_host_pixeltest_readback.cc +++ b/cc/trees/layer_tree_host_pixeltest_readback.cc @@ -485,18 +485,18 @@ class LayerTreeHostReadbackDeviceScalePixelTest TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackSubrect) { scoped_refptr<FakePictureLayer> background = - FakePictureLayer::Create(&white_client_); + FakePictureLayer::Create(layer_settings(), &white_client_); background->SetBounds(gfx::Size(100, 100)); background->SetIsDrawable(true); scoped_refptr<FakePictureLayer> green = - FakePictureLayer::Create(&green_client_); + FakePictureLayer::Create(layer_settings(), &green_client_); green->SetBounds(gfx::Size(100, 100)); green->SetIsDrawable(true); background->AddChild(green); scoped_refptr<FakePictureLayer> blue = - FakePictureLayer::Create(&blue_client_); + FakePictureLayer::Create(layer_settings(), &blue_client_); blue->SetPosition(gfx::Point(50, 50)); blue->SetBounds(gfx::Size(25, 25)); blue->SetIsDrawable(true); @@ -512,19 +512,19 @@ TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackSubrect) { TEST_P(LayerTreeHostReadbackDeviceScalePixelTest, ReadbackNonRootLayerSubrect) { scoped_refptr<FakePictureLayer> background = - FakePictureLayer::Create(&white_client_); + FakePictureLayer::Create(layer_settings(), &white_client_); background->SetBounds(gfx::Size(100, 100)); background->SetIsDrawable(true); scoped_refptr<FakePictureLayer> green = - FakePictureLayer::Create(&green_client_); + FakePictureLayer::Create(layer_settings(), &green_client_); green->SetPosition(gfx::Point(10, 20)); green->SetBounds(gfx::Size(90, 80)); green->SetIsDrawable(true); background->AddChild(green); scoped_refptr<FakePictureLayer> blue = - FakePictureLayer::Create(&blue_client_); + FakePictureLayer::Create(layer_settings(), &blue_client_); blue->SetPosition(gfx::Point(50, 50)); blue->SetBounds(gfx::Size(25, 25)); blue->SetIsDrawable(true); diff --git a/cc/trees/layer_tree_host_pixeltest_synchronous.cc b/cc/trees/layer_tree_host_pixeltest_synchronous.cc index 46591e5..f61703f 100644 --- a/cc/trees/layer_tree_host_pixeltest_synchronous.cc +++ b/cc/trees/layer_tree_host_pixeltest_synchronous.cc @@ -37,7 +37,8 @@ TEST_F(LayerTreeHostSynchronousPixelTest, OneContentLayer) { SkPaint green_paint; green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); client.add_draw_rect(gfx::RectF(bounds), green_paint); - scoped_refptr<PictureLayer> root = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> root = + PictureLayer::Create(layer_settings(), &client); root->SetBounds(bounds); root->SetIsDrawable(true); @@ -67,7 +68,8 @@ TEST_F(LayerTreeHostSynchronousGPUPixelTest, OneContentLayer) { SkPaint green_paint; green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); client.add_draw_rect(gfx::RectF(bounds), green_paint); - scoped_refptr<PictureLayer> root = PictureLayer::Create(&client); + scoped_refptr<PictureLayer> root = + PictureLayer::Create(layer_settings(), &client); root->SetBounds(bounds); root->SetIsDrawable(true); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 14b182a..1b14eb6 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -203,7 +203,7 @@ class LayerTreeHostTestReadyToActivateNonEmpty void SetupTree() override { client_.set_fill_with_nonsolid_color(true); scoped_refptr<FakePictureLayer> root_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root_layer->SetBounds(gfx::Size(1024, 1024)); root_layer->SetIsDrawable(true); @@ -273,7 +273,7 @@ class LayerTreeHostTestReadyToDrawNonEmpty void SetupTree() override { client_.set_fill_with_nonsolid_color(true); scoped_refptr<FakePictureLayer> root_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root_layer->SetBounds(gfx::Size(1024, 1024)); root_layer->SetIsDrawable(true); @@ -368,7 +368,7 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit2); class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest { protected: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->CreateRenderSurface(); root->SetBounds(gfx::Size(10, 10)); layer_tree_host()->SetRootLayer(root); @@ -503,9 +503,9 @@ class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { void BeginTest() override { if (layer_tree_host()->settings().impl_side_painting) - root_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - root_layer_ = ContentLayer::Create(&client_); + root_layer_ = ContentLayer::Create(layer_settings(), &client_); root_layer_->SetIsDrawable(true); root_layer_->SetBounds(bounds_); layer_tree_host()->SetRootLayer(root_layer_); @@ -563,7 +563,7 @@ class LayerTreeHostTestGpuRasterDeviceSizeChanged : public LayerTreeHostTest { void BeginTest() override { client_.set_fill_with_nonsolid_color(true); - root_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); root_layer_->SetIsDrawable(true); gfx::Transform transform; // Translate the layer out of the viewport to force it to not update its @@ -641,14 +641,14 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { } void SetupTree() override { - root_layer_ = Layer::Create(); + root_layer_ = Layer::Create(layer_settings()); root_layer_->SetBounds(gfx::Size(10, 20)); root_layer_->CreateRenderSurface(); if (layer_tree_host()->settings().impl_side_painting) - scaled_layer_ = FakePictureLayer::Create(&client_); + scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - scaled_layer_ = FakeContentLayer::Create(&client_); + scaled_layer_ = FakeContentLayer::Create(layer_settings(), &client_); scaled_layer_->SetBounds(gfx::Size(1, 1)); root_layer_->AddChild(scaled_layer_); @@ -695,14 +695,14 @@ class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate } void SetupTree() override { - root_layer_ = Layer::Create(); + root_layer_ = Layer::Create(layer_settings()); root_layer_->SetBounds(gfx::Size(10, 20)); root_layer_->CreateRenderSurface(); bool paint_scrollbar = true; bool has_thumb = false; scrollbar_ = FakePaintedScrollbarLayer::Create( - paint_scrollbar, has_thumb, root_layer_->id()); + layer_settings(), paint_scrollbar, has_thumb, root_layer_->id()); scrollbar_->SetPosition(gfx::Point(0, 10)); scrollbar_->SetBounds(gfx::Size(10, 10)); @@ -753,9 +753,9 @@ class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { void BeginTest() override { if (layer_tree_host()->settings().impl_side_painting) - root_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - root_layer_ = ContentLayer::Create(&client_); + root_layer_ = ContentLayer::Create(layer_settings(), &client_); root_layer_->SetIsDrawable(true); root_layer_->SetBounds(bounds_); layer_tree_host()->SetRootLayer(root_layer_); @@ -853,9 +853,9 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { void SetupTree() override { if (layer_tree_host()->settings().impl_side_painting) - root_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - root_layer_ = ContentLayer::Create(&client_); + root_layer_ = ContentLayer::Create(layer_settings(), &client_); root_layer_->SetIsDrawable(true); root_layer_->SetBounds(gfx::Size(50, 50)); layer_tree_host()->SetRootLayer(root_layer_); @@ -863,17 +863,17 @@ class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { // The initially transparent layer has a larger child layer, which is // not initially drawn because of the this (parent) layer. if (layer_tree_host()->settings().impl_side_painting) - parent_layer_ = FakePictureLayer::Create(&client_); + parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - parent_layer_ = FakeContentLayer::Create(&client_); + parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_); parent_layer_->SetBounds(gfx::Size(15, 15)); parent_layer_->SetOpacity(0.0f); root_layer_->AddChild(parent_layer_); if (layer_tree_host()->settings().impl_side_painting) - child_layer_ = FakePictureLayer::Create(&client_); + child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - child_layer_ = FakeContentLayer::Create(&client_); + child_layer_ = FakeContentLayer::Create(layer_settings(), &client_); child_layer_->SetBounds(gfx::Size(25, 25)); parent_layer_->AddChild(child_layer_); @@ -957,15 +957,15 @@ class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { scoped_ptr<FakePicturePile> pile( new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, ImplSidePaintingSettings().default_tile_grid_size)); - root_layer_ = - FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); + root_layer_ = FakePictureLayer::CreateWithRecordingSource( + layer_settings(), &client_, pile.Pass()); root_layer_->SetBounds(gfx::Size(50, 50)); pile.reset( new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, ImplSidePaintingSettings().default_tile_grid_size)); - child_layer_ = - FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); + child_layer_ = FakePictureLayer::CreateWithRecordingSource( + layer_settings(), &client_, pile.Pass()); child_layer_->SetBounds(gfx::Size(25, 25)); child_layer_->SetIsDrawable(true); child_layer_->SetContentsOpaque(true); @@ -1060,7 +1060,7 @@ class LayerTreeHostTestUndrawnLayersPushContentBoundsLater : public LayerTreeHostTest { public: LayerTreeHostTestUndrawnLayersPushContentBoundsLater() - : root_layer_(Layer::Create()) {} + : root_layer_(Layer::Create(layer_settings())) {} void SetupTree() override { root_layer_->CreateRenderSurface(); @@ -1068,12 +1068,12 @@ class LayerTreeHostTestUndrawnLayersPushContentBoundsLater root_layer_->SetBounds(gfx::Size(20, 20)); layer_tree_host()->SetRootLayer(root_layer_); - parent_layer_ = Layer::Create(); + parent_layer_ = Layer::Create(layer_settings()); parent_layer_->SetBounds(gfx::Size(20, 20)); parent_layer_->SetOpacity(0.0f); root_layer_->AddChild(parent_layer_); - child_layer_ = Layer::Create(); + child_layer_ = Layer::Create(layer_settings()); child_layer_->SetBounds(gfx::Size(15, 15)); parent_layer_->AddChild(child_layer_); @@ -1271,7 +1271,8 @@ class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { void SetupTree() override { LayerTreeHostTest::SetupTree(); - scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(&client_); + scoped_refptr<FakePictureLayer> layer = + FakePictureLayer::Create(layer_settings(), &client_); layer->set_always_update_resources(true); scroll_layer_ = layer; @@ -1392,8 +1393,10 @@ class TestOpacityChangeLayerDelegate : public ContentLayerClient { class ContentLayerWithUpdateTracking : public ContentLayer { public: static scoped_refptr<ContentLayerWithUpdateTracking> Create( + const LayerSettings& settings, ContentLayerClient* client) { - return make_scoped_refptr(new ContentLayerWithUpdateTracking(client)); + return make_scoped_refptr( + new ContentLayerWithUpdateTracking(settings, client)); } int PaintContentsCount() { return paint_contents_count_; } @@ -1407,8 +1410,9 @@ class ContentLayerWithUpdateTracking : public ContentLayer { } private: - explicit ContentLayerWithUpdateTracking(ContentLayerClient* client) - : ContentLayer(client), paint_contents_count_(0) { + ContentLayerWithUpdateTracking(const LayerSettings& settings, + ContentLayerClient* client) + : ContentLayer(settings, client), paint_contents_count_(0) { SetBounds(gfx::Size(10, 10)); SetIsDrawable(true); } @@ -1425,14 +1429,14 @@ class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { void BeginTest() override { if (layer_tree_host()->settings().impl_side_painting) { - update_check_picture_layer_ = - FakePictureLayer::Create(&test_opacity_change_delegate_); + update_check_picture_layer_ = FakePictureLayer::Create( + layer_settings(), &test_opacity_change_delegate_); test_opacity_change_delegate_.SetTestLayer( update_check_picture_layer_.get()); is_impl_paint_ = true; } else { update_check_content_layer_ = ContentLayerWithUpdateTracking::Create( - &test_opacity_change_delegate_); + layer_settings(), &test_opacity_change_delegate_); test_opacity_change_delegate_.SetTestLayer( update_check_content_layer_.get()); is_impl_paint_ = false; @@ -1477,8 +1481,8 @@ class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers void BeginTest() override { client_.set_fill_with_nonsolid_color(true); - root_layer_ = FakePictureLayer::Create(&client_); - child_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); + child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); layer_tree_host()->SetDeviceScaleFactor(1.5); @@ -1586,13 +1590,13 @@ class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest { } void SetupTree() override { - layer_ = FakeContentLayer::Create(&client_); + layer_ = FakeContentLayer::Create(layer_settings(), &client_); layer_->SetBounds(gfx::Size(10, 20)); bool paint_scrollbar = true; bool has_thumb = false; scrollbar_ = FakePaintedScrollbarLayer::Create( - paint_scrollbar, has_thumb, layer_->id()); + layer_settings(), paint_scrollbar, has_thumb, layer_->id()); scrollbar_->SetPosition(gfx::Point(0, 10)); scrollbar_->SetBounds(gfx::Size(10, 10)); @@ -1761,10 +1765,10 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate } void SetupTree() override { - parent_ = FakeContentLayer::Create(&client_); + parent_ = FakeContentLayer::Create(layer_settings(), &client_); parent_->SetBounds(gfx::Size(10, 20)); - child_ = FakeContentLayer::Create(&client_); + child_ = FakeContentLayer::Create(layer_settings(), &client_); child_->SetPosition(gfx::Point(0, 10)); child_->SetBounds(gfx::Size(3, 10)); @@ -1927,25 +1931,25 @@ class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit : public LayerTreeHostTest { protected: void SetupTree() override { - root_layer_ = FakeContentLayer::Create(&client_); + root_layer_ = FakeContentLayer::Create(layer_settings(), &client_); root_layer_->SetBounds(gfx::Size(100, 100)); - surface_layer1_ = FakeContentLayer::Create(&client_); + surface_layer1_ = FakeContentLayer::Create(layer_settings(), &client_); surface_layer1_->SetBounds(gfx::Size(100, 100)); surface_layer1_->SetForceRenderSurface(true); surface_layer1_->SetOpacity(0.5f); root_layer_->AddChild(surface_layer1_); - surface_layer2_ = FakeContentLayer::Create(&client_); + surface_layer2_ = FakeContentLayer::Create(layer_settings(), &client_); surface_layer2_->SetBounds(gfx::Size(100, 100)); surface_layer2_->SetForceRenderSurface(true); surface_layer2_->SetOpacity(0.5f); surface_layer1_->AddChild(surface_layer2_); - replica_layer1_ = FakeContentLayer::Create(&client_); + replica_layer1_ = FakeContentLayer::Create(layer_settings(), &client_); surface_layer1_->SetReplicaLayer(replica_layer1_.get()); - replica_layer2_ = FakeContentLayer::Create(&client_); + replica_layer2_ = FakeContentLayer::Create(layer_settings(), &client_); surface_layer2_->SetReplicaLayer(replica_layer2_.get()); layer_tree_host()->SetRootLayer(root_layer_); @@ -2016,8 +2020,9 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( class EvictionTestLayer : public Layer { public: - static scoped_refptr<EvictionTestLayer> Create() { - return make_scoped_refptr(new EvictionTestLayer()); + static scoped_refptr<EvictionTestLayer> Create( + const LayerSettings& settings) { + return make_scoped_refptr(new EvictionTestLayer(settings)); } bool Update(ResourceUpdateQueue*, const OcclusionTracker<Layer>*) override; @@ -2032,7 +2037,7 @@ class EvictionTestLayer : public Layer { } private: - EvictionTestLayer() : Layer() {} + explicit EvictionTestLayer(const LayerSettings& settings) : Layer(settings) {} ~EvictionTestLayer() override {} void CreateTextureIfNeeded() { @@ -2107,7 +2112,7 @@ void EvictionTestLayer::PushPropertiesTo(LayerImpl* layer_impl) { class LayerTreeHostTestEvictTextures : public LayerTreeHostTest { public: LayerTreeHostTestEvictTextures() - : layer_(EvictionTestLayer::Create()), + : layer_(EvictionTestLayer::Create(layer_settings())), impl_for_evict_textures_(0), num_commits_(0) {} @@ -2243,9 +2248,9 @@ class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); if (layer_tree_host()->settings().impl_side_painting) - layer_ = FakePictureLayer::Create(&client_); + layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - layer_ = FakeContentLayer::Create(&client_); + layer_ = FakeContentLayer::Create(layer_settings(), &client_); layer_->SetBounds(gfx::Size(10, 10)); layer_->SetPosition(gfx::PointF(0.f, 0.f)); @@ -2589,9 +2594,9 @@ class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted : public LayerTreeHostTest { public: LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() - : root_layer_(FakeContentLayer::Create(&client_)), - child_layer1_(FakeContentLayer::Create(&client_)), - child_layer2_(FakeContentLayer::Create(&client_)), + : root_layer_(FakeContentLayer::Create(layer_settings(), &client_)), + child_layer1_(FakeContentLayer::Create(layer_settings(), &client_)), + child_layer2_(FakeContentLayer::Create(layer_settings(), &client_)), num_commits_(0) {} void BeginTest() override { @@ -2671,7 +2676,8 @@ class LayerTreeHostTestLCDChange : public LayerTreeHostTest { void SetupTree() override { num_tiles_rastered_ = 0; - scoped_refptr<Layer> root_layer = PictureLayer::Create(&client_); + scoped_refptr<Layer> root_layer = + PictureLayer::Create(layer_settings(), &client_); client_.set_fill_with_nonsolid_color(true); root_layer->SetIsDrawable(true); root_layer->SetBounds(gfx::Size(10, 10)); @@ -2903,7 +2909,8 @@ class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation void SetupTree() override { LayerTreeHostTest::SetupTree(); - scoped_refptr<Layer> layer = PictureLayer::Create(&client_); + scoped_refptr<Layer> layer = + PictureLayer::Create(layer_settings(), &client_); layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); layer->SetBounds(gfx::Size(10, 10)); layer_tree_host()->root_layer()->AddChild(layer); @@ -2955,10 +2962,12 @@ class LayerTreeHostTestChangeLayerPropertiesInPaintContents void SetupTree() override { if (layer_tree_host()->settings().impl_side_painting) { - scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_); + scoped_refptr<PictureLayer> root_layer = + PictureLayer::Create(layer_settings(), &client_); layer_tree_host()->SetRootLayer(root_layer); } else { - scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_); + scoped_refptr<ContentLayer> root_layer = + ContentLayer::Create(layer_settings(), &client_); layer_tree_host()->SetRootLayer(root_layer); } Layer* root_layer = layer_tree_host()->root_layer(); @@ -3042,7 +3051,8 @@ class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest { io_surface_id_ = 9; io_surface_size_ = gfx::Size(6, 7); - scoped_refptr<IOSurfaceLayer> io_surface_layer = IOSurfaceLayer::Create(); + scoped_refptr<IOSurfaceLayer> io_surface_layer = + IOSurfaceLayer::Create(layer_settings()); io_surface_layer->SetBounds(gfx::Size(10, 10)); io_surface_layer->SetIsDrawable(true); io_surface_layer->SetContentsOpaque(true); @@ -3195,16 +3205,16 @@ TEST_F(LayerTreeHostTestNumFramesPending, DISABLED_GLRenderer) { class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { public: void SetupTree() override { - root_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); root_layer_->SetIsDrawable(true); root_layer_->SetBounds(gfx::Size(50, 50)); - parent_layer_ = FakePictureLayer::Create(&client_); + parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); parent_layer_->SetIsDrawable(true); parent_layer_->SetBounds(gfx::Size(50, 50)); parent_layer_->SetForceRenderSurface(true); - child_layer_ = FakePictureLayer::Create(&client_); + child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); child_layer_->SetIsDrawable(true); child_layer_->SetBounds(gfx::Size(50, 50)); @@ -3421,8 +3431,9 @@ class PushPropertiesCountingLayerImpl : public LayerImpl { class PushPropertiesCountingLayer : public Layer { public: - static scoped_refptr<PushPropertiesCountingLayer> Create() { - return new PushPropertiesCountingLayer(); + static scoped_refptr<PushPropertiesCountingLayer> Create( + const LayerSettings& settings) { + return new PushPropertiesCountingLayer(settings); } void PushPropertiesTo(LayerImpl* layer) override { @@ -3449,8 +3460,10 @@ class PushPropertiesCountingLayer : public Layer { } private: - PushPropertiesCountingLayer() - : push_properties_count_(0), persist_needs_push_properties_(false) { + explicit PushPropertiesCountingLayer(const LayerSettings& settings) + : Layer(settings), + push_properties_count_(0), + persist_needs_push_properties_(false) { SetBounds(gfx::Size(1, 1)); } ~PushPropertiesCountingLayer() override {} @@ -3473,12 +3486,13 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { } void SetupTree() override { - root_ = PushPropertiesCountingLayer::Create(); + root_ = PushPropertiesCountingLayer::Create(layer_settings()); root_->CreateRenderSurface(); - child_ = PushPropertiesCountingLayer::Create(); - child2_ = PushPropertiesCountingLayer::Create(); - grandchild_ = PushPropertiesCountingLayer::Create(); - leaf_always_pushing_layer_ = PushPropertiesCountingLayer::Create(); + child_ = PushPropertiesCountingLayer::Create(layer_settings()); + child2_ = PushPropertiesCountingLayer::Create(layer_settings()); + grandchild_ = PushPropertiesCountingLayer::Create(layer_settings()); + leaf_always_pushing_layer_ = + PushPropertiesCountingLayer::Create(layer_settings()); leaf_always_pushing_layer_->set_persist_needs_push_properties(true); root_->AddChild(child_); @@ -3486,7 +3500,7 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { child_->AddChild(grandchild_); child2_->AddChild(leaf_always_pushing_layer_); - other_root_ = PushPropertiesCountingLayer::Create(); + other_root_ = PushPropertiesCountingLayer::Create(layer_settings()); other_root_->CreateRenderSurface(); // Don't set the root layer here. @@ -3865,14 +3879,14 @@ class LayerTreeHostTestPropertyChangesDuringUpdateArePushed void BeginTest() override { PostSetNeedsCommitToMainThread(); } void SetupTree() override { - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->CreateRenderSurface(); root_->SetBounds(gfx::Size(1, 1)); bool paint_scrollbar = true; bool has_thumb = false; scrollbar_layer_ = FakePaintedScrollbarLayer::Create( - paint_scrollbar, has_thumb, root_->id()); + layer_settings(), paint_scrollbar, has_thumb, root_->id()); root_->AddChild(scrollbar_layer_); @@ -3922,9 +3936,9 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { void BeginTest() override { PostSetNeedsCommitToMainThread(); } void SetupTree() override { - root_ = PushPropertiesCountingLayer::Create(); + root_ = PushPropertiesCountingLayer::Create(layer_settings()); root_->CreateRenderSurface(); - child_ = PushPropertiesCountingLayer::Create(); + child_ = PushPropertiesCountingLayer::Create(layer_settings()); root_->AddChild(child_); layer_tree_host()->SetRootLayer(root_); @@ -3984,12 +3998,12 @@ class LayerTreeHostTestCasePushPropertiesThreeGrandChildren } void SetupTree() override { - root_ = PushPropertiesCountingLayer::Create(); + root_ = PushPropertiesCountingLayer::Create(layer_settings()); root_->CreateRenderSurface(); - child_ = PushPropertiesCountingLayer::Create(); - grandchild1_ = PushPropertiesCountingLayer::Create(); - grandchild2_ = PushPropertiesCountingLayer::Create(); - grandchild3_ = PushPropertiesCountingLayer::Create(); + child_ = PushPropertiesCountingLayer::Create(layer_settings()); + grandchild1_ = PushPropertiesCountingLayer::Create(layer_settings()); + grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings()); + grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings()); root_->AddChild(child_); child_->AddChild(grandchild1_); @@ -4497,8 +4511,8 @@ class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw { public: void SetupTree() override { LayerTreeHostTest::SetupTree(); - scoped_refptr<VideoLayer> video_layer = - VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0); + scoped_refptr<VideoLayer> video_layer = VideoLayer::Create( + layer_settings(), &provider_, media::VIDEO_ROTATION_0); video_layer->SetBounds(gfx::Size(10, 10)); video_layer->SetIsDrawable(true); layer_tree_host()->root_layer()->AddChild(video_layer); @@ -4520,7 +4534,8 @@ class LayerTreeHostTestIOSurfaceLayerInvalidate public: void SetupTree() override { LayerTreeHostTest::SetupTree(); - scoped_refptr<IOSurfaceLayer> layer = IOSurfaceLayer::Create(); + scoped_refptr<IOSurfaceLayer> layer = + IOSurfaceLayer::Create(layer_settings()); layer->SetBounds(gfx::Size(10, 10)); uint32_t fake_io_surface_id = 7; layer->SetIOSurfaceProperties(fake_io_surface_id, layer->bounds()); @@ -4538,18 +4553,18 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { protected: void SetupTree() override { - root_layer_ = Layer::Create(); + root_layer_ = Layer::Create(layer_settings()); root_layer_->CreateRenderSurface(); root_layer_->SetPosition(gfx::Point()); root_layer_->SetBounds(gfx::Size(10, 10)); - parent_layer_ = SolidColorLayer::Create(); + parent_layer_ = SolidColorLayer::Create(layer_settings()); parent_layer_->SetPosition(gfx::Point()); parent_layer_->SetBounds(gfx::Size(10, 10)); parent_layer_->SetIsDrawable(true); root_layer_->AddChild(parent_layer_); - child_layer_ = SolidColorLayer::Create(); + child_layer_ = SolidColorLayer::Create(layer_settings()); child_layer_->SetPosition(gfx::Point()); child_layer_->SetBounds(gfx::Size(10, 10)); child_layer_->SetIsDrawable(true); @@ -4609,7 +4624,7 @@ class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { } void SetupTree() override { - root_layer_ = FakePictureLayer::Create(&client_); + root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); root_layer_->SetBounds(gfx::Size(10, 10)); layer_tree_host()->SetRootLayer(root_layer_); @@ -4645,7 +4660,8 @@ class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { protected: void SetupTree() override { - scoped_refptr<SolidColorLayer> root_layer = SolidColorLayer::Create(); + scoped_refptr<SolidColorLayer> root_layer = + SolidColorLayer::Create(layer_settings()); root_layer->SetBounds(gfx::Size(200, 200)); root_layer->SetIsDrawable(true); root_layer->CreateRenderSurface(); @@ -4721,7 +4737,7 @@ class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest { void SetupTree() override { client_.set_fill_with_nonsolid_color(true); scoped_refptr<FakePictureLayer> root_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root_layer->SetBounds(gfx::Size(1024, 1024)); root_layer->SetIsDrawable(true); @@ -4876,9 +4892,9 @@ class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface void SetupTree() override { if (layer_tree_host()->settings().impl_side_painting) - root_ = FakePictureLayer::Create(&client_); + root_ = FakePictureLayer::Create(layer_settings(), &client_); else - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); layer_tree_host()->SetRootLayer(root_); LayerTreeHostTest::SetupTree(); @@ -5080,7 +5096,7 @@ class LayerTreeHostTestKeepSwapPromise : public LayerTreeTest { LayerTreeHostTestKeepSwapPromise() {} void BeginTest() override { - layer_ = SolidColorLayer::Create(); + layer_ = SolidColorLayer::Create(layer_settings()); layer_->SetIsDrawable(true); layer_->SetBounds(gfx::Size(10, 10)); layer_tree_host()->SetRootLayer(layer_); @@ -5399,7 +5415,8 @@ class LayerTreeHostTestGpuRasterizationDefault : public LayerTreeHostTest { void SetupTree() override { LayerTreeHostTest::SetupTree(); - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(layer_settings(), &layer_client_); layer->SetBounds(gfx::Size(10, 10)); layer->SetIsDrawable(true); layer_tree_host()->root_layer()->AddChild(layer); @@ -5453,7 +5470,8 @@ class LayerTreeHostTestGpuRasterizationEnabled : public LayerTreeHostTest { void SetupTree() override { LayerTreeHostTest::SetupTree(); - scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_); + scoped_refptr<PictureLayer> layer = + PictureLayer::Create(layer_settings(), &layer_client_); layer->SetBounds(gfx::Size(10, 10)); layer->SetIsDrawable(true); layer_tree_host()->root_layer()->AddChild(layer); @@ -5517,7 +5535,7 @@ class LayerTreeHostTestGpuRasterizationForced : public LayerTreeHostTest { LayerTreeHostTest::SetupTree(); scoped_refptr<FakePictureLayer> layer = - FakePictureLayer::Create(&layer_client_); + FakePictureLayer::Create(layer_settings(), &layer_client_); layer->SetBounds(gfx::Size(10, 10)); layer->SetIsDrawable(true); layer_tree_host()->root_layer()->AddChild(layer); @@ -5577,15 +5595,16 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest { enum { kExpectedNumCommits = 10 }; void SetupTree() override { - scoped_refptr<Layer> root_layer = Layer::Create(); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); root_layer->SetBounds(bounds_); root_layer->CreateRenderSurface(); if (layer_tree_host()->settings().impl_side_painting) { - picture_layer_ = FakePictureLayer::Create(&client_); + picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); child_layer_ = picture_layer_.get(); } else { - content_layer_ = ContentLayerWithUpdateTracking::Create(&client_); + content_layer_ = + ContentLayerWithUpdateTracking::Create(layer_settings(), &client_); child_layer_ = content_layer_.get(); } child_layer_->SetBounds(bounds_); @@ -5986,10 +6005,10 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { posted_ = false; client_.set_fill_with_nonsolid_color(true); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(500, 500)); - scoped_refptr<Layer> pinch = Layer::Create(); + scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); pinch->SetBounds(gfx::Size(500, 500)); pinch->SetScrollClipLayerId(root->id()); pinch->SetIsContainerForFixedPositionLayers(true); @@ -6000,7 +6019,8 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { ImplSidePaintingSettings().default_tile_grid_size)); pile->SetPlaybackAllowedEvent(&playback_allowed_event_); scoped_refptr<FakePictureLayer> layer = - FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); + FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, + pile.Pass()); layer->SetBounds(gfx::Size(500, 500)); layer->SetContentsOpaque(true); // Avoid LCD text on the layer so we don't cause extra commits when we @@ -6197,14 +6217,15 @@ class RasterizeWithGpuRasterizationCreatesResources : public LayerTreeHostTest { void SetupTree() override { client_.set_fill_with_nonsolid_color(true); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(500, 500)); scoped_ptr<FakePicturePile> pile( new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, ImplSidePaintingSettings().default_tile_grid_size)); scoped_refptr<FakePictureLayer> layer = - FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); + FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, + pile.Pass()); layer->SetBounds(gfx::Size(500, 500)); layer->SetContentsOpaque(true); root->AddChild(layer); @@ -6246,7 +6267,8 @@ class GpuRasterizationRasterizesBorderTiles : public LayerTreeHostTest { new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, ImplSidePaintingSettings().default_tile_grid_size)); scoped_refptr<FakePictureLayer> root = - FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); + FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, + pile.Pass()); root->SetBounds(gfx::Size(10000, 10000)); root->SetContentsOpaque(true); @@ -6289,10 +6311,10 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles continuous_draws_ = 0; client_.set_fill_with_nonsolid_color(true); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(500, 500)); - scoped_refptr<Layer> pinch = Layer::Create(); + scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); pinch->SetBounds(gfx::Size(500, 500)); pinch->SetScrollClipLayerId(root->id()); pinch->SetIsContainerForFixedPositionLayers(true); @@ -6303,7 +6325,8 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles ImplSidePaintingSettings().default_tile_grid_size)); pile->SetPlaybackAllowedEvent(&playback_allowed_event_); scoped_refptr<FakePictureLayer> layer = - FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); + FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, + pile.Pass()); layer->SetBounds(gfx::Size(500, 500)); layer->SetContentsOpaque(true); // Avoid LCD text on the layer so we don't cause extra commits when we @@ -6462,7 +6485,7 @@ class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { void SetupTree() override { client_.set_fill_with_nonsolid_color(true); scoped_refptr<FakePictureLayer> root_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root_layer->SetBounds(gfx::Size(1500, 1500)); root_layer->SetIsDrawable(true); @@ -6517,12 +6540,12 @@ class LayerTreeHostTestFrameTimingRequestsSaveTimestamps void SetupTree() override { scoped_refptr<FakePictureLayer> root_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root_layer->SetBounds(gfx::Size(200, 200)); root_layer->SetIsDrawable(true); scoped_refptr<FakePictureLayer> child_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); child_layer->SetBounds(gfx::Size(1500, 1500)); child_layer->SetIsDrawable(true); @@ -6603,7 +6626,7 @@ class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { void SetupTree() override { client_.set_fill_with_nonsolid_color(true); scoped_refptr<FakePictureLayer> root_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root_layer->SetBounds(gfx::Size(150, 150)); root_layer->SetIsDrawable(true); @@ -6683,10 +6706,10 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); class LayerPreserveRenderSurfaceFromOutputRequests : public LayerTreeHostTest { protected: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->CreateRenderSurface(); root->SetBounds(gfx::Size(10, 10)); - child_ = Layer::Create(); + child_ = Layer::Create(layer_settings()); child_->SetBounds(gfx::Size(20, 20)); root->AddChild(child_); @@ -6758,8 +6781,8 @@ SINGLE_AND_MULTI_THREAD_TEST_F(LayerPreserveRenderSurfaceFromOutputRequests); class LayerTreeHostTestUpdateCopyRequests : public LayerTreeHostTest { protected: void SetupTree() override { - root = Layer::Create(); - child = Layer::Create(); + root = Layer::Create(layer_settings()); + child = Layer::Create(layer_settings()); root->AddChild(child); layer_tree_host()->SetRootLayer(root); LayerTreeHostTest::SetupTree(); @@ -6801,21 +6824,21 @@ class LayerTreeTestMaskLayerForSurfaceWithClippedLayer : public LayerTreeTest { // the surface bounds to be larger. It also has a parent that clips the // masked layer and its surface. - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); - scoped_refptr<Layer> clipping_layer = Layer::Create(); + scoped_refptr<Layer> clipping_layer = Layer::Create(layer_settings()); root->AddChild(clipping_layer); scoped_refptr<FakePictureLayer> content_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); clipping_layer->AddChild(content_layer); scoped_refptr<FakePictureLayer> content_child_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); content_layer->AddChild(content_child_layer); scoped_refptr<FakePictureLayer> mask_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); content_layer->SetMaskLayer(mask_layer.get()); gfx::Size root_size(100, 100); @@ -6895,17 +6918,17 @@ class LayerTreeTestMaskLayerWithScaling : public LayerTreeTest { // +-- Content Layer // +--Mask - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); - scoped_refptr<Layer> scaling_layer = Layer::Create(); + scoped_refptr<Layer> scaling_layer = Layer::Create(layer_settings()); root->AddChild(scaling_layer); scoped_refptr<FakePictureLayer> content_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); scaling_layer->AddChild(content_layer); scoped_refptr<FakePictureLayer> mask_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); content_layer->SetMaskLayer(mask_layer.get()); gfx::Size root_size(100, 100); @@ -6990,14 +7013,14 @@ class LayerTreeTestMaskLayerWithDifferentBounds : public LayerTreeTest { // The mask layer has bounds 100x100 but is attached to a layer with bounds // 50x50. - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<FakePictureLayer> content_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root->AddChild(content_layer); scoped_refptr<FakePictureLayer> mask_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); content_layer->SetMaskLayer(mask_layer.get()); gfx::Size root_size(100, 100); @@ -7078,17 +7101,17 @@ class LayerTreeTestReflectionMaskLayerWithDifferentBounds // The replica's mask layer has bounds 100x100 but the replica is of a // layer with bounds 50x50. - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<FakePictureLayer> content_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root->AddChild(content_layer); - scoped_refptr<Layer> replica_layer = Layer::Create(); + scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); content_layer->SetReplicaLayer(replica_layer.get()); scoped_refptr<FakePictureLayer> mask_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); replica_layer->SetMaskLayer(mask_layer.get()); gfx::Size root_size(100, 100); @@ -7171,20 +7194,20 @@ class LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild // The replica is of a layer with bounds 50x50, but it has a child that // causes the surface bounds to be larger. - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); scoped_refptr<FakePictureLayer> content_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); root->AddChild(content_layer); - content_child_layer_ = FakePictureLayer::Create(&client_); + content_child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); content_layer->AddChild(content_child_layer_); - scoped_refptr<Layer> replica_layer = Layer::Create(); + scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings()); content_layer->SetReplicaLayer(replica_layer.get()); scoped_refptr<FakePictureLayer> mask_layer = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); replica_layer->SetMaskLayer(mask_layer.get()); gfx::Size root_size(100, 100); diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index ddab640..6300622 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -231,7 +231,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - content_ = FakeContentLayer::Create(&client_); + content_ = FakeContentLayer::Create(layer_settings(), &client_); content_->SetBounds(gfx::Size(4, 4)); layer_tree_host()->root_layer()->AddChild(content_); } @@ -280,7 +280,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - content_ = FakeContentLayer::Create(&client_); + content_ = FakeContentLayer::Create(layer_settings(), &client_); content_->SetBounds(gfx::Size(4, 4)); content_->set_layer_animation_delegate(this); layer_tree_host()->root_layer()->AddChild(content_); @@ -360,8 +360,8 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity : public LayerTreeHostAnimationTest { public: LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity() - : update_check_layer_(FakeContentLayer::Create(&client_)) { - } + : update_check_layer_( + FakeContentLayer::Create(layer_settings(), &client_)) {} void SetupTree() override { update_check_layer_->SetOpacity(0.f); @@ -410,7 +410,7 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation void DidCommit() override { if (layer_tree_host()->source_frame_number() == 1) { - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings()); layer->set_layer_animation_delegate(this); // Any valid AnimationCurve will do here. @@ -558,7 +558,7 @@ class LayerTreeHostAnimationTestRunAnimationWhenNotCanDraw void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - content_ = FakeContentLayer::Create(&client_); + content_ = FakeContentLayer::Create(layer_settings(), &client_); content_->SetBounds(gfx::Size(4, 4)); content_->set_layer_animation_delegate(this); layer_tree_host()->root_layer()->AddChild(content_); @@ -598,7 +598,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations : public LayerTreeHostAnimationTest { void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - content_ = FakeContentLayer::Create(&client_); + content_ = FakeContentLayer::Create(layer_settings(), &client_); content_->SetBounds(gfx::Size(4, 4)); content_->set_layer_animation_delegate(this); layer_tree_host()->root_layer()->AddChild(content_); @@ -684,7 +684,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - scroll_layer_ = FakeContentLayer::Create(&client_); + scroll_layer_ = FakeContentLayer::Create(layer_settings(), &client_); scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); scroll_layer_->SetBounds(gfx::Size(1000, 1000)); scroll_layer_->SetScrollOffset(gfx::ScrollOffset(10, 20)); @@ -741,7 +741,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - scroll_layer_ = FakeContentLayer::Create(&client_); + scroll_layer_ = FakeContentLayer::Create(layer_settings(), &client_); scroll_layer_->SetScrollClipLayerId(layer_tree_host()->root_layer()->id()); scroll_layer_->SetBounds(gfx::Size(10000, 10000)); scroll_layer_->SetScrollOffset(gfx::ScrollOffset(100.0, 200.0)); @@ -860,7 +860,7 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers AddOpacityTransitionToLayer( layer_tree_host()->root_layer(), 1, 0.f, 0.5f, true); - scoped_refptr<Layer> layer = Layer::Create(); + scoped_refptr<Layer> layer = Layer::Create(layer_settings()); layer_tree_host()->root_layer()->AddChild(layer); layer->set_layer_animation_delegate(this); layer->SetBounds(gfx::Size(4, 4)); @@ -937,7 +937,7 @@ class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - content_ = Layer::Create(); + content_ = Layer::Create(layer_settings()); content_->SetBounds(gfx::Size(4, 4)); layer_tree_host()->root_layer()->AddChild(content_); AddOpacityTransitionToLayer(content_.get(), 10000.0, 0.1f, 0.9f, true); @@ -988,7 +988,7 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating void SetupTree() override { LayerTreeHostAnimationTest::SetupTree(); - content_ = Layer::Create(); + content_ = Layer::Create(layer_settings()); content_->SetBounds(gfx::Size(4, 4)); layer_tree_host()->root_layer()->AddChild(content_); } diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index c8bb8f0..bbacd61 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -543,7 +543,7 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent : public LayerTreeHostContextTestLostContextSucceeds { public: void SetupTree() override { - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->SetBounds(gfx::Size(10, 10)); root_->SetIsDrawable(true); @@ -553,9 +553,9 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); if (layer_tree_host()->settings().impl_side_painting) - layer_ = FakePictureLayer::Create(&client_); + layer_ = FakePictureLayer::Create(layer_settings(), &client_); else - layer_ = FakeContentLayer::Create(&client_); + layer_ = FakeContentLayer::Create(layer_settings(), &client_); layer_->SetBounds(gfx::Size(10, 10)); layer_->SetIsDrawable(true); @@ -644,11 +644,11 @@ class LayerTreeHostContextTestLostContextAndEvictTextures client_.add_draw_rect(gfx::Rect(0, 0, 5, 5), paint); if (layer_tree_host()->settings().impl_side_painting) { - picture_layer_ = FakePictureLayer::Create(&client_); + picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); picture_layer_->SetBounds(gfx::Size(10, 20)); layer_tree_host()->SetRootLayer(picture_layer_); } else { - content_layer_ = FakeContentLayer::Create(&client_); + content_layer_ = FakeContentLayer::Create(layer_settings(), &client_); content_layer_->SetBounds(gfx::Size(10, 20)); layer_tree_host()->SetRootLayer(content_layer_); } @@ -818,18 +818,18 @@ class LayerTreeHostContextTestLostContextWhileUpdatingResources void SetupTree() override { if (layer_tree_host()->settings().impl_side_painting) - parent_ = FakePictureLayer::Create(&client_); + parent_ = FakePictureLayer::Create(layer_settings(), &client_); else - parent_ = FakeContentLayer::Create(&client_); + parent_ = FakeContentLayer::Create(layer_settings(), &client_); parent_->SetBounds(gfx::Size(num_children_, 1)); for (int i = 0; i < num_children_; i++) { scoped_refptr<Layer> child; if (layer_tree_host()->settings().impl_side_painting) - child = FakePictureLayer::Create(&client_); + child = FakePictureLayer::Create(layer_settings(), &client_); else - child = FakeContentLayer::Create(&client_); + child = FakeContentLayer::Create(layer_settings(), &client_); child->SetPosition(gfx::PointF(i, 0.f)); child->SetBounds(gfx::Size(1, 1)); parent_->AddChild(child); @@ -865,13 +865,13 @@ class LayerTreeHostContextTestLayersNotified : public LayerTreeHostContextTest { void SetupTree() override { if (layer_tree_host()->settings().impl_side_painting) { - root_ = FakePictureLayer::Create(&client_); - child_ = FakePictureLayer::Create(&client_); - grandchild_ = FakePictureLayer::Create(&client_); + root_ = FakePictureLayer::Create(layer_settings(), &client_); + child_ = FakePictureLayer::Create(layer_settings(), &client_); + grandchild_ = FakePictureLayer::Create(layer_settings(), &client_); } else { - root_ = FakeContentLayer::Create(&client_); - child_ = FakeContentLayer::Create(&client_); - grandchild_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); + child_ = FakeContentLayer::Create(layer_settings(), &client_); + grandchild_ = FakeContentLayer::Create(layer_settings(), &client_); } root_->AddChild(child_); @@ -1018,26 +1018,28 @@ class LayerTreeHostContextTestDontUseLostResources gl->GenMailboxCHROMIUM(mailbox.name); GLuint sync_point = gl->InsertSyncPointCHROMIUM(); - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); scoped_refptr<FakeDelegatedRendererLayer> delegated = - FakeDelegatedRendererLayer::Create(delegated_frame_provider_.get()); + FakeDelegatedRendererLayer::Create(layer_settings(), + delegated_frame_provider_.get()); delegated->SetBounds(gfx::Size(10, 10)); delegated->SetIsDrawable(true); root->AddChild(delegated); scoped_refptr<Layer> layer; if (layer_tree_host()->settings().impl_side_painting) - layer = PictureLayer::Create(&client_); + layer = PictureLayer::Create(layer_settings(), &client_); else - layer = ContentLayer::Create(&client_); + layer = ContentLayer::Create(layer_settings(), &client_); layer->SetBounds(gfx::Size(10, 10)); layer->SetIsDrawable(true); root->AddChild(layer); - scoped_refptr<TextureLayer> texture = TextureLayer::CreateForMailbox(NULL); + scoped_refptr<TextureLayer> texture = + TextureLayer::CreateForMailbox(layer_settings_, NULL); texture->SetBounds(gfx::Size(10, 10)); texture->SetIsDrawable(true); texture->SetTextureMailbox( @@ -1049,35 +1051,35 @@ class LayerTreeHostContextTestDontUseLostResources scoped_refptr<Layer> mask; if (layer_tree_host()->settings().impl_side_painting) - mask = PictureLayer::Create(&client_); + mask = PictureLayer::Create(layer_settings_, &client_); else - mask = ContentLayer::Create(&client_); + mask = ContentLayer::Create(layer_settings_, &client_); mask->SetBounds(gfx::Size(10, 10)); scoped_refptr<Layer> layer_with_mask; if (layer_tree_host()->settings().impl_side_painting) - layer_with_mask = PictureLayer::Create(&client_); + layer_with_mask = PictureLayer::Create(layer_settings_, &client_); else - layer_with_mask = ContentLayer::Create(&client_); + layer_with_mask = ContentLayer::Create(layer_settings_, &client_); layer_with_mask->SetBounds(gfx::Size(10, 10)); layer_with_mask->SetIsDrawable(true); layer_with_mask->SetMaskLayer(mask.get()); root->AddChild(layer_with_mask); - scoped_refptr<VideoLayer> video_color = - VideoLayer::Create(&color_frame_provider_, media::VIDEO_ROTATION_0); + scoped_refptr<VideoLayer> video_color = VideoLayer::Create( + layer_settings_, &color_frame_provider_, media::VIDEO_ROTATION_0); video_color->SetBounds(gfx::Size(10, 10)); video_color->SetIsDrawable(true); root->AddChild(video_color); - scoped_refptr<VideoLayer> video_hw = - VideoLayer::Create(&hw_frame_provider_, media::VIDEO_ROTATION_0); + scoped_refptr<VideoLayer> video_hw = VideoLayer::Create( + layer_settings_, &hw_frame_provider_, media::VIDEO_ROTATION_0); video_hw->SetBounds(gfx::Size(10, 10)); video_hw->SetIsDrawable(true); root->AddChild(video_hw); - scoped_refptr<VideoLayer> video_scaled_hw = - VideoLayer::Create(&scaled_hw_frame_provider_, media::VIDEO_ROTATION_0); + scoped_refptr<VideoLayer> video_scaled_hw = VideoLayer::Create( + layer_settings_, &scaled_hw_frame_provider_, media::VIDEO_ROTATION_0); video_scaled_hw->SetBounds(gfx::Size(10, 10)); video_scaled_hw->SetIsDrawable(true); root->AddChild(video_scaled_hw); @@ -1101,7 +1103,8 @@ class LayerTreeHostContextTestDontUseLostResources if (!delegating_renderer()) { // TODO(danakj): IOSurface layer can not be transported. crbug.com/239335 - scoped_refptr<IOSurfaceLayer> io_surface = IOSurfaceLayer::Create(); + scoped_refptr<IOSurfaceLayer> io_surface = + IOSurfaceLayer::Create(layer_settings_); io_surface->SetBounds(gfx::Size(10, 10)); io_surface->SetIsDrawable(true); io_surface->SetIOSurfaceProperties(1, gfx::Size(10, 10)); @@ -1115,7 +1118,8 @@ class LayerTreeHostContextTestDontUseLostResources scoped_refptr<PaintedScrollbarLayer> scrollbar = PaintedScrollbarLayer::Create( - scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), layer->id()); + layer_settings_, scoped_ptr<Scrollbar>(new FakeScrollbar).Pass(), + layer->id()); scrollbar->SetBounds(gfx::Size(10, 10)); scrollbar->SetIsDrawable(true); root->AddChild(scrollbar); @@ -1192,6 +1196,8 @@ class LayerTreeHostContextTestDontUseLostResources FakeVideoFrameProvider color_frame_provider_; FakeVideoFrameProvider hw_frame_provider_; FakeVideoFrameProvider scaled_hw_frame_provider_; + + LayerSettings layer_settings_; }; SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestDontUseLostResources); @@ -1208,11 +1214,12 @@ class LayerTreeHostContextTestImplSidePainting : public ImplSidePaintingLayerTreeHostContextTest { public: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); - scoped_refptr<PictureLayer> picture = PictureLayer::Create(&client_); + scoped_refptr<PictureLayer> picture = + PictureLayer::Create(layer_settings(), &client_); picture->SetBounds(gfx::Size(10, 10)); picture->SetIsDrawable(true); root->AddChild(picture); @@ -1241,9 +1248,9 @@ class ScrollbarLayerLostContext : public LayerTreeHostContextTest { ScrollbarLayerLostContext() : commits_(0) {} void BeginTest() override { - scoped_refptr<Layer> scroll_layer = Layer::Create(); - scrollbar_layer_ = - FakePaintedScrollbarLayer::Create(false, true, scroll_layer->id()); + scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); + scrollbar_layer_ = FakePaintedScrollbarLayer::Create( + layer_settings(), false, true, scroll_layer->id()); scrollbar_layer_->SetBounds(gfx::Size(10, 100)); layer_tree_host()->root_layer()->AddChild(scrollbar_layer_); layer_tree_host()->root_layer()->AddChild(scroll_layer); @@ -1689,11 +1696,11 @@ class LayerTreeHostContextTestSurfaceCreateCallback void SetupTree() override { if (layer_tree_host()->settings().impl_side_painting) { - picture_layer_ = FakePictureLayer::Create(&client_); + picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); picture_layer_->SetBounds(gfx::Size(10, 20)); layer_tree_host()->SetRootLayer(picture_layer_); } else { - content_layer_ = FakeContentLayer::Create(&client_); + content_layer_ = FakeContentLayer::Create(layer_settings(), &client_); content_layer_->SetBounds(gfx::Size(10, 20)); layer_tree_host()->SetRootLayer(content_layer_); } diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc index 5766a19..b3725d4 100644 --- a/cc/trees/layer_tree_host_unittest_copyrequest.cc +++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc @@ -23,10 +23,10 @@ class LayerTreeHostCopyRequestTestMultipleRequests : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root = FakeContentLayer::Create(&client_); + root = FakeContentLayer::Create(layer_settings(), &client_); root->SetBounds(gfx::Size(20, 20)); - child = FakeContentLayer::Create(&client_); + child = FakeContentLayer::Create(layer_settings(), &client_); child->SetBounds(gfx::Size(10, 10)); root->AddChild(child); @@ -148,14 +148,14 @@ class LayerTreeHostCopyRequestTestLayerDestroyed : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - main_destroyed_ = FakeContentLayer::Create(&client_); + main_destroyed_ = FakeContentLayer::Create(layer_settings(), &client_); main_destroyed_->SetBounds(gfx::Size(15, 15)); root_->AddChild(main_destroyed_); - impl_destroyed_ = FakeContentLayer::Create(&client_); + impl_destroyed_ = FakeContentLayer::Create(layer_settings(), &client_); impl_destroyed_->SetBounds(gfx::Size(10, 10)); root_->AddChild(impl_destroyed_); @@ -240,20 +240,20 @@ class LayerTreeHostCopyRequestTestInHiddenSubtree : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - grand_parent_layer_ = FakeContentLayer::Create(&client_); + grand_parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_); grand_parent_layer_->SetBounds(gfx::Size(15, 15)); root_->AddChild(grand_parent_layer_); // parent_layer_ owns a render surface. - parent_layer_ = FakeContentLayer::Create(&client_); + parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_); parent_layer_->SetBounds(gfx::Size(15, 15)); parent_layer_->SetForceRenderSurface(true); grand_parent_layer_->AddChild(parent_layer_); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); parent_layer_->AddChild(copy_layer_); @@ -339,21 +339,21 @@ class LayerTreeHostTestHiddenSurfaceNotAllocatedForSubtreeCopyRequest : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - grand_parent_layer_ = FakeContentLayer::Create(&client_); + grand_parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_); grand_parent_layer_->SetBounds(gfx::Size(15, 15)); grand_parent_layer_->SetHideLayerAndSubtree(true); root_->AddChild(grand_parent_layer_); // parent_layer_ owns a render surface. - parent_layer_ = FakeContentLayer::Create(&client_); + parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_); parent_layer_->SetBounds(gfx::Size(15, 15)); parent_layer_->SetForceRenderSurface(true); grand_parent_layer_->AddChild(parent_layer_); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); parent_layer_->AddChild(copy_layer_); @@ -417,15 +417,15 @@ class LayerTreeHostCopyRequestTestClippedOut : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - parent_layer_ = FakeContentLayer::Create(&client_); + parent_layer_ = FakeContentLayer::Create(layer_settings(), &client_); parent_layer_->SetBounds(gfx::Size(15, 15)); parent_layer_->SetMasksToBounds(true); root_->AddChild(parent_layer_); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetPosition(gfx::Point(15, 15)); copy_layer_->SetBounds(gfx::Size(10, 10)); parent_layer_->AddChild(copy_layer_); @@ -465,10 +465,10 @@ class LayerTreeHostTestAsyncTwoReadbacksWithoutDraw : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); root_->AddChild(copy_layer_); @@ -547,10 +547,10 @@ class LayerTreeHostCopyRequestTestLostOutputSurface } void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); root_->AddChild(copy_layer_); @@ -669,10 +669,10 @@ class LayerTreeHostCopyRequestTestCountTextures } void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); root_->AddChild(copy_layer_); @@ -823,10 +823,10 @@ class LayerTreeHostCopyRequestTestDestroyBeforeCopy : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); root_->AddChild(copy_layer_); @@ -900,10 +900,10 @@ class LayerTreeHostCopyRequestTestShutdownBeforeCopy : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(20, 20)); - copy_layer_ = FakeContentLayer::Create(&client_); + copy_layer_ = FakeContentLayer::Create(layer_settings(), &client_); copy_layer_->SetBounds(gfx::Size(10, 10)); root_->AddChild(copy_layer_); @@ -971,10 +971,11 @@ class LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest : public LayerTreeHostCopyRequestTest { protected: void SetupTree() override { - scoped_refptr<FakeContentLayer> root = FakeContentLayer::Create(&client_); + scoped_refptr<FakeContentLayer> root = + FakeContentLayer::Create(layer_settings(), &client_); root->SetBounds(gfx::Size(20, 20)); - child_ = FakeContentLayer::Create(&client_); + child_ = FakeContentLayer::Create(layer_settings(), &client_); child_->SetBounds(gfx::Size(10, 10)); root->AddChild(child_); child_->SetHideLayerAndSubtree(true); diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc index daff40b..db00fb5 100644 --- a/cc/trees/layer_tree_host_unittest_damage.cc +++ b/cc/trees/layer_tree_host_unittest_damage.cc @@ -28,7 +28,8 @@ class LayerTreeHostDamageTestSetNeedsRedraw : public LayerTreeHostDamageTest { void SetupTree() override { // Viewport is 10x10. - scoped_refptr<FakeContentLayer> root = FakeContentLayer::Create(&client_); + scoped_refptr<FakeContentLayer> root = + FakeContentLayer::Create(layer_settings(), &client_); root->SetBounds(gfx::Size(10, 10)); layer_tree_host()->SetRootLayer(root); @@ -89,7 +90,8 @@ class LayerTreeHostDamageTestSetViewportSize : public LayerTreeHostDamageTest { void SetupTree() override { // Viewport is 10x10. - scoped_refptr<FakeContentLayer> root = FakeContentLayer::Create(&client_); + scoped_refptr<FakeContentLayer> root = + FakeContentLayer::Create(layer_settings(), &client_); root->SetBounds(gfx::Size(10, 10)); layer_tree_host()->SetRootLayer(root); @@ -155,11 +157,12 @@ class LayerTreeHostDamageTestNoDamageDoesNotSwap } void SetupTree() override { - scoped_refptr<FakeContentLayer> root = FakeContentLayer::Create(&client_); + scoped_refptr<FakeContentLayer> root = + FakeContentLayer::Create(layer_settings(), &client_); root->SetBounds(gfx::Size(10, 10)); // Most of the layer isn't visible. - content_ = FakeContentLayer::Create(&client_); + content_ = FakeContentLayer::Create(layer_settings(), &client_); content_->SetBounds(gfx::Size(2000, 100)); root->AddChild(content_); @@ -240,8 +243,8 @@ class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { void BeginTest() override { PostSetNeedsCommitToMainThread(); } void SetupTree() override { - root_ = FakeContentLayer::Create(&client_); - child_ = FakeContentLayer::Create(&client_); + root_ = FakeContentLayer::Create(layer_settings(), &client_); + child_ = FakeContentLayer::Create(layer_settings(), &client_); root_->SetBounds(gfx::Size(500, 500)); child_->SetPosition(gfx::Point(100, 100)); @@ -349,13 +352,14 @@ SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostDamageTestForcedFullDamage); class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest { void SetupTree() override { - scoped_refptr<Layer> root_layer = Layer::Create(); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); root_layer->SetBounds(gfx::Size(400, 400)); root_layer->SetMasksToBounds(true); layer_tree_host()->SetRootLayer(root_layer); - scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); - scoped_refptr<Layer> content_layer = FakeContentLayer::Create(&client_); + scoped_refptr<Layer> scroll_clip_layer = Layer::Create(layer_settings()); + scoped_refptr<Layer> content_layer = + FakeContentLayer::Create(layer_settings(), &client_); content_layer->SetScrollClipLayerId(scroll_clip_layer->id()); content_layer->SetScrollOffset(gfx::ScrollOffset(10, 20)); content_layer->SetBounds(gfx::Size(100, 200)); @@ -365,8 +369,8 @@ class LayerTreeHostScrollbarDamageTest : public LayerTreeHostDamageTest { scroll_clip_layer->AddChild(content_layer); root_layer->AddChild(scroll_clip_layer); - scoped_refptr<Layer> scrollbar_layer = - FakePaintedScrollbarLayer::Create(false, true, content_layer->id()); + scoped_refptr<Layer> scrollbar_layer = FakePaintedScrollbarLayer::Create( + layer_settings(), false, true, content_layer->id()); scrollbar_layer->SetPosition(gfx::Point(300, 300)); scrollbar_layer->SetBounds(gfx::Size(10, 100)); scrollbar_layer->ToScrollbarLayer()->SetClipLayer(scroll_clip_layer->id()); diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index 7455318..8c570630 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -272,7 +272,7 @@ class LayerTreeHostDelegatedTestCaseSingleDelegatedLayer } void SetupTree() override { - root_ = Layer::Create(); + root_ = Layer::Create(layer_settings()); root_->SetBounds(gfx::Size(15, 15)); layer_tree_host()->SetRootLayer(root_); @@ -308,7 +308,7 @@ class LayerTreeHostDelegatedTestCaseSingleDelegatedLayer scoped_refptr<DelegatedRendererLayer> CreateDelegatedLayer( DelegatedFrameProvider* frame_provider) { scoped_refptr<DelegatedRendererLayer> delegated = - FakeDelegatedRendererLayer::Create(frame_provider); + FakeDelegatedRendererLayer::Create(layer_settings(), frame_provider); delegated->SetBounds(gfx::Size(10, 10)); delegated->SetIsDrawable(true); diff --git a/cc/trees/layer_tree_host_unittest_no_message_loop.cc b/cc/trees/layer_tree_host_unittest_no_message_loop.cc index 7a4251c..d23bba9 100644 --- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc +++ b/cc/trees/layer_tree_host_unittest_no_message_loop.cc @@ -151,7 +151,7 @@ class LayerTreeHostNoMessageLoopSmokeTest // Set up root layer. { scoped_refptr<SolidColorLayer> solid_color_layer = - SolidColorLayer::Create(); + SolidColorLayer::Create(LayerSettings()); solid_color_layer->SetBackgroundColor(SK_ColorRED); solid_color_layer->SetBounds(size_); solid_color_layer->SetIsDrawable(true); @@ -177,9 +177,10 @@ class LayerTreeHostNoMessageLoopDelegatedLayer frame_provider_ = new DelegatedFrameProvider( resource_collection_.get(), CreateFrameDataWithResource(998)); - root_layer_ = Layer::Create(); - delegated_layer_ = - FakeDelegatedRendererLayer::Create(frame_provider_.get()); + LayerSettings layer_settings; + root_layer_ = Layer::Create(layer_settings); + delegated_layer_ = FakeDelegatedRendererLayer::Create( + layer_settings, frame_provider_.get()); delegated_layer_->SetBounds(size_); delegated_layer_->SetIsDrawable(true); root_layer_->AddChild(delegated_layer_); diff --git a/cc/trees/layer_tree_host_unittest_occlusion.cc b/cc/trees/layer_tree_host_unittest_occlusion.cc index 9974ae4..37c56d1 100644 --- a/cc/trees/layer_tree_host_unittest_occlusion.cc +++ b/cc/trees/layer_tree_host_unittest_occlusion.cc @@ -30,11 +30,11 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnLayer : public LayerTreeHostOcclusionTest { public: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); root->SetIsDrawable(true); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); child->SetBounds(gfx::Size(50, 60)); child->SetPosition(gfx::PointF(10.f, 5.5f)); child->SetContentsOpaque(true); @@ -76,18 +76,18 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnSurface : public LayerTreeHostOcclusionTest { public: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); root->SetIsDrawable(true); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); child->SetBounds(gfx::Size(1, 1)); child->SetPosition(gfx::PointF(10.f, 5.5f)); child->SetIsDrawable(true); child->SetForceRenderSurface(true); root->AddChild(child); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); child2->SetBounds(gfx::Size(10, 12)); child2->SetPosition(gfx::PointF(13.f, 8.5f)); child2->SetContentsOpaque(true); @@ -128,28 +128,29 @@ class LayerTreeHostOcclusionTestDrawPropertiesOnMask : public LayerTreeHostOcclusionTest { public: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); root->SetIsDrawable(true); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); child->SetBounds(gfx::Size(30, 40)); child->SetPosition(gfx::PointF(10.f, 5.5f)); child->SetIsDrawable(true); root->AddChild(child); - scoped_refptr<Layer> make_surface_bigger = Layer::Create(); + scoped_refptr<Layer> make_surface_bigger = Layer::Create(layer_settings()); make_surface_bigger->SetBounds(gfx::Size(100, 100)); make_surface_bigger->SetPosition(gfx::PointF(-10.f, -15.f)); make_surface_bigger->SetIsDrawable(true); child->AddChild(make_surface_bigger); - scoped_refptr<Layer> mask = PictureLayer::Create(&client_); + scoped_refptr<Layer> mask = + PictureLayer::Create(layer_settings(), &client_); mask->SetBounds(gfx::Size(30, 40)); mask->SetIsDrawable(true); child->SetMaskLayer(mask.get()); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); child2->SetBounds(gfx::Size(10, 12)); child2->SetPosition(gfx::PointF(13.f, 8.5f)); child2->SetContentsOpaque(true); @@ -198,29 +199,30 @@ class LayerTreeHostOcclusionTestDrawPropertiesInsideReplica : public LayerTreeHostOcclusionTest { public: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); root->SetIsDrawable(true); - scoped_refptr<Layer> child = Layer::Create(); + scoped_refptr<Layer> child = Layer::Create(layer_settings()); child->SetBounds(gfx::Size(1, 1)); child->SetPosition(gfx::PointF(10.f, 5.5f)); child->SetIsDrawable(true); child->SetForceRenderSurface(true); root->AddChild(child); - scoped_refptr<Layer> replica = Layer::Create(); + scoped_refptr<Layer> replica = Layer::Create(layer_settings()); gfx::Transform translate; translate.Translate(20.f, 4.f); replica->SetTransform(translate); child->SetReplicaLayer(replica.get()); - scoped_refptr<Layer> mask = PictureLayer::Create(&client_); + scoped_refptr<Layer> mask = + PictureLayer::Create(layer_settings(), &client_); mask->SetBounds(gfx::Size(30, 40)); mask->SetIsDrawable(true); child->SetMaskLayer(mask.get()); - scoped_refptr<Layer> child2 = Layer::Create(); + scoped_refptr<Layer> child2 = Layer::Create(layer_settings()); child2->SetBounds(gfx::Size(10, 12)); child2->SetPosition(gfx::PointF(13.f, 8.5f)); child2->SetContentsOpaque(true); diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc index f6c847c..208da58 100644 --- a/cc/trees/layer_tree_host_unittest_picture.cc +++ b/cc/trees/layer_tree_host_unittest_picture.cc @@ -17,10 +17,10 @@ namespace { class LayerTreeHostPictureTest : public LayerTreeTest { protected: void SetupTreeWithSinglePictureLayer(const gfx::Size& size) { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(size); - root_picture_layer_ = FakePictureLayer::Create(&client_); + root_picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); root_picture_layer_->SetBounds(size); root->AddChild(root_picture_layer_); @@ -57,7 +57,7 @@ class LayerTreeHostPictureTestTwinLayer // Add a new picture layer so the activate will have a pending layer // without an active twin. scoped_refptr<FakePictureLayer> picture = - FakePictureLayer::Create(&client_); + FakePictureLayer::Create(layer_settings(), &client_); layer_tree_host()->root_layer()->AddChild(picture); break; } @@ -137,11 +137,11 @@ class LayerTreeHostPictureTestResizeViewportWithGpuRaster } void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(768, 960)); client_.set_fill_with_nonsolid_color(true); - picture_ = FakePictureLayer::Create(&client_); + picture_ = FakePictureLayer::Create(layer_settings(), &client_); picture_->SetBounds(gfx::Size(768, 960)); root->AddChild(picture_); @@ -200,13 +200,13 @@ class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree frame_ = 0; did_post_commit_ = false; - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); // The layer is big enough that the live tiles rect won't cover the full // layer. client_.set_fill_with_nonsolid_color(true); - picture_ = FakePictureLayer::Create(&client_); + picture_ = FakePictureLayer::Create(layer_settings(), &client_); picture_->SetBounds(gfx::Size(100, 100000)); root->AddChild(picture_); @@ -299,15 +299,15 @@ MULTI_THREAD_IMPL_TEST_F( class LayerTreeHostPictureTestRSLLMembership : public LayerTreeHostPictureTest { void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); - child_ = Layer::Create(); + child_ = Layer::Create(layer_settings()); root->AddChild(child_); // Don't be solid color so the layer has tilings/tiles. client_.set_fill_with_nonsolid_color(true); - picture_ = FakePictureLayer::Create(&client_); + picture_ = FakePictureLayer::Create(layer_settings(), &client_); picture_->SetBounds(gfx::Size(100, 100)); child_->AddChild(picture_); @@ -388,10 +388,10 @@ SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostPictureTestRSLLMembership); class LayerTreeHostPictureTestRSLLMembershipWithScale : public LayerTreeHostPictureTest { void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); - pinch_ = Layer::Create(); + pinch_ = Layer::Create(layer_settings()); pinch_->SetBounds(gfx::Size(500, 500)); pinch_->SetScrollClipLayerId(root->id()); pinch_->SetIsContainerForFixedPositionLayers(true); @@ -399,7 +399,7 @@ class LayerTreeHostPictureTestRSLLMembershipWithScale // Don't be solid color so the layer has tilings/tiles. client_.set_fill_with_nonsolid_color(true); - picture_ = FakePictureLayer::Create(&client_); + picture_ = FakePictureLayer::Create(layer_settings(), &client_); picture_->SetBounds(gfx::Size(100, 100)); pinch_->AddChild(picture_); diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 4e77a2d..dcd7153 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -39,7 +39,7 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { void BeginTest() override { Layer* root_layer = layer_tree_host()->root_layer(); - scoped_refptr<Layer> scroll_layer = Layer::Create(); + scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); root_layer->AddChild(scroll_layer); // Create an effective max_scroll_offset of (100, 100). scroll_layer->SetBounds(gfx::Size(root_layer->bounds().width() + 100, @@ -117,7 +117,7 @@ class LayerTreeHostScrollTestScrollMultipleRedraw void BeginTest() override { Layer* root_layer = layer_tree_host()->root_layer(); - scroll_layer_ = Layer::Create(); + scroll_layer_ = Layer::Create(layer_settings()); root_layer->AddChild(scroll_layer_); // Create an effective max_scroll_offset of (100, 100). scroll_layer_->SetBounds(gfx::Size(root_layer->bounds().width() + 100, @@ -221,7 +221,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit void SetupTree() override { LayerTreeHostScrollTest::SetupTree(); Layer* root_layer = layer_tree_host()->root_layer(); - scoped_refptr<Layer> root_scroll_layer = Layer::Create(); + scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); root_scroll_layer->SetScrollClipLayerId(root_layer->id()); root_scroll_layer->SetScrollOffset(initial_scroll_); root_scroll_layer->SetBounds(gfx::Size(200, 200)); @@ -403,7 +403,7 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { void SetupTree() override { LayerTreeHostScrollTest::SetupTree(); Layer* root_layer = layer_tree_host()->root_layer(); - scoped_refptr<Layer> root_scroll_layer = Layer::Create(); + scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); root_scroll_layer->SetScrollClipLayerId(root_layer->id()); root_scroll_layer->SetBounds( gfx::Size(root_layer->bounds().width() + 100, @@ -470,10 +470,11 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { void SetupTree() override { layer_tree_host()->SetDeviceScaleFactor(device_scale_factor_); - scoped_refptr<Layer> root_layer = Layer::Create(); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); root_layer->SetBounds(gfx::Size(10, 10)); - root_scroll_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); + root_scroll_layer_ = + FakePictureLayer::Create(layer_settings(), &fake_content_layer_client_); root_scroll_layer_->SetBounds(gfx::Size(110, 110)); root_scroll_layer_->SetPosition(gfx::Point()); @@ -483,7 +484,8 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { root_scroll_layer_->SetIsContainerForFixedPositionLayers(true); root_layer->AddChild(root_scroll_layer_); - child_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); + child_layer_ = + FakePictureLayer::Create(layer_settings(), &fake_content_layer_client_); child_layer_->set_did_scroll_callback( base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll, base::Unretained(this))); @@ -774,7 +776,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { void SetupTree() override { LayerTreeHostScrollTest::SetupTree(); Layer* root_layer = layer_tree_host()->root_layer(); - scoped_refptr<Layer> root_scroll_layer = Layer::Create(); + scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); root_scroll_layer->SetScrollClipLayerId(root_layer->id()); root_scroll_layer->SetScrollOffset(initial_scroll_); root_scroll_layer->SetBounds( @@ -899,7 +901,7 @@ class ImplSidePaintingScrollTestImplOnlyScroll void SetupTree() override { LayerTreeHostScrollTest::SetupTree(); Layer* root_layer = layer_tree_host()->root_layer(); - scoped_refptr<Layer> root_scroll_layer = Layer::Create(); + scoped_refptr<Layer> root_scroll_layer = Layer::Create(layer_settings()); root_scroll_layer->SetScrollClipLayerId(root_layer->id()); root_scroll_layer->SetScrollOffset(initial_scroll_); root_scroll_layer->SetBounds( @@ -1033,7 +1035,7 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset void SetupTree() override { LayerTreeTest::SetupTree(); - scoped_refptr<Layer> scroll_layer = Layer::Create(); + scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); layer_tree_host()->root_layer()->AddChild(scroll_layer); } @@ -1156,7 +1158,7 @@ class LayerTreeHostScrollTestLayerStructureChange : scroll_destroy_whole_tree_(false) {} void SetupTree() override { - scoped_refptr<Layer> root_layer = Layer::Create(); + scoped_refptr<Layer> root_layer = Layer::Create(layer_settings()); root_layer->SetBounds(gfx::Size(10, 10)); Layer* root_scroll_layer = @@ -1208,7 +1210,7 @@ class LayerTreeHostScrollTestLayerStructureChange Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) { scoped_refptr<PictureLayer> scroll_layer = - PictureLayer::Create(&fake_content_layer_client_); + PictureLayer::Create(layer_settings(), &fake_content_layer_client_); scroll_layer->SetBounds(gfx::Size(110, 110)); scroll_layer->SetPosition(gfx::Point(0, 0)); scroll_layer->SetIsDrawable(true); diff --git a/cc/trees/layer_tree_host_unittest_video.cc b/cc/trees/layer_tree_host_unittest_video.cc index ffeda72..31854ac 100644 --- a/cc/trees/layer_tree_host_unittest_video.cc +++ b/cc/trees/layer_tree_host_unittest_video.cc @@ -23,12 +23,12 @@ class LayerTreeHostVideoTestSetNeedsDisplay : public LayerTreeHostVideoTest { public: void SetupTree() override { - scoped_refptr<Layer> root = Layer::Create(); + scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(10, 10)); root->SetIsDrawable(true); - scoped_refptr<VideoLayer> video = - VideoLayer::Create(&video_frame_provider_, media::VIDEO_ROTATION_90); + scoped_refptr<VideoLayer> video = VideoLayer::Create( + layer_settings(), &video_frame_provider_, media::VIDEO_ROTATION_90); video->SetPosition(gfx::PointF(3.f, 3.f)); video->SetBounds(gfx::Size(4, 5)); video->SetIsDrawable(true); diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc index d2c3bda..529f63e 100644 --- a/cc/trees/layer_tree_settings.cc +++ b/cc/trees/layer_tree_settings.cc @@ -13,6 +13,12 @@ namespace cc { +LayerSettings::LayerSettings() : use_compositor_animation_timelines(false) { +} + +LayerSettings::~LayerSettings() { +} + LayerTreeSettings::LayerTreeSettings() : impl_side_painting(false), raster_enabled(true), @@ -69,8 +75,7 @@ LayerTreeSettings::LayerTreeSettings() use_display_lists(false), use_cached_picture_in_display_list(true), verify_property_trees(false), - gather_pixel_refs(false), - use_compositor_animation_timelines(false) { + gather_pixel_refs(false) { } LayerTreeSettings::~LayerTreeSettings() {} diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index 0e1819b..6c919e2 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -15,6 +15,14 @@ namespace cc { +class CC_EXPORT LayerSettings { + public: + LayerSettings(); + ~LayerSettings(); + + bool use_compositor_animation_timelines; +}; + class CC_EXPORT LayerTreeSettings { public: LayerTreeSettings(); @@ -83,7 +91,7 @@ class CC_EXPORT LayerTreeSettings { bool use_cached_picture_in_display_list; bool verify_property_trees; bool gather_pixel_refs; - bool use_compositor_animation_timelines; + LayerSettings hud_layer_settings; LayerTreeDebugState initial_debug_state; diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index f3f2185..7e37348 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -29,7 +29,8 @@ namespace { class TestContentLayer : public Layer { public: - TestContentLayer() : Layer(), override_opaque_contents_rect_(false) { + explicit TestContentLayer(const LayerSettings& settings) + : Layer(settings), override_opaque_contents_rect_(false) { SetIsDrawable(true); } @@ -117,9 +118,11 @@ struct OcclusionTrackerTestMainThreadTypes { typedef LayerIterator<Layer> TestLayerIterator; typedef OcclusionTracker<Layer> OcclusionTrackerType; - static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } + static LayerPtrType CreateLayer(HostType* host) { + return Layer::Create(LayerSettings()); + } static ContentLayerPtrType CreateContentLayer(HostType* host) { - return make_scoped_refptr(new ContentLayerType()); + return make_scoped_refptr(new ContentLayerType(LayerSettings())); } template <typename T> diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index a17bec8..6cf75ba 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc @@ -51,8 +51,10 @@ class MockLayerImpl : public LayerImpl { class MockLayer : public Layer { public: static scoped_refptr<MockLayer> Create( + const LayerSettings& settings, std::vector<int>* layer_impl_destruction_list) { - return make_scoped_refptr(new MockLayer(layer_impl_destruction_list)); + return make_scoped_refptr( + new MockLayer(settings, layer_impl_destruction_list)); } scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { @@ -67,8 +69,10 @@ class MockLayer : public Layer { } private: - explicit MockLayer(std::vector<int>* layer_impl_destruction_list) - : Layer(), layer_impl_destruction_list_(layer_impl_destruction_list) {} + explicit MockLayer(const LayerSettings& settings, + std::vector<int>* layer_impl_destruction_list) + : Layer(settings), + layer_impl_destruction_list_(layer_impl_destruction_list) {} ~MockLayer() override {} std::vector<int>* layer_impl_destruction_list_; @@ -196,6 +200,7 @@ class TreeSynchronizerTest : public testing::Test { protected: FakeLayerTreeHostClient client_; scoped_ptr<FakeLayerTreeHost> host_; + LayerSettings layer_settings_; }; // Attempts to synchronizes a null tree. This should not crash, and should @@ -211,9 +216,9 @@ TEST_F(TreeSynchronizerTest, SyncNullTree) { // Constructs a very simple tree and synchronizes it without trying to reuse any // preexisting layers. TEST_F(TreeSynchronizerTest, SyncSimpleTreeFromEmpty) { - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - layer_tree_root->AddChild(Layer::Create()); - layer_tree_root->AddChild(Layer::Create()); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); host_->SetRootLayer(layer_tree_root); @@ -232,9 +237,11 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeReusingLayers) { std::vector<int> layer_impl_destruction_list; scoped_refptr<Layer> layer_tree_root = - MockLayer::Create(&layer_impl_destruction_list); - layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); - layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); + MockLayer::Create(layer_settings_, &layer_impl_destruction_list); + layer_tree_root->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); + layer_tree_root->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); host_->SetRootLayer(layer_tree_root); @@ -250,8 +257,8 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeReusingLayers) { layer_impl_tree_root.get()); // Add a new layer to the Layer side - layer_tree_root->children()[0]-> - AddChild(MockLayer::Create(&layer_impl_destruction_list)); + layer_tree_root->children()[0]->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); // Remove one. layer_tree_root->children()[1]->RemoveFromParent(); int second_layer_impl_id = layer_impl_tree_root->children()[1]->id(); @@ -278,9 +285,11 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndTrackStackingOrderChange) { // Set up the tree and sync once. child2 needs to be synced here, too, even // though we remove it to set up the intended scenario. scoped_refptr<Layer> layer_tree_root = - MockLayer::Create(&layer_impl_destruction_list); - scoped_refptr<Layer> child2 = MockLayer::Create(&layer_impl_destruction_list); - layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); + MockLayer::Create(layer_settings_, &layer_impl_destruction_list); + scoped_refptr<Layer> child2 = + MockLayer::Create(layer_settings_, &layer_impl_destruction_list); + layer_tree_root->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); layer_tree_root->AddChild(child2); host_->SetRootLayer(layer_tree_root); @@ -319,9 +328,9 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndTrackStackingOrderChange) { } TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndProperties) { - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - layer_tree_root->AddChild(Layer::Create()); - layer_tree_root->AddChild(Layer::Create()); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); host_->SetRootLayer(layer_tree_root); @@ -372,17 +381,21 @@ TEST_F(TreeSynchronizerTest, ReuseLayerImplsAfterStructuralChange) { // | // +--- D scoped_refptr<Layer> layer_tree_root = - MockLayer::Create(&layer_impl_destruction_list); - layer_tree_root->AddChild(MockLayer::Create(&layer_impl_destruction_list)); + MockLayer::Create(layer_settings_, &layer_impl_destruction_list); + layer_tree_root->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); scoped_refptr<Layer> layer_a = layer_tree_root->children()[0].get(); - layer_a->AddChild(MockLayer::Create(&layer_impl_destruction_list)); + layer_a->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); scoped_refptr<Layer> layer_b = layer_a->children()[0].get(); - layer_b->AddChild(MockLayer::Create(&layer_impl_destruction_list)); + layer_b->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); scoped_refptr<Layer> layer_c = layer_b->children()[0].get(); - layer_b->AddChild(MockLayer::Create(&layer_impl_destruction_list)); + layer_b->AddChild( + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); scoped_refptr<Layer> layer_d = layer_b->children()[1].get(); host_->SetRootLayer(layer_tree_root); @@ -431,11 +444,11 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeThenDestroy) { std::vector<int> layer_impl_destruction_list; scoped_refptr<Layer> old_layer_tree_root = - MockLayer::Create(&layer_impl_destruction_list); + MockLayer::Create(layer_settings_, &layer_impl_destruction_list); old_layer_tree_root->AddChild( - MockLayer::Create(&layer_impl_destruction_list)); + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); old_layer_tree_root->AddChild( - MockLayer::Create(&layer_impl_destruction_list)); + MockLayer::Create(layer_settings_, &layer_impl_destruction_list)); host_->SetRootLayer(old_layer_tree_root); @@ -459,7 +472,7 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeThenDestroy) { // Synchronize again. After the sync all LayerImpls from the old tree should // be deleted. - scoped_refptr<Layer> new_layer_tree_root = Layer::Create(); + scoped_refptr<Layer> new_layer_tree_root = Layer::Create(layer_settings_); host_->SetRootLayer(new_layer_tree_root); layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees(new_layer_tree_root.get(), @@ -487,22 +500,22 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeThenDestroy) { // Constructs+syncs a tree with mask, replica, and replica mask layers. TEST_F(TreeSynchronizerTest, SyncMaskReplicaAndReplicaMaskLayers) { - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - layer_tree_root->AddChild(Layer::Create()); - layer_tree_root->AddChild(Layer::Create()); - layer_tree_root->AddChild(Layer::Create()); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); // First child gets a mask layer. - scoped_refptr<Layer> mask_layer = Layer::Create(); + scoped_refptr<Layer> mask_layer = Layer::Create(layer_settings_); layer_tree_root->children()[0]->SetMaskLayer(mask_layer.get()); // Second child gets a replica layer. - scoped_refptr<Layer> replica_layer = Layer::Create(); + scoped_refptr<Layer> replica_layer = Layer::Create(layer_settings_); layer_tree_root->children()[1]->SetReplicaLayer(replica_layer.get()); // Third child gets a replica layer with a mask layer. - scoped_refptr<Layer> replica_layer_with_mask = Layer::Create(); - scoped_refptr<Layer> replica_mask_layer = Layer::Create(); + scoped_refptr<Layer> replica_layer_with_mask = Layer::Create(layer_settings_); + scoped_refptr<Layer> replica_mask_layer = Layer::Create(layer_settings_); replica_layer_with_mask->SetMaskLayer(replica_mask_layer.get()); layer_tree_root->children()[2]-> SetReplicaLayer(replica_layer_with_mask.get()); @@ -559,7 +572,7 @@ TEST_F(TreeSynchronizerTest, SynchronizeAnimations) { LayerTreeHostImpl::Create(settings, NULL, &proxy, &stats_instrumentation, shared_bitmap_manager.get(), NULL, NULL, 0); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); host_->SetRootLayer(layer_tree_root); layer_tree_root->SetLayerAnimationControllerForTest( @@ -593,11 +606,11 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { LayerTreeHostImpl::Create(settings, NULL, &proxy, &stats_instrumentation, shared_bitmap_manager.get(), NULL, NULL, 0); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> scroll_parent = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); + scoped_refptr<Layer> scroll_parent = Layer::Create(layer_settings_); layer_tree_root->AddChild(scroll_parent); - layer_tree_root->AddChild(Layer::Create()); - layer_tree_root->AddChild(Layer::Create()); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); + layer_tree_root->AddChild(Layer::Create(layer_settings_)); host_->SetRootLayer(layer_tree_root); @@ -633,7 +646,7 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { } // Add an additional scroll layer. - scoped_refptr<Layer> additional_scroll_child = Layer::Create(); + scoped_refptr<Layer> additional_scroll_child = Layer::Create(layer_settings_); layer_tree_root->AddChild(additional_scroll_child); additional_scroll_child->SetScrollParent(scroll_parent.get()); layer_impl_tree_root = @@ -661,11 +674,11 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { LayerTreeHostImpl::Create(settings, NULL, &proxy, &stats_instrumentation, shared_bitmap_manager.get(), NULL, NULL, 0); - scoped_refptr<Layer> layer_tree_root = Layer::Create(); - scoped_refptr<Layer> clip_parent = Layer::Create(); - scoped_refptr<Layer> intervening = Layer::Create(); - scoped_refptr<Layer> clip_child1 = Layer::Create(); - scoped_refptr<Layer> clip_child2 = Layer::Create(); + scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings_); + scoped_refptr<Layer> clip_parent = Layer::Create(layer_settings_); + scoped_refptr<Layer> intervening = Layer::Create(layer_settings_); + scoped_refptr<Layer> clip_child1 = Layer::Create(layer_settings_); + scoped_refptr<Layer> clip_child2 = Layer::Create(layer_settings_); layer_tree_root->AddChild(clip_parent); clip_parent->AddChild(intervening); intervening->AddChild(clip_child1); @@ -701,7 +714,7 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { host_impl->active_tree()); // Add an additional clip child. - scoped_refptr<Layer> additional_clip_child = Layer::Create(); + scoped_refptr<Layer> additional_clip_child = Layer::Create(layer_settings_); intervening->AddChild(additional_clip_child); additional_clip_child->SetClipParent(clip_parent.get()); layer_impl_tree_root = diff --git a/chrome/browser/android/compositor/compositor_view.cc b/chrome/browser/android/compositor/compositor_view.cc index f09ac75..59043f8 100644 --- a/chrome/browser/android/compositor/compositor_view.cc +++ b/chrome/browser/android/compositor/compositor_view.cc @@ -82,7 +82,8 @@ CompositorView::CompositorView(JNIEnv* env, TabContentManager* tab_content_manager) : layer_title_cache_(layer_title_cache), tab_content_manager_(tab_content_manager), - root_layer_(cc::SolidColorLayer::Create()), + root_layer_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), toolbar_layer_(ToolbarLayer::Create()), scene_layer_(nullptr), current_surface_format_(0), diff --git a/chrome/browser/android/compositor/decoration_title.cc b/chrome/browser/android/compositor/decoration_title.cc index ded6307..0169c65 100644 --- a/chrome/browser/android/compositor/decoration_title.cc +++ b/chrome/browser/android/compositor/decoration_title.cc @@ -11,6 +11,7 @@ #include "cc/layers/layer.h" #include "cc/layers/ui_resource_layer.h" #include "chrome/browser/android/compositor/layer_title_cache.h" +#include "content/public/browser/android/compositor.h" #include "ui/android/resources/resource_manager.h" #include "ui/android/resources/ui_resource_android.h" #include "ui/base/l10n/l10n_util_android.h" @@ -31,10 +32,13 @@ DecorationTitle::DecorationTitle(LayerTitleCache* layer_title_cache, int favicon_end_padding, bool is_incognito, bool is_rtl) - : layer_(cc::Layer::Create()), - layer_opaque_(cc::UIResourceLayer::Create()), - layer_fade_(cc::UIResourceLayer::Create()), - layer_favicon_(cc::UIResourceLayer::Create()), + : layer_(cc::Layer::Create(content::Compositor::LayerSettings())), + layer_opaque_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + layer_fade_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + layer_favicon_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), title_resource_id_(title_resource_id), favicon_resource_id_(favicon_resource_id), spinner_resource_id_(spinner_resource_id), diff --git a/chrome/browser/android/compositor/layer/content_layer.cc b/chrome/browser/android/compositor/layer/content_layer.cc index 016c7f1..ce2be92 100644 --- a/chrome/browser/android/compositor/layer/content_layer.cc +++ b/chrome/browser/android/compositor/layer/content_layer.cc @@ -4,10 +4,12 @@ #include "chrome/browser/android/compositor/layer/content_layer.h" +#include "base/lazy_instance.h" #include "cc/layers/layer.h" #include "cc/layers/layer_lists.h" #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" #include "chrome/browser/android/compositor/tab_content_manager.h" +#include "content/public/browser/android/compositor.h" #include "ui/gfx/geometry/size.h" namespace chrome { @@ -161,7 +163,7 @@ scoped_refptr<cc::Layer> ContentLayer::layer() { } ContentLayer::ContentLayer(TabContentManager* tab_content_manager) - : layer_(cc::Layer::Create()), + : layer_(cc::Layer::Create(content::Compositor::LayerSettings())), content_attached_(false), static_attached_(false), tab_content_manager_(tab_content_manager) { diff --git a/chrome/browser/android/compositor/layer/contextual_search_layer.cc b/chrome/browser/android/compositor/layer/contextual_search_layer.cc index 23b96b2..715e724 100644 --- a/chrome/browser/android/compositor/layer/contextual_search_layer.cc +++ b/chrome/browser/android/compositor/layer/contextual_search_layer.cc @@ -8,6 +8,7 @@ #include "cc/layers/nine_patch_layer.h" #include "cc/layers/solid_color_layer.h" #include "cc/layers/ui_resource_layer.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/android/content_view_core.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/android/resources/resource_manager.h" @@ -294,18 +295,29 @@ void ContextualSearchLayer::SetProperties( ContextualSearchLayer::ContextualSearchLayer( ui::ResourceManager* resource_manager) : resource_manager_(resource_manager), - layer_(cc::Layer::Create()), - search_bar_background_(cc::NinePatchLayer::Create()), - search_bar_text_(cc::UIResourceLayer::Create()), - search_bar_shadow_(cc::UIResourceLayer::Create()), - search_provider_icon_(cc::UIResourceLayer::Create()), - search_icon_(cc::UIResourceLayer::Create()), - content_view_container_(cc::Layer::Create()), - search_bar_border_(cc::SolidColorLayer::Create()), - progress_bar_(cc::NinePatchLayer::Create()), - progress_bar_background_(cc::NinePatchLayer::Create()), - search_promo_(cc::UIResourceLayer::Create()), - search_promo_container_(cc::SolidColorLayer::Create()) { + layer_(cc::Layer::Create(content::Compositor::LayerSettings())), + search_bar_background_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + search_bar_text_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + search_bar_shadow_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + search_provider_icon_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + search_icon_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + content_view_container_( + cc::Layer::Create(content::Compositor::LayerSettings())), + search_bar_border_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), + progress_bar_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + progress_bar_background_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + search_promo_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + search_promo_container_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())) { layer_->SetMasksToBounds(false); layer_->SetIsDrawable(true); diff --git a/chrome/browser/android/compositor/layer/layer.h b/chrome/browser/android/compositor/layer/layer.h index b61bf90..5bbbede 100644 --- a/chrome/browser/android/compositor/layer/layer.h +++ b/chrome/browser/android/compositor/layer/layer.h @@ -11,6 +11,10 @@ #include "cc/output/filter_operations.h" #include "ui/gfx/geometry/size.h" +namespace cc { +class LayerSettings; +} + namespace chrome { namespace android { diff --git a/chrome/browser/android/compositor/layer/reader_mode_layer.cc b/chrome/browser/android/compositor/layer/reader_mode_layer.cc index 76a1759..54a3b57 100644 --- a/chrome/browser/android/compositor/layer/reader_mode_layer.cc +++ b/chrome/browser/android/compositor/layer/reader_mode_layer.cc @@ -10,6 +10,7 @@ #include "cc/layers/ui_resource_layer.h" #include "cc/output/filter_operation.h" #include "cc/output/filter_operations.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/android/content_view_core.h" #include "content/public/browser/web_contents.h" #include "third_party/skia/include/core/SkColor.h" @@ -115,15 +116,19 @@ void ReaderModeLayer::SetProperties( layer_->SetPosition(gfx::PointF(x, 0.f)); } -ReaderModeLayer::ReaderModeLayer( - ui::ResourceManager* resource_manager) +ReaderModeLayer::ReaderModeLayer(ui::ResourceManager* resource_manager) : resource_manager_(resource_manager), - layer_(cc::Layer::Create()), - panel_background_(cc::NinePatchLayer::Create()), - panel_text_(cc::UIResourceLayer::Create()), - content_shadow_(cc::NinePatchLayer::Create()), - content_solid_(cc::SolidColorLayer::Create()), - content_view_container_(cc::Layer::Create()) { + layer_(cc::Layer::Create(content::Compositor::LayerSettings())), + panel_background_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + panel_text_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + content_shadow_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + content_solid_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), + content_view_container_( + cc::Layer::Create(content::Compositor::LayerSettings())) { layer_->SetMasksToBounds(false); // Reader Mode Background diff --git a/chrome/browser/android/compositor/layer/tab_handle_layer.cc b/chrome/browser/android/compositor/layer/tab_handle_layer.cc index 4e72483..965e054 100644 --- a/chrome/browser/android/compositor/layer/tab_handle_layer.cc +++ b/chrome/browser/android/compositor/layer/tab_handle_layer.cc @@ -9,6 +9,7 @@ #include "cc/layers/solid_color_layer.h" #include "chrome/browser/android/compositor/decoration_title.h" #include "chrome/browser/android/compositor/layer_title_cache.h" +#include "content/public/browser/android/compositor.h" #include "ui/android/resources/resource_manager.h" #include "ui/android/resources/ui_resource_android.h" #include "ui/base/l10n/l10n_util_android.h" @@ -177,10 +178,13 @@ scoped_refptr<cc::Layer> TabHandleLayer::layer() { TabHandleLayer::TabHandleLayer(LayerTitleCache* layer_title_cache) : layer_title_cache_(layer_title_cache), - layer_(cc::Layer::Create()), - close_button_(cc::UIResourceLayer::Create()), - decoration_tab_(cc::NinePatchLayer::Create()), - border_(cc::SolidColorLayer::Create()), + layer_(cc::Layer::Create(content::Compositor::LayerSettings())), + close_button_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + decoration_tab_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + border_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), brightness_(1.0f), foreground_(false) { decoration_tab_->SetIsDrawable(true); diff --git a/chrome/browser/android/compositor/layer/tab_layer.cc b/chrome/browser/android/compositor/layer/tab_layer.cc index 7061166..a95fdd4 100644 --- a/chrome/browser/android/compositor/layer/tab_layer.cc +++ b/chrome/browser/android/compositor/layer/tab_layer.cc @@ -16,6 +16,7 @@ #include "chrome/browser/android/compositor/layer/toolbar_layer.h" #include "chrome/browser/android/compositor/layer_title_cache.h" #include "chrome/browser/android/compositor/tab_content_manager.h" +#include "content/public/browser/android/compositor.h" #include "ui/android/resources/resource_manager.h" #include "ui/android/resources/ui_resource_android.h" #include "ui/base/l10n/l10n_util_android.h" @@ -530,16 +531,21 @@ TabLayer::TabLayer(bool incognito, : incognito_(incognito), resource_manager_(resource_manager), layer_title_cache_(layer_title_cache), - layer_(cc::Layer::Create()), + layer_(cc::Layer::Create(content::Compositor::LayerSettings())), toolbar_layer_(ToolbarLayer::Create()), - title_(cc::Layer::Create()), + title_(cc::Layer::Create(content::Compositor::LayerSettings())), content_(ContentLayer::Create(tab_content_manager)), - padding_(cc::SolidColorLayer::Create()), - close_button_(cc::UIResourceLayer::Create()), - front_border_(cc::NinePatchLayer::Create()), - contour_shadow_(cc::NinePatchLayer::Create()), - shadow_(cc::NinePatchLayer::Create()), - back_logo_(cc::UIResourceLayer::Create()), + padding_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), + close_button_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + front_border_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + contour_shadow_( + cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + shadow_(cc::NinePatchLayer::Create(content::Compositor::LayerSettings())), + back_logo_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), brightness_(1.f) { layer_->AddChild(shadow_); layer_->AddChild(contour_shadow_); diff --git a/chrome/browser/android/compositor/layer/thumbnail_layer.cc b/chrome/browser/android/compositor/layer/thumbnail_layer.cc index 6d205cb..b18555a 100644 --- a/chrome/browser/android/compositor/layer/thumbnail_layer.cc +++ b/chrome/browser/android/compositor/layer/thumbnail_layer.cc @@ -6,6 +6,7 @@ #include "cc/layers/ui_resource_layer.h" #include "chrome/browser/android/thumbnail/thumbnail.h" +#include "content/public/browser/android/compositor.h" #include "ui/gfx/geometry/size_conversions.h" namespace chrome { @@ -49,7 +50,9 @@ scoped_refptr<cc::Layer> ThumbnailLayer::layer() { return layer_; } -ThumbnailLayer::ThumbnailLayer() : layer_(cc::UIResourceLayer::Create()) { +ThumbnailLayer::ThumbnailLayer() + : layer_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())) { layer_->SetIsDrawable(true); } diff --git a/chrome/browser/android/compositor/layer/toolbar_layer.cc b/chrome/browser/android/compositor/layer/toolbar_layer.cc index 10ef0cf..085286c 100644 --- a/chrome/browser/android/compositor/layer/toolbar_layer.cc +++ b/chrome/browser/android/compositor/layer/toolbar_layer.cc @@ -6,6 +6,7 @@ #include "cc/layers/solid_color_layer.h" #include "cc/layers/ui_resource_layer.h" +#include "content/public/browser/android/compositor.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/android/resources/resource_manager.h" #include "ui/android/resources/ui_resource_android.h" @@ -64,11 +65,15 @@ void ToolbarLayer::PushResource( } ToolbarLayer::ToolbarLayer() - : layer_(cc::Layer::Create()), - bitmap_layer_(cc::UIResourceLayer::Create()), - progress_layer_(cc::UIResourceLayer::Create()), - anonymize_layer_(cc::SolidColorLayer::Create()), - debug_layer_(cc::SolidColorLayer::Create()) { + : layer_(cc::Layer::Create(content::Compositor::LayerSettings())), + bitmap_layer_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + progress_layer_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + anonymize_layer_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), + debug_layer_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())) { bitmap_layer_->SetIsDrawable(true); layer_->AddChild(bitmap_layer_); diff --git a/chrome/browser/android/compositor/scene_layer/scene_layer.cc b/chrome/browser/android/compositor/scene_layer/scene_layer.cc index ee8eeba..33d4c21 100644 --- a/chrome/browser/android/compositor/scene_layer/scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/scene_layer.cc @@ -5,6 +5,7 @@ #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" #include "cc/layers/layer.h" +#include "content/public/browser/android/compositor.h" #include "jni/SceneLayer_jni.h" namespace chrome { @@ -18,7 +19,9 @@ SceneLayer* SceneLayer::FromJavaObject(JNIEnv* env, jobject jobj) { } SceneLayer::SceneLayer(JNIEnv* env, jobject jobj) - : SceneLayer(env, jobj, cc::Layer::Create()) { + : SceneLayer(env, + jobj, + cc::Layer::Create(content::Compositor::LayerSettings())) { } SceneLayer::SceneLayer(JNIEnv* env, diff --git a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc index b6d67cd..f6623d7 100644 --- a/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc @@ -8,6 +8,7 @@ #include "chrome/browser/android/compositor/layer/content_layer.h" #include "chrome/browser/android/compositor/layer_title_cache.h" #include "chrome/browser/android/compositor/tab_content_manager.h" +#include "content/public/browser/android/compositor.h" #include "jni/StaticTabSceneLayer_jni.h" #include "third_party/skia/include/core/SkColor.h" diff --git a/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc index 5001bcd..f98ab5d 100644 --- a/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc @@ -9,6 +9,7 @@ #include "chrome/browser/android/compositor/layer/tab_layer.h" #include "chrome/browser/android/compositor/layer_title_cache.h" #include "chrome/browser/android/compositor/tab_content_manager.h" +#include "content/public/browser/android/compositor.h" #include "jni/TabListSceneLayer_jni.h" #include "ui/android/resources/resource_manager_impl.h" @@ -23,7 +24,7 @@ TabListSceneLayer::TabListSceneLayer(JNIEnv* env, jobject jobj) layer_title_cache_(nullptr), tab_content_manager_(nullptr), background_color_(SK_ColorWHITE), - own_tree_(cc::Layer::Create()) { + own_tree_(cc::Layer::Create(content::Compositor::LayerSettings())) { layer()->AddChild(own_tree_); } diff --git a/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc index 3a997a1..be0c944 100644 --- a/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/tab_strip_scene_layer.cc @@ -7,6 +7,7 @@ #include "base/android/jni_android.h" #include "chrome/browser/android/compositor/layer/tab_handle_layer.h" #include "chrome/browser/android/compositor/layer_title_cache.h" +#include "content/public/browser/android/compositor.h" #include "jni/TabStripSceneLayer_jni.h" #include "ui/android/resources/resource_manager_impl.h" #include "ui/android/resources/ui_resource_android.h" @@ -16,9 +17,12 @@ namespace android { TabStripSceneLayer::TabStripSceneLayer(JNIEnv* env, jobject jobj) : SceneLayer(env, jobj), - background_layer_(cc::SolidColorLayer::Create()), - new_tab_button_(cc::UIResourceLayer::Create()), - model_selector_button_(cc::UIResourceLayer::Create()), + background_layer_( + cc::SolidColorLayer::Create(content::Compositor::LayerSettings())), + new_tab_button_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), + model_selector_button_( + cc::UIResourceLayer::Create(content::Compositor::LayerSettings())), strip_brightness_(1.f), write_index_(0), content_tree_(nullptr) { diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc index fc37e02..aaf9814 100644 --- a/chrome/browser/android/tab_android.cc +++ b/chrome/browser/android/tab_android.cc @@ -57,6 +57,7 @@ #include "components/navigation_interception/intercept_navigation_delegate.h" #include "components/navigation_interception/navigation_params.h" #include "components/url_fixer/url_fixer.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/android/content_view_core.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/interstitial_page.h" @@ -121,7 +122,7 @@ void TabAndroid::AttachTabHelpers(content::WebContents* web_contents) { TabAndroid::TabAndroid(JNIEnv* env, jobject obj) : weak_java_tab_(env, obj), - content_layer_(cc::Layer::Create()), + content_layer_(cc::Layer::Create(content::Compositor::LayerSettings())), tab_content_manager_(NULL), synced_tab_delegate_(new browser_sync::SyncedTabDelegateAndroid(this)) { Java_Tab_setNativePtr(env, obj, reinterpret_cast<intptr_t>(this)); diff --git a/content/browser/android/composited_touch_handle_drawable.cc b/content/browser/android/composited_touch_handle_drawable.cc index 91a019e..5021896 100644 --- a/content/browser/android/composited_touch_handle_drawable.cc +++ b/content/browser/android/composited_touch_handle_drawable.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "cc/layers/ui_resource_layer.h" +#include "content/public/browser/android/compositor.h" #include "jni/HandleViewResources_jni.h" #include "ui/gfx/android/java_bitmap.h" @@ -84,7 +85,7 @@ CompositedTouchHandleDrawable::CompositedTouchHandleDrawable( jobject context) : dpi_scale_(dpi_scale), orientation_(ui::TouchHandleOrientation::UNDEFINED), - layer_(cc::UIResourceLayer::Create()) { + layer_(cc::UIResourceLayer::Create(Compositor::LayerSettings())) { g_selection_resources.Get().LoadIfNecessary(context); DCHECK(root_layer); root_layer->AddChild(layer_.get()); diff --git a/content/browser/android/content_startup_flags.cc b/content/browser/android/content_startup_flags.cc index 93b8299..6ebe4e1 100644 --- a/content/browser/android/content_startup_flags.cc +++ b/content/browser/android/content_startup_flags.cc @@ -11,6 +11,8 @@ #include "base/strings/string_number_conversions.h" #include "base/sys_info.h" #include "cc/base/switches.h" +#include "cc/trees/layer_tree_settings.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" @@ -93,6 +95,12 @@ void SetContentCommandLineFlags(bool single_process, parsed_command_line->AppendSwitchASCII( switches::kProfilerTiming, switches::kProfilerTimingDisabledValue); } + + cc::LayerSettings layer_settings; + if (parsed_command_line->HasSwitch( + switches::kEnableAndroidCompositorAnimationTimelines)) + layer_settings.use_compositor_animation_timelines = true; + Compositor::SetLayerSettings(layer_settings); } } // namespace content diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc index 3e88acc..ead8407 100644 --- a/content/browser/android/content_view_core_impl.cc +++ b/content/browser/android/content_view_core_impl.cc @@ -37,6 +37,7 @@ #include "content/common/input/web_input_event_traits.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/favicon_status.h" @@ -220,7 +221,7 @@ ContentViewCoreImpl::ContentViewCoreImpl( : WebContentsObserver(web_contents), java_ref_(env, obj), web_contents_(static_cast<WebContentsImpl*>(web_contents)), - root_layer_(cc::SolidColorLayer::Create()), + root_layer_(cc::SolidColorLayer::Create(Compositor::LayerSettings())), dpi_scale_(GetPrimaryDisplayDeviceScaleFactor()), view_android_(new ui::ViewAndroid(view_android_delegate, window_android)), window_android_(window_android), diff --git a/content/browser/android/edge_effect.cc b/content/browser/android/edge_effect.cc index f1b6ee8..f7cafddc 100644 --- a/content/browser/android/edge_effect.cc +++ b/content/browser/android/edge_effect.cc @@ -7,6 +7,7 @@ #include "cc/layers/layer.h" #include "cc/layers/ui_resource_layer.h" #include "content/browser/android/animation_utils.h" +#include "content/public/browser/android/compositor.h" #include "ui/android/resources/resource_manager.h" #include "ui/android/resources/system_ui_resource_type.h" @@ -63,7 +64,8 @@ class EdgeEffect::EffectLayer { public: EffectLayer(ui::SystemUIResourceType resource_type, ui::ResourceManager* resource_manager) - : ui_resource_layer_(cc::UIResourceLayer::Create()), + : ui_resource_layer_( + cc::UIResourceLayer::Create(Compositor::LayerSettings())), resource_type_(resource_type), resource_manager_(resource_manager) {} diff --git a/content/browser/android/edge_effect_l.cc b/content/browser/android/edge_effect_l.cc index 728db67..d67d4c2 100644 --- a/content/browser/android/edge_effect_l.cc +++ b/content/browser/android/edge_effect_l.cc @@ -6,6 +6,7 @@ #include "cc/layers/ui_resource_layer.h" #include "content/browser/android/animation_utils.h" +#include "content/public/browser/android/compositor.h" #include "ui/android/resources/resource_manager.h" #include "ui/android/resources/system_ui_resource_type.h" @@ -48,7 +49,7 @@ const ui::SystemUIResourceType kResourceId = ui::OVERSCROLL_GLOW_L; EdgeEffectL::EdgeEffectL(ui::ResourceManager* resource_manager) : resource_manager_(resource_manager), - glow_(cc::UIResourceLayer::Create()), + glow_(cc::UIResourceLayer::Create(Compositor::LayerSettings())), glow_alpha_(0), glow_scale_y_(0), glow_alpha_start_(0), diff --git a/content/browser/android/overscroll_glow.cc b/content/browser/android/overscroll_glow.cc index 6842becaf..0aa00e0 100644 --- a/content/browser/android/overscroll_glow.cc +++ b/content/browser/android/overscroll_glow.cc @@ -6,6 +6,7 @@ #include "cc/layers/layer.h" #include "content/browser/android/edge_effect_base.h" +#include "content/public/browser/android/compositor.h" using std::max; using std::min; @@ -219,7 +220,7 @@ bool OverscrollGlow::InitializeIfNecessary() { return true; DCHECK(!root_layer_.get()); - root_layer_ = cc::Layer::Create(); + root_layer_ = cc::Layer::Create(Compositor::LayerSettings()); for (size_t i = 0; i < EDGE_COUNT; ++i) { edge_effects_[i] = client_->CreateEdgeEffect(); DCHECK(edge_effects_[i]); diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 4ac6ce1..910d197 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -47,6 +47,7 @@ #include "ui/compositor/compositor.h" #include "ui/compositor/compositor_constants.h" #include "ui/compositor/compositor_switches.h" +#include "ui/compositor/layer.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" @@ -102,6 +103,8 @@ GpuProcessTransportFactory::GpuProcessTransportFactory() : next_surface_id_namespace_(1u), task_graph_runner_(new cc::TaskGraphRunner), callback_factory_(this) { + ui::Layer::InitializeUILayerSettings(); + if (UseSurfacesEnabled()) surface_manager_ = make_scoped_ptr(new cc::SurfaceManager); diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index f042c0a..6914bd4 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -36,6 +36,7 @@ #include "cc/surfaces/surface_id_allocator.h" #include "cc/surfaces/surface_manager.h" #include "cc/trees/layer_tree_host.h" +#include "cc/trees/layer_tree_settings.h" #include "content/browser/android/child_process_launcher_android.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" @@ -49,6 +50,7 @@ #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/gpu/gpu_process_launch_causes.h" #include "content/common/host_shared_bitmap_manager.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/android/compositor_client.h" #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" #include "gpu/command_buffer/client/context_support.h" @@ -164,6 +166,9 @@ class SingleThreadTaskGraphRunner base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<cc::LayerSettings> g_layer_settings = + LAZY_INSTANCE_INITIALIZER; + } // anonymous namespace // static @@ -180,6 +185,16 @@ void Compositor::Initialize() { } // static +const cc::LayerSettings& Compositor::LayerSettings() { + return g_layer_settings.Get(); +} + +// static +void Compositor::SetLayerSettings(const cc::LayerSettings& settings) { + g_layer_settings.Get() = settings; +} + +// static bool CompositorImpl::IsInitialized() { return g_initialized; } @@ -198,7 +213,7 @@ scoped_ptr<cc::SurfaceIdAllocator> CompositorImpl::CreateSurfaceIdAllocator() { CompositorImpl::CompositorImpl(CompositorClient* client, gfx::NativeWindow root_window) - : root_layer_(cc::Layer::Create()), + : root_layer_(cc::Layer::Create(Compositor::LayerSettings())), resource_manager_(&ui_resource_provider_), surface_id_allocator_(CreateSurfaceIdAllocator()), has_transparent_background_(false), diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 0576b33..aba2dc5 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -63,6 +63,7 @@ #include "content/common/input/did_overscroll_params.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" +#include "content/public/browser/android/compositor.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/render_view_host.h" @@ -470,13 +471,15 @@ scoped_refptr<cc::Layer> RenderWidgetHostViewAndroid::CreateDelegatedLayer() DCHECK(manager); // manager must outlive compositors using it. scoped_refptr<cc::SurfaceLayer> surface_layer = cc::SurfaceLayer::Create( + Compositor::LayerSettings(), base::Bind(&SatisfyCallback, base::Unretained(manager)), base::Bind(&RequireCallback, base::Unretained(manager))); surface_layer->SetSurfaceId(surface_id_, 1.f, texture_size_in_layer_); delegated_layer = surface_layer; } else { DCHECK(frame_provider_.get()); - delegated_layer = cc::DelegatedRendererLayer::Create(frame_provider_); + delegated_layer = cc::DelegatedRendererLayer::Create( + Compositor::LayerSettings(), frame_provider_); } delegated_layer->SetBounds(content_size_in_layer_); delegated_layer->SetIsDrawable(true); @@ -1093,7 +1096,8 @@ void RenderWidgetHostViewAndroid::SubmitFrame( RemoveLayers(); frame_provider_ = new cc::DelegatedFrameProvider( resource_collection_.get(), frame_data.Pass()); - layer_ = cc::DelegatedRendererLayer::Create(frame_provider_); + layer_ = cc::DelegatedRendererLayer::Create(Compositor::LayerSettings(), + frame_provider_); AttachLayers(); } else { frame_provider_->SetFrameData(frame_data.Pass()); diff --git a/content/public/browser/android/compositor.h b/content/public/browser/android/compositor.h index 1a96ee6..6ce49e9 100644 --- a/content/public/browser/android/compositor.h +++ b/content/public/browser/android/compositor.h @@ -17,6 +17,7 @@ class SkBitmap; namespace cc { class Layer; +class LayerSettings; } namespace gfx { @@ -45,6 +46,9 @@ class CONTENT_EXPORT Compositor { static Compositor* Create(CompositorClient* client, gfx::NativeWindow root_window); + static const cc::LayerSettings& LayerSettings(); + static void SetLayerSettings(const cc::LayerSettings& settings); + // Attaches the layer tree. virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 1240df9..d6e86f5 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -939,6 +939,11 @@ const char kDisableScreenOrientationLock[] = "disable-screen-orientation-lock"; // WebRTC is enabled by default on Android. const char kDisableWebRTC[] = "disable-webrtc"; +// Enable external animation system for Android compositor. +// See also kEnableCompositorAnimationTimelines for renderer compositors. +const char kEnableAndroidCompositorAnimationTimelines[] = + "enable-android-compositor-animation-timelines"; + // The telephony region (ISO country code) to use in phone number detection. const char kNetworkCountryIso[] = "network-country-iso"; diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 971539d..80de1f0 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -264,6 +264,7 @@ CONTENT_EXPORT extern const char kDisableOverscrollEdgeEffect[]; CONTENT_EXPORT extern const char kDisablePullToRefreshEffect[]; CONTENT_EXPORT extern const char kDisableScreenOrientationLock[]; CONTENT_EXPORT extern const char kDisableWebRTC[]; +CONTENT_EXPORT extern const char kEnableAndroidCompositorAnimationTimelines[]; CONTENT_EXPORT extern const char kHideScrollbars[]; extern const char kNetworkCountryIso[]; CONTENT_EXPORT extern const char kRemoteDebuggingSocketName[]; diff --git a/content/public/test/layouttest_support.h b/content/public/test/layouttest_support.h index 0d7cfa9..8f6d9da 100644 --- a/content/public/test/layouttest_support.h +++ b/content/public/test/layouttest_support.h @@ -130,6 +130,10 @@ void DisableAutoResizeMode(RenderView* render_view, std::string DumpBackForwardList(std::vector<PageState>& page_state, size_t current_index); +// Creates cc::TextureLayer for TestPlugin. +scoped_refptr<cc::TextureLayer> CreateTextureLayerForMailbox( + cc::TextureLayerClient* client); + // Instantiates WebLayerImpl for TestPlugin. blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer); diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc index 4ac2315..550152b 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc @@ -133,7 +133,8 @@ void ChildFrameCompositingHelper::DidCommitCompositorFrame() { void ChildFrameCompositingHelper::EnableCompositing(bool enable) { if (enable && !background_layer_.get()) { - background_layer_ = cc::SolidColorLayer::Create(); + background_layer_ = + cc::SolidColorLayer::Create(cc_blink::WebLayerImpl::LayerSettings()); background_layer_->SetMasksToBounds(true); background_layer_->SetBackgroundColor( SkColorSetARGBInline(255, 255, 255, 255)); @@ -240,8 +241,8 @@ void ChildFrameCompositingHelper::OnCompositorFrameSwapped( resource_collection_.get(), frame->delegated_frame_data.Pass()); if (delegated_layer_.get()) delegated_layer_->RemoveFromParent(); - delegated_layer_ = - cc::DelegatedRendererLayer::Create(frame_provider_.get()); + delegated_layer_ = cc::DelegatedRendererLayer::Create( + cc_blink::WebLayerImpl::LayerSettings(), frame_provider_.get()); delegated_layer_->SetIsDrawable(true); buffer_size_ = gfx::Size(); SetContentsOpaque(opaque_); diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index 06adef1..c1616a3 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -231,8 +231,8 @@ void RenderWidgetCompositor::Initialize() { settings.accelerated_animation_enabled = !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); settings.use_display_lists = cmd->HasSwitch(switches::kEnableSlimmingPaint); + settings.hud_layer_settings = cc_blink::WebLayerImpl::LayerSettings(); if (cmd->HasSwitch(switches::kEnableCompositorAnimationTimelines)) { - settings.use_compositor_animation_timelines = true; blink::WebRuntimeFeatures::enableCompositorAnimationTimelines(true); } diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index a84941e..ec36cf2 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc @@ -902,7 +902,8 @@ void WebMediaPlayerAndroid::OnVideoSizeChanged(int width, int height) { // Lazily allocate compositing layer. if (!video_weblayer_) { video_weblayer_.reset(new cc_blink::WebLayerImpl( - cc::VideoLayer::Create(this, media::VIDEO_ROTATION_0))); + cc::VideoLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), this, + media::VIDEO_ROTATION_0))); client_->setWebLayer(video_weblayer_.get()); } diff --git a/content/renderer/media/webmediaplayer_ms.cc b/content/renderer/media/webmediaplayer_ms.cc index 556d58a..bbf65b7 100644 --- a/content/renderer/media/webmediaplayer_ms.cc +++ b/content/renderer/media/webmediaplayer_ms.cc @@ -504,7 +504,8 @@ void WebMediaPlayerMS::OnFrameAvailable( if (video_frame_provider_.get()) { video_weblayer_.reset(new cc_blink::WebLayerImpl( - cc::VideoLayer::Create(this, media::VIDEO_ROTATION_0))); + cc::VideoLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), this, + media::VIDEO_ROTATION_0))); video_weblayer_->setOpaque(true); GetClient()->setWebLayer(video_weblayer_.get()); } diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc index 558cd47..f0f3396 100644 --- a/content/renderer/npapi/webplugin_impl.cc +++ b/content/renderer/npapi/webplugin_impl.cc @@ -861,7 +861,8 @@ void WebPluginImpl::AcceleratedPluginSwappedIOSurface() { if (next_io_surface_allocated_) { if (next_io_surface_id_) { if (!io_surface_layer_.get()) { - io_surface_layer_ = cc::IOSurfaceLayer::Create(); + io_surface_layer_ = + cc::IOSurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings()); web_layer_.reset(new cc_blink::WebLayerImpl(io_surface_layer_)); container_->setWebLayer(web_layer_.get()); } diff --git a/content/renderer/pepper/pepper_compositor_host.cc b/content/renderer/pepper/pepper_compositor_host.cc index d366db4..e0045d9 100644 --- a/content/renderer/pepper/pepper_compositor_host.cc +++ b/content/renderer/pepper/pepper_compositor_host.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/memory/shared_memory.h" +#include "cc/blink/web_layer_impl.h" #include "cc/layers/layer.h" #include "cc/layers/solid_color_layer.h" #include "cc/layers/texture_layer.h" @@ -160,7 +161,7 @@ PepperCompositorHost::PepperCompositorHost( : ResourceHost(host->GetPpapiHost(), instance, resource), bound_instance_(NULL), weak_factory_(this) { - layer_ = cc::Layer::Create(); + layer_ = cc::Layer::Create(cc_blink::WebLayerImpl::LayerSettings()); // TODO(penghuang): SetMasksToBounds() can be expensive if the layer is // transformed. Possibly better could be to explicitly clip the child layers // (by modifying their bounds). @@ -247,7 +248,7 @@ void PepperCompositorHost::UpdateLayer( scoped_refptr<cc::Layer> clip_parent = layer->parent(); if (clip_parent.get() == layer_.get()) { // Create a clip parent layer, if it does not exist. - clip_parent = cc::Layer::Create(); + clip_parent = cc::Layer::Create(cc_blink::WebLayerImpl::LayerSettings()); clip_parent->SetMasksToBounds(true); clip_parent->SetIsDrawable(true); layer_->ReplaceChild(layer.get(), clip_parent); @@ -389,9 +390,11 @@ int32_t PepperCompositorHost::OnHostMsgCommitLayers( if (!cc_layer.get()) { if (pp_layer->color) - cc_layer = cc::SolidColorLayer::Create(); + cc_layer = cc::SolidColorLayer::Create( + cc_blink::WebLayerImpl::LayerSettings()); else if (pp_layer->texture || pp_layer->image) - cc_layer = cc::TextureLayer::CreateForMailbox(NULL); + cc_layer = cc::TextureLayer::CreateForMailbox( + cc_blink::WebLayerImpl::LayerSettings(), NULL); layer_->AddChild(cc_layer); } diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 576f7a0..4246837 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -2049,13 +2049,15 @@ void PepperPluginInstanceImpl::UpdateLayer(bool device_changed) { bool opaque = false; if (want_3d_layer) { DCHECK(bound_graphics_3d_.get()); - texture_layer_ = cc::TextureLayer::CreateForMailbox(NULL); + texture_layer_ = cc::TextureLayer::CreateForMailbox( + cc_blink::WebLayerImpl::LayerSettings(), NULL); opaque = bound_graphics_3d_->IsOpaque(); texture_layer_->SetTextureMailboxWithoutReleaseCallback( cc::TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point)); } else { DCHECK(bound_graphics_2d_platform_); - texture_layer_ = cc::TextureLayer::CreateForMailbox(this); + texture_layer_ = cc::TextureLayer::CreateForMailbox( + cc_blink::WebLayerImpl::LayerSettings(), this); bound_graphics_2d_platform_->AttachedToNewLayer(); opaque = bound_graphics_2d_platform_->IsAlwaysOpaque(); texture_layer_->SetFlipped(false); diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index f4407f0..bc9e6e9 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc @@ -33,6 +33,7 @@ #include "cc/blink/web_external_bitmap_impl.h" #include "cc/blink/web_layer_impl.h" #include "cc/raster/task_graph_runner.h" +#include "cc/trees/layer_tree_settings.h" #include "components/scheduler/renderer/renderer_scheduler.h" #include "content/child/appcache/appcache_dispatcher.h" #include "content/child/appcache/appcache_frontend_impl.h" @@ -576,6 +577,11 @@ void RenderThreadImpl::Init() { cc_blink::WebLayerImpl::SetImplSidePaintingEnabled( is_impl_side_painting_enabled_); + cc::LayerSettings layer_settings; + if (command_line.HasSwitch(switches::kEnableCompositorAnimationTimelines)) + layer_settings.use_compositor_animation_timelines = true; + cc_blink::WebLayerImpl::SetLayerSettings(layer_settings); + is_zero_copy_enabled_ = command_line.HasSwitch(switches::kEnableZeroCopy); is_one_copy_enabled_ = !command_line.HasSwitch(switches::kDisableOneCopy); diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc index 4611768..a69c2ff 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.cc +++ b/content/shell/renderer/layout_test/blink_test_runner.cc @@ -639,6 +639,11 @@ void BlinkTestRunner::ResetPermissions() { Send(new LayoutTestHostMsg_ResetPermissions(routing_id())); } +scoped_refptr<cc::TextureLayer> BlinkTestRunner::CreateTextureLayerForMailbox( + cc::TextureLayerClient* client) { + return ::content::CreateTextureLayerForMailbox(client); +} + blink::WebLayer* BlinkTestRunner::InstantiateWebLayer( scoped_refptr<cc::TextureLayer> layer) { return ::content::InstantiateWebLayer(layer); diff --git a/content/shell/renderer/layout_test/blink_test_runner.h b/content/shell/renderer/layout_test/blink_test_runner.h index aa08e03..42e1a69 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.h +++ b/content/shell/renderer/layout_test/blink_test_runner.h @@ -119,6 +119,8 @@ class BlinkTestRunner : public RenderViewObserver, const GURL& origin, const GURL& embedding_origin) override; void ResetPermissions() override; + scoped_refptr<cc::TextureLayer> CreateTextureLayerForMailbox( + cc::TextureLayerClient* client) override; blink::WebLayer* InstantiateWebLayer( scoped_refptr<cc::TextureLayer> layer) override; cc::SharedBitmapManager* GetSharedBitmapManager() override; diff --git a/content/shell/renderer/test_runner/test_plugin.cc b/content/shell/renderer/test_runner/test_plugin.cc index 9092a4d..26600f3 100644 --- a/content/shell/renderer/test_runner/test_plugin.cc +++ b/content/shell/renderer/test_runner/test_plugin.cc @@ -221,7 +221,7 @@ bool TestPlugin::initialize(blink::WebPluginContainer* container) { if (!InitScene()) return false; - layer_ = cc::TextureLayer::CreateForMailbox(this); + layer_ = delegate_->CreateTextureLayerForMailbox(this); web_layer_ = make_scoped_ptr(delegate_->InstantiateWebLayer(layer_)); container_ = container; container_->setWebLayer(web_layer_.get()); diff --git a/content/shell/renderer/test_runner/web_test_delegate.h b/content/shell/renderer/test_runner/web_test_delegate.h index 09d68d2..7fcae24 100644 --- a/content/shell/renderer/test_runner/web_test_delegate.h +++ b/content/shell/renderer/test_runner/web_test_delegate.h @@ -35,6 +35,7 @@ struct WebURLError; namespace cc { class TextureLayer; +class TextureLayerClient; class SharedBitmapManager; } @@ -222,6 +223,10 @@ class WebTestDelegate { // Clear all the permissions set via SetPermission(). virtual void ResetPermissions() = 0; + // Creates cc::TextureLayer for TestPlugin. + virtual scoped_refptr<cc::TextureLayer> CreateTextureLayerForMailbox( + cc::TextureLayerClient* client) = 0; + // Instantiates WebLayerImpl for TestPlugin. virtual blink::WebLayer* InstantiateWebLayer( scoped_refptr<cc::TextureLayer> layer) = 0; diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc index c2a6e93..f55f1ad 100644 --- a/content/test/layouttest_support.cc +++ b/content/test/layouttest_support.cc @@ -424,6 +424,12 @@ std::string DumpBackForwardList(std::vector<PageState>& page_state, return result; } +scoped_refptr<cc::TextureLayer> CreateTextureLayerForMailbox( + cc::TextureLayerClient* client) { + return cc::TextureLayer::CreateForMailbox( + cc_blink::WebLayerImpl::LayerSettings(), client); +} + blink::WebLayer* InstantiateWebLayer(scoped_refptr<cc::TextureLayer> layer) { return new cc_blink::WebLayerImpl(layer); } diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc index 5835e63..f48f982 100644 --- a/media/blink/webmediaplayer_impl.cc +++ b/media/blink/webmediaplayer_impl.cc @@ -777,7 +777,8 @@ void WebMediaPlayerImpl::OnPipelineMetadata( if (hasVideo()) { DCHECK(!video_weblayer_); scoped_refptr<cc::VideoLayer> layer = - cc::VideoLayer::Create(compositor_, pipeline_metadata_.video_rotation); + cc::VideoLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), + compositor_, pipeline_metadata_.video_rotation); if (pipeline_metadata_.video_rotation == VIDEO_ROTATION_90 || pipeline_metadata_.video_rotation == VIDEO_ROTATION_270) { diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 2f36055..aaa8708 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -81,11 +81,13 @@ Compositor::Compositor(gfx::AcceleratedWidget widget, compositor_lock_(NULL), layer_animator_collection_(this), weak_ptr_factory_(this) { - root_web_layer_ = cc::Layer::Create(); + root_web_layer_ = cc::Layer::Create(Layer::UILayerSettings()); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); cc::LayerTreeSettings settings; + settings.hud_layer_settings = Layer::UILayerSettings(); + // When impl-side painting is enabled, this will ensure PictureLayers always // can have LCD text, to match the previous behaviour with ContentLayers, // where LCD-not-allowed notifications were ignored. @@ -136,9 +138,6 @@ Compositor::Compositor(gfx::AcceleratedWidget widget, // raster threads. settings.gather_pixel_refs = false; - settings.use_compositor_animation_timelines = - command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); - base::TimeTicks before_create = base::TimeTicks::Now(); cc::LayerTreeHost::InitParams params; diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index c013cb7..8625815 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -26,6 +26,7 @@ #include "cc/output/filter_operation.h" #include "cc/output/filter_operations.h" #include "cc/resources/transferable_resource.h" +#include "cc/trees/layer_tree_settings.h" #include "ui/compositor/compositor_switches.h" #include "ui/compositor/dip_util.h" #include "ui/compositor/layer_animator.h" @@ -55,6 +56,9 @@ struct UIImplSidePaintingStatus { base::LazyInstance<UIImplSidePaintingStatus> g_ui_impl_side_painting_status = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance<cc::LayerSettings> g_ui_layer_settings = + LAZY_INSTANCE_INITIALIZER; + } // namespace namespace ui { @@ -133,6 +137,18 @@ bool Layer::UsingPictureLayer() { return g_ui_impl_side_painting_status.Get().enabled; } +// static +const cc::LayerSettings& Layer::UILayerSettings() { + return g_ui_layer_settings.Get(); +} + +// static +void Layer::InitializeUILayerSettings() { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines)) + g_ui_layer_settings.Get().use_compositor_animation_timelines = true; +} + const Compositor* Layer::GetCompositor() const { return GetRoot(this)->compositor_; } @@ -522,9 +538,9 @@ void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) { void Layer::SwitchCCLayerForTest() { scoped_refptr<cc::Layer> new_layer; if (Layer::UsingPictureLayer()) - new_layer = cc::PictureLayer::Create(this); + new_layer = cc::PictureLayer::Create(UILayerSettings(), this); else - new_layer = cc::ContentLayer::Create(this); + new_layer = cc::ContentLayer::Create(UILayerSettings(), this); SwitchToLayer(new_layer); content_layer_ = new_layer; } @@ -538,7 +554,7 @@ void Layer::SetTextureMailbox( DCHECK(release_callback); if (!texture_layer_.get()) { scoped_refptr<cc::TextureLayer> new_layer = - cc::TextureLayer::CreateForMailbox(this); + cc::TextureLayer::CreateForMailbox(UILayerSettings(), this); new_layer->SetFlipped(true); SwitchToLayer(new_layer); texture_layer_ = new_layer; @@ -577,7 +593,7 @@ void Layer::SetShowDelegatedContent(cc::DelegatedFrameProvider* frame_provider, DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); scoped_refptr<cc::DelegatedRendererLayer> new_layer = - cc::DelegatedRendererLayer::Create(frame_provider); + cc::DelegatedRendererLayer::Create(UILayerSettings(), frame_provider); SwitchToLayer(new_layer); delegated_renderer_layer_ = new_layer; @@ -594,8 +610,8 @@ void Layer::SetShowSurface( gfx::Size frame_size_in_dip) { DCHECK(type_ == LAYER_TEXTURED || type_ == LAYER_SOLID_COLOR); - scoped_refptr<cc::SurfaceLayer> new_layer = - cc::SurfaceLayer::Create(satisfy_callback, require_callback); + scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create( + UILayerSettings(), satisfy_callback, require_callback); new_layer->SetSurfaceId(surface_id, scale, surface_size); SwitchToLayer(new_layer); surface_layer_ = new_layer; @@ -610,7 +626,8 @@ void Layer::SetShowSolidColorContent() { if (solid_color_layer_.get()) return; - scoped_refptr<cc::SolidColorLayer> new_layer = cc::SolidColorLayer::Create(); + scoped_refptr<cc::SolidColorLayer> new_layer = + cc::SolidColorLayer::Create(UILayerSettings()); SwitchToLayer(new_layer); solid_color_layer_ = new_layer; @@ -1029,16 +1046,16 @@ void Layer::SendPendingThreadedAnimations() { void Layer::CreateCcLayer() { if (type_ == LAYER_SOLID_COLOR) { - solid_color_layer_ = cc::SolidColorLayer::Create(); + solid_color_layer_ = cc::SolidColorLayer::Create(UILayerSettings()); cc_layer_ = solid_color_layer_.get(); } else if (type_ == LAYER_NINE_PATCH) { - nine_patch_layer_ = cc::NinePatchLayer::Create(); + nine_patch_layer_ = cc::NinePatchLayer::Create(UILayerSettings()); cc_layer_ = nine_patch_layer_.get(); } else { if (Layer::UsingPictureLayer()) - content_layer_ = cc::PictureLayer::Create(this); + content_layer_ = cc::PictureLayer::Create(UILayerSettings(), this); else - content_layer_ = cc::ContentLayer::Create(this); + content_layer_ = cc::ContentLayer::Create(UILayerSettings(), this); cc_layer_ = content_layer_.get(); } cc_layer_->SetTransformOrigin(gfx::Point3F()); diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index 571bdbf..066d079 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -78,6 +78,9 @@ class COMPOSITOR_EXPORT Layer static bool UsingPictureLayer(); + static const cc::LayerSettings& UILayerSettings(); + static void InitializeUILayerSettings(); + // Retrieves the Layer's compositor. The Layer will walk up its parent chain // to locate it. Returns NULL if the Layer is not attached to a compositor. Compositor* GetCompositor() { diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc index 1676378..b69cead 100644 --- a/ui/compositor/test/in_process_context_factory.cc +++ b/ui/compositor/test/in_process_context_factory.cc @@ -19,6 +19,7 @@ #include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" #include "ui/compositor/compositor_switches.h" +#include "ui/compositor/layer.h" #include "ui/compositor/reflector.h" #include "ui/compositor/test/in_process_context_provider.h" #include "ui/gl/gl_implementation.h" @@ -83,6 +84,8 @@ InProcessContextFactory::InProcessContextFactory( DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) << "If running tests, ensure that main() is calling " << "gfx::GLSurface::InitializeOneOffForTests()"; + + Layer::InitializeUILayerSettings(); } InProcessContextFactory::~InProcessContextFactory() { |