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