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

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

Issue 2216203002: Refactor MutatorHostClient from LayerTreeHost to LayerTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix call site in cc_perftest. Created 4 years, 4 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <deque> 10 #include <deque>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); 208 params.task_graph_runner = context_factory_->GetTaskGraphRunner();
209 params.settings = &settings; 209 params.settings = &settings;
210 params.main_task_runner = task_runner_; 210 params.main_task_runner = task_runner_;
211 params.animation_host = cc::AnimationHost::CreateMainInstance(); 211 params.animation_host = cc::AnimationHost::CreateMainInstance();
212 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 212 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
213 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", 213 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
214 base::TimeTicks::Now() - before_create); 214 base::TimeTicks::Now() - before_create);
215 215
216 animation_timeline_ = 216 animation_timeline_ =
217 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); 217 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId());
218 host_->animation_host()->AddAnimationTimeline(animation_timeline_.get()); 218 host_->GetLayerTree()->animation_host()
219 ->AddAnimationTimeline(animation_timeline_.get());
219 220
220 host_->SetRootLayer(root_web_layer_); 221 host_->SetRootLayer(root_web_layer_);
221 host_->set_surface_client_id(surface_id_allocator_->client_id()); 222 host_->set_surface_client_id(surface_id_allocator_->client_id());
222 host_->SetVisible(true); 223 host_->SetVisible(true);
223 } 224 }
224 225
225 Compositor::~Compositor() { 226 Compositor::~Compositor() {
226 TRACE_EVENT0("shutdown", "Compositor::destructor"); 227 TRACE_EVENT0("shutdown", "Compositor::destructor");
227 228
228 CancelCompositorLock(); 229 CancelCompositorLock();
229 DCHECK(!compositor_lock_); 230 DCHECK(!compositor_lock_);
230 231
231 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 232 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
232 OnCompositingShuttingDown(this)); 233 OnCompositingShuttingDown(this));
233 234
234 FOR_EACH_OBSERVER(CompositorAnimationObserver, animation_observer_list_, 235 FOR_EACH_OBSERVER(CompositorAnimationObserver, animation_observer_list_,
235 OnCompositingShuttingDown(this)); 236 OnCompositingShuttingDown(this));
236 237
237 if (root_layer_) 238 if (root_layer_)
238 root_layer_->ResetCompositor(); 239 root_layer_->ResetCompositor();
239 240
240 if (animation_timeline_) 241 if (animation_timeline_)
241 host_->animation_host()->RemoveAnimationTimeline(animation_timeline_.get()); 242 host_->GetLayerTree()->animation_host()
243 ->RemoveAnimationTimeline(animation_timeline_.get());
242 244
243 // Stop all outstanding draws before telling the ContextFactory to tear 245 // Stop all outstanding draws before telling the ContextFactory to tear
244 // down any contexts that the |host_| may rely upon. 246 // down any contexts that the |host_| may rely upon.
245 host_.reset(); 247 host_.reset();
246 248
247 context_factory_->RemoveCompositor(this); 249 context_factory_->RemoveCompositor(this);
248 if (context_factory_->GetSurfaceManager()) { 250 if (context_factory_->GetSurfaceManager()) {
249 for (auto& client : surface_clients_) { 251 for (auto& client : surface_clients_) {
250 if (client.second) { 252 if (client.second) {
251 context_factory_->GetSurfaceManager() 253 context_factory_->GetSurfaceManager()
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 observer_list_, 562 observer_list_,
561 OnCompositingLockStateChanged(this)); 563 OnCompositingLockStateChanged(this));
562 } 564 }
563 565
564 void Compositor::CancelCompositorLock() { 566 void Compositor::CancelCompositorLock() {
565 if (compositor_lock_) 567 if (compositor_lock_)
566 compositor_lock_->CancelLock(); 568 compositor_lock_->CancelLock();
567 } 569 }
568 570
569 } // namespace ui 571 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698