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

Side by Side Diff: ui/compositor/compositor.cc

Issue 1130043003: [Sketch] CC Animations: Torpedo the old intrusive animation system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implscroll
Patch Set: Delete more (headers and animation_registrar_ leftover) 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); 132 settings.impl_side_painting = IsUIImplSidePaintingEnabled();
133 settings.use_display_lists = IsUISlimmingPaintEnabled(); 133 settings.use_display_lists = IsUISlimmingPaintEnabled();
134 settings.use_zero_copy = IsUIZeroCopyEnabled(); 134 settings.use_zero_copy = IsUIZeroCopyEnabled();
135 settings.use_one_copy = IsUIOneCopyEnabled(); 135 settings.use_one_copy = IsUIOneCopyEnabled();
136 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); 136 settings.use_image_texture_target = context_factory_->GetImageTextureTarget();
137 // Note: gathering of pixel refs is only needed when using multiple 137 // Note: gathering of pixel refs is only needed when using multiple
138 // raster threads. 138 // raster threads.
139 settings.gather_pixel_refs = false; 139 settings.gather_pixel_refs = false;
140 140
141 settings.use_compositor_animation_timelines =
142 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines);
143
144 base::TimeTicks before_create = base::TimeTicks::Now(); 141 base::TimeTicks before_create = base::TimeTicks::Now();
145 host_ = cc::LayerTreeHost::CreateSingleThreaded( 142 host_ = cc::LayerTreeHost::CreateSingleThreaded(
146 this, this, context_factory_->GetSharedBitmapManager(), 143 this, this, context_factory_->GetSharedBitmapManager(),
147 context_factory_->GetGpuMemoryBufferManager(), 144 context_factory_->GetGpuMemoryBufferManager(),
148 context_factory_->GetTaskGraphRunner(), settings, task_runner_, nullptr); 145 context_factory_->GetTaskGraphRunner(), settings, task_runner_, nullptr);
149 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", 146 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
150 base::TimeTicks::Now() - before_create); 147 base::TimeTicks::Now() - before_create);
151 148
152 if (settings.use_compositor_animation_timelines) { 149 animation_timeline_ =
153 animation_timeline_ = cc::AnimationTimeline::Create( 150 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId());
154 cc::AnimationIdProvider::NextTimelineId()); 151 host_->animation_host()->AddAnimationTimeline(animation_timeline_.get());
155 host_->animation_host()->AddAnimationTimeline(animation_timeline_.get()); 152
156 }
157 host_->SetRootLayer(root_web_layer_); 153 host_->SetRootLayer(root_web_layer_);
158 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); 154 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace());
159 host_->SetLayerTreeHostClientReady(); 155 host_->SetLayerTreeHostClientReady();
160 } 156 }
161 157
162 Compositor::~Compositor() { 158 Compositor::~Compositor() {
163 TRACE_EVENT0("shutdown", "Compositor::destructor"); 159 TRACE_EVENT0("shutdown", "Compositor::destructor");
164 160
165 CancelCompositorLock(); 161 CancelCompositorLock();
166 DCHECK(!compositor_lock_); 162 DCHECK(!compositor_lock_);
167 163
168 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 164 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
169 OnCompositingShuttingDown(this)); 165 OnCompositingShuttingDown(this));
170 166
171 DCHECK(begin_frame_observer_list_.empty()); 167 DCHECK(begin_frame_observer_list_.empty());
172 168
173 if (root_layer_) 169 if (root_layer_)
174 root_layer_->ResetCompositor(); 170 root_layer_->ResetCompositor();
175 171
176 if (animation_timeline_) 172 host_->animation_host()->RemoveAnimationTimeline(animation_timeline_.get());
177 host_->animation_host()->RemoveAnimationTimeline(animation_timeline_.get());
178 173
179 // Stop all outstanding draws before telling the ContextFactory to tear 174 // Stop all outstanding draws before telling the ContextFactory to tear
180 // down any contexts that the |host_| may rely upon. 175 // down any contexts that the |host_| may rely upon.
181 host_.reset(); 176 host_.reset();
182 177
183 context_factory_->RemoveCompositor(this); 178 context_factory_->RemoveCompositor(this);
184 } 179 }
185 180
186 void Compositor::SetOutputSurface( 181 void Compositor::SetOutputSurface(
187 scoped_ptr<cc::OutputSurface> output_surface) { 182 scoped_ptr<cc::OutputSurface> output_surface) {
(...skipping 11 matching lines...) Expand all
199 root_layer_->ResetCompositor(); 194 root_layer_->ResetCompositor();
200 root_layer_ = root_layer; 195 root_layer_ = root_layer;
201 if (root_layer_ && !root_layer_->GetCompositor()) 196 if (root_layer_ && !root_layer_->GetCompositor())
202 root_layer_->SetCompositor(this); 197 root_layer_->SetCompositor(this);
203 root_web_layer_->RemoveAllChildren(); 198 root_web_layer_->RemoveAllChildren();
204 if (root_layer_) 199 if (root_layer_)
205 root_layer_->SetCompositorRootCCLayer(root_web_layer_); 200 root_layer_->SetCompositorRootCCLayer(root_web_layer_);
206 } 201 }
207 202
208 cc::AnimationTimeline* Compositor::GetAnimationTimeline() const { 203 cc::AnimationTimeline* Compositor::GetAnimationTimeline() const {
209 DCHECK(animation_timeline_);
210 return animation_timeline_.get(); 204 return animation_timeline_.get();
211 } 205 }
212 206
213 void Compositor::SetHostHasTransparentBackground( 207 void Compositor::SetHostHasTransparentBackground(
214 bool host_has_transparent_background) { 208 bool host_has_transparent_background) {
215 host_->set_has_transparent_background(host_has_transparent_background); 209 host_->set_has_transparent_background(host_has_transparent_background);
216 } 210 }
217 211
218 void Compositor::ScheduleFullRedraw() { 212 void Compositor::ScheduleFullRedraw() {
219 // TODO(enne): Some callers (mac) call this function expecting that it 213 // TODO(enne): Some callers (mac) call this function expecting that it
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 observer_list_, 440 observer_list_,
447 OnCompositingLockStateChanged(this)); 441 OnCompositingLockStateChanged(this));
448 } 442 }
449 443
450 void Compositor::CancelCompositorLock() { 444 void Compositor::CancelCompositorLock() {
451 if (compositor_lock_) 445 if (compositor_lock_)
452 compositor_lock_->CancelLock(); 446 compositor_lock_->CancelLock();
453 } 447 }
454 448
455 } // namespace ui 449 } // namespace ui
OLDNEW
« no previous file with comments | « content/test/web_layer_tree_view_impl_for_testing.cc ('k') | ui/compositor/compositor_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698