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

Unified Diff: ui/compositor/compositor.cc

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. 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
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index c50f9efdddb5321b6095e8c8a8bf4b64482433b9..31219c6ff0f3ddda16d8f82c04c7972da7c93a1b 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -81,11 +81,20 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
compositor_lock_(NULL),
layer_animator_collection_(this),
weak_ptr_factory_(this) {
- root_web_layer_ = cc::Layer::Create();
-
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
cc::LayerTreeSettings settings;
+
+ cc::LayerSettings ui_layer_settings;
+ if (command_line->HasSwitch(
+ switches::kUIEnableCompositorAnimationTimelines)) {
+ settings.hud_layer_settings_.use_compositor_animation_timelines = true;
+ ui_layer_settings.use_compositor_animation_timelines = true;
+ }
+ Layer::SetUILayerSettings(ui_layer_settings);
+
+ root_web_layer_ = cc::Layer::Create(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.
@@ -135,9 +144,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();
host_ = cc::LayerTreeHost::CreateSingleThreaded(
this, this, context_factory_->GetSharedBitmapManager(),
@@ -162,7 +168,7 @@ Compositor::~Compositor() {
DCHECK(begin_frame_observer_list_.empty());
if (root_layer_)
- root_layer_->SetCompositor(NULL);
+ root_layer_->ResetCompositor();
// Stop all outstanding draws before telling the ContextFactory to tear
// down any contexts that the |host_| may rely upon.
@@ -184,13 +190,11 @@ void Compositor::SetRootLayer(Layer* root_layer) {
if (root_layer_ == root_layer)
return;
if (root_layer_)
- root_layer_->SetCompositor(NULL);
+ root_layer_->ResetCompositor();
root_layer_ = root_layer;
- if (root_layer_ && !root_layer_->GetCompositor())
- root_layer_->SetCompositor(this);
root_web_layer_->RemoveAllChildren();
if (root_layer_)
- root_web_layer_->AddChild(root_layer_->cc_layer());
+ root_layer_->SetCompositor(this, root_web_layer_);
}
void Compositor::SetHostHasTransparentBackground(

Powered by Google App Engine
This is Rietveld 408576698