OLD | NEW |
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 Loading... |
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, ¶ms); | 215 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
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 Loading... |
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 |
OLD | NEW |