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

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: Rebase on another LTH refactor CL. 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
« no previous file with comments | « third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); 211 params.task_graph_runner = context_factory_->GetTaskGraphRunner();
212 params.settings = &settings; 212 params.settings = &settings;
213 params.main_task_runner = task_runner_; 213 params.main_task_runner = task_runner_;
214 params.animation_host = cc::AnimationHost::CreateMainInstance(); 214 params.animation_host = cc::AnimationHost::CreateMainInstance();
215 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params); 215 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, &params);
216 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", 216 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor",
217 base::TimeTicks::Now() - before_create); 217 base::TimeTicks::Now() - before_create);
218 218
219 animation_timeline_ = 219 animation_timeline_ =
220 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId()); 220 cc::AnimationTimeline::Create(cc::AnimationIdProvider::NextTimelineId());
221 host_->animation_host()->AddAnimationTimeline(animation_timeline_.get()); 221 host_->GetLayerTree()->animation_host()->AddAnimationTimeline(
222 animation_timeline_.get());
222 223
223 host_->GetLayerTree()->SetRootLayer(root_web_layer_); 224 host_->GetLayerTree()->SetRootLayer(root_web_layer_);
224 host_->set_surface_client_id(surface_id_allocator_->client_id()); 225 host_->set_surface_client_id(surface_id_allocator_->client_id());
225 host_->SetVisible(true); 226 host_->SetVisible(true);
226 } 227 }
227 228
228 Compositor::~Compositor() { 229 Compositor::~Compositor() {
229 TRACE_EVENT0("shutdown", "Compositor::destructor"); 230 TRACE_EVENT0("shutdown", "Compositor::destructor");
230 231
231 CancelCompositorLock(); 232 CancelCompositorLock();
232 DCHECK(!compositor_lock_); 233 DCHECK(!compositor_lock_);
233 234
234 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 235 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
235 OnCompositingShuttingDown(this)); 236 OnCompositingShuttingDown(this));
236 237
237 FOR_EACH_OBSERVER(CompositorAnimationObserver, animation_observer_list_, 238 FOR_EACH_OBSERVER(CompositorAnimationObserver, animation_observer_list_,
238 OnCompositingShuttingDown(this)); 239 OnCompositingShuttingDown(this));
239 240
240 if (root_layer_) 241 if (root_layer_)
241 root_layer_->ResetCompositor(); 242 root_layer_->ResetCompositor();
242 243
243 if (animation_timeline_) 244 if (animation_timeline_)
244 host_->animation_host()->RemoveAnimationTimeline(animation_timeline_.get()); 245 host_->GetLayerTree()->animation_host()->RemoveAnimationTimeline(
246 animation_timeline_.get());
245 247
246 // Stop all outstanding draws before telling the ContextFactory to tear 248 // Stop all outstanding draws before telling the ContextFactory to tear
247 // down any contexts that the |host_| may rely upon. 249 // down any contexts that the |host_| may rely upon.
248 host_.reset(); 250 host_.reset();
249 251
250 context_factory_->RemoveCompositor(this); 252 context_factory_->RemoveCompositor(this);
251 if (context_factory_->GetSurfaceManager()) { 253 if (context_factory_->GetSurfaceManager()) {
252 for (auto& client : surface_clients_) { 254 for (auto& client : surface_clients_) {
253 if (client.second) { 255 if (client.second) {
254 context_factory_->GetSurfaceManager() 256 context_factory_->GetSurfaceManager()
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 observer_list_, 588 observer_list_,
587 OnCompositingLockStateChanged(this)); 589 OnCompositingLockStateChanged(this));
588 } 590 }
589 591
590 void Compositor::CancelCompositorLock() { 592 void Compositor::CancelCompositorLock() {
591 if (compositor_lock_) 593 if (compositor_lock_)
592 compositor_lock_->CancelLock(); 594 compositor_lock_->CancelLock();
593 } 595 }
594 596
595 } // namespace ui 597 } // namespace ui
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/testing/WebLayerTreeViewImplForTesting.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698