| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 host_->GetLayerTree()->animation_host()->RemoveAnimationTimeline( | 227 host_->GetLayerTree()->animation_host()->RemoveAnimationTimeline( |
| 228 animation_timeline_.get()); | 228 animation_timeline_.get()); |
| 229 | 229 |
| 230 // Stop all outstanding draws before telling the ContextFactory to tear | 230 // Stop all outstanding draws before telling the ContextFactory to tear |
| 231 // down any contexts that the |host_| may rely upon. | 231 // down any contexts that the |host_| may rely upon. |
| 232 host_.reset(); | 232 host_.reset(); |
| 233 | 233 |
| 234 context_factory_->RemoveCompositor(this); | 234 context_factory_->RemoveCompositor(this); |
| 235 auto* manager = context_factory_->GetSurfaceManager(); | 235 auto* manager = context_factory_->GetSurfaceManager(); |
| 236 for (auto& client : child_frame_sinks_) { | 236 for (auto& client : child_frame_sinks_) { |
| 237 DCHECK(!client.is_null()); | 237 DCHECK(client.is_valid()); |
| 238 manager->UnregisterFrameSinkHierarchy(frame_sink_id_, client); | 238 manager->UnregisterFrameSinkHierarchy(frame_sink_id_, client); |
| 239 } | 239 } |
| 240 manager->InvalidateFrameSinkId(frame_sink_id_); | 240 manager->InvalidateFrameSinkId(frame_sink_id_); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void Compositor::AddFrameSink(const cc::FrameSinkId& frame_sink_id) { | 243 void Compositor::AddFrameSink(const cc::FrameSinkId& frame_sink_id) { |
| 244 context_factory_->GetSurfaceManager()->RegisterFrameSinkHierarchy( | 244 context_factory_->GetSurfaceManager()->RegisterFrameSinkHierarchy( |
| 245 frame_sink_id_, frame_sink_id); | 245 frame_sink_id_, frame_sink_id); |
| 246 child_frame_sinks_.insert(frame_sink_id); | 246 child_frame_sinks_.insert(frame_sink_id); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void Compositor::RemoveFrameSink(const cc::FrameSinkId& frame_sink_id) { | 249 void Compositor::RemoveFrameSink(const cc::FrameSinkId& frame_sink_id) { |
| 250 auto it = child_frame_sinks_.find(frame_sink_id); | 250 auto it = child_frame_sinks_.find(frame_sink_id); |
| 251 DCHECK(it != child_frame_sinks_.end()); | 251 DCHECK(it != child_frame_sinks_.end()); |
| 252 DCHECK(!it->is_null()); | 252 DCHECK(it->is_valid()); |
| 253 context_factory_->GetSurfaceManager()->UnregisterFrameSinkHierarchy( | 253 context_factory_->GetSurfaceManager()->UnregisterFrameSinkHierarchy( |
| 254 frame_sink_id_, *it); | 254 frame_sink_id_, *it); |
| 255 child_frame_sinks_.erase(it); | 255 child_frame_sinks_.erase(it); |
| 256 } | 256 } |
| 257 | 257 |
| 258 void Compositor::SetCompositorFrameSink( | 258 void Compositor::SetCompositorFrameSink( |
| 259 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { | 259 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { |
| 260 compositor_frame_sink_requested_ = false; | 260 compositor_frame_sink_requested_ = false; |
| 261 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 261 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
| 262 // Display properties are reset when the output surface is lost, so update it | 262 // Display properties are reset when the output surface is lost, so update it |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 for (auto& observer : observer_list_) | 540 for (auto& observer : observer_list_) |
| 541 observer.OnCompositingLockStateChanged(this); | 541 observer.OnCompositingLockStateChanged(this); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void Compositor::CancelCompositorLock() { | 544 void Compositor::CancelCompositorLock() { |
| 545 if (compositor_lock_) | 545 if (compositor_lock_) |
| 546 compositor_lock_->CancelLock(); | 546 compositor_lock_->CancelLock(); |
| 547 } | 547 } |
| 548 | 548 |
| 549 } // namespace ui | 549 } // namespace ui |
| OLD | NEW |