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

Unified Diff: ui/compositor/compositor.cc

Issue 1012583002: CC Animations: Port UI Browser Compositor to use compositor animation timelines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@redirect
Patch Set: Use AnimationHost. Created 5 years, 8 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/compositor.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 2b1eccfbb26ed25fcd02141564746f7ff2c889ec..052a643af9839e07627b2bd45648513fe080a2d9 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -15,6 +15,9 @@
#include "base/strings/string_util.h"
#include "base/sys_info.h"
#include "base/trace_event/trace_event.h"
+#include "cc/animation/animation_host.h"
+#include "cc/animation/animation_id_provider.h"
+#include "cc/animation/animation_timeline.h"
#include "cc/base/switches.h"
#include "cc/input/input_handler.h"
#include "cc/layers/layer.h"
@@ -148,6 +151,12 @@ Compositor::Compositor(gfx::AcceleratedWidget widget,
context_factory_->GetTaskGraphRunner(), settings, task_runner_, nullptr);
UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
base::TimeTicks::Now() - before_create);
+
+ if (settings.use_compositor_animation_timelines) {
+ animation_timeline_ = cc::AnimationTimeline::Create(
+ cc::AnimationIdProvider::NextTimelineId());
+ host_->animation_host()->AddAnimationTimeline(animation_timeline_.get());
+ }
host_->SetRootLayer(root_web_layer_);
host_->set_surface_id_namespace(surface_id_allocator_->id_namespace());
host_->SetLayerTreeHostClientReady();
@@ -167,6 +176,9 @@ Compositor::~Compositor() {
if (root_layer_)
root_layer_->SetCompositor(NULL);
+ if (animation_timeline_)
+ host_->animation_host()->RemoveAnimationTimeline(animation_timeline_.get());
+
// Stop all outstanding draws before telling the ContextFactory to tear
// down any contexts that the |host_| may rely upon.
host_.reset();
@@ -196,6 +208,11 @@ void Compositor::SetRootLayer(Layer* root_layer) {
root_web_layer_->AddChild(root_layer_->cc_layer());
}
+cc::AnimationTimeline* Compositor::GetAnimationTimeline() const {
+ DCHECK(animation_timeline_);
+ return animation_timeline_.get();
+}
+
void Compositor::SetHostHasTransparentBackground(
bool host_has_transparent_background) {
host_->set_has_transparent_background(host_has_transparent_background);
@@ -401,6 +418,11 @@ const cc::RendererSettings& Compositor::GetRendererSettings() const {
return host_->settings().renderer_settings;
}
+const cc::LayerTreeHost& Compositor::GetLayerTreeHost() const {
+ DCHECK(host_);
+ return *host_.get();
+}
+
scoped_refptr<CompositorLock> Compositor::GetCompositorLock() {
if (!compositor_lock_) {
compositor_lock_ = new CompositorLock(this);
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698