Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: ui/compositor/layer.cc

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/test/in_process_context_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index c013cb7dc80e46cc8fbefdd5eaf22895d53d15d2..86258154378f848bed882b776d05358096e06b2d 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());
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/test/in_process_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698