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 10 matching lines...) Expand all Loading... |
21 #include "cc/animation/animation_host.h" | 21 #include "cc/animation/animation_host.h" |
22 #include "cc/animation/animation_id_provider.h" | 22 #include "cc/animation/animation_id_provider.h" |
23 #include "cc/animation/animation_timeline.h" | 23 #include "cc/animation/animation_timeline.h" |
24 #include "cc/base/switches.h" | 24 #include "cc/base/switches.h" |
25 #include "cc/input/input_handler.h" | 25 #include "cc/input/input_handler.h" |
26 #include "cc/layers/layer.h" | 26 #include "cc/layers/layer.h" |
27 #include "cc/output/begin_frame_args.h" | 27 #include "cc/output/begin_frame_args.h" |
28 #include "cc/output/context_provider.h" | 28 #include "cc/output/context_provider.h" |
29 #include "cc/output/latency_info_swap_promise.h" | 29 #include "cc/output/latency_info_swap_promise.h" |
30 #include "cc/scheduler/begin_frame_source.h" | 30 #include "cc/scheduler/begin_frame_source.h" |
| 31 #include "cc/surfaces/framesink_manager.h" |
31 #include "cc/surfaces/surface_id_allocator.h" | 32 #include "cc/surfaces/surface_id_allocator.h" |
32 #include "cc/surfaces/surface_manager.h" | 33 #include "cc/surfaces/surface_manager.h" |
33 #include "cc/trees/layer_tree_host.h" | 34 #include "cc/trees/layer_tree_host.h" |
34 #include "cc/trees/layer_tree_settings.h" | 35 #include "cc/trees/layer_tree_settings.h" |
35 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
36 #include "ui/compositor/compositor_observer.h" | 37 #include "ui/compositor/compositor_observer.h" |
37 #include "ui/compositor/compositor_switches.h" | 38 #include "ui/compositor/compositor_switches.h" |
38 #include "ui/compositor/compositor_vsync_manager.h" | 39 #include "ui/compositor/compositor_vsync_manager.h" |
39 #include "ui/compositor/dip_util.h" | 40 #include "ui/compositor/dip_util.h" |
40 #include "ui/compositor/layer.h" | 41 #include "ui/compositor/layer.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 compositor_frame_sink_requested_(false), | 86 compositor_frame_sink_requested_(false), |
86 frame_sink_id_(frame_sink_id), | 87 frame_sink_id_(frame_sink_id), |
87 task_runner_(task_runner), | 88 task_runner_(task_runner), |
88 vsync_manager_(new CompositorVSyncManager()), | 89 vsync_manager_(new CompositorVSyncManager()), |
89 device_scale_factor_(0.0f), | 90 device_scale_factor_(0.0f), |
90 locks_will_time_out_(true), | 91 locks_will_time_out_(true), |
91 compositor_lock_(NULL), | 92 compositor_lock_(NULL), |
92 layer_animator_collection_(this), | 93 layer_animator_collection_(this), |
93 weak_ptr_factory_(this) { | 94 weak_ptr_factory_(this) { |
94 if (context_factory_private) { | 95 if (context_factory_private) { |
95 context_factory_private->GetSurfaceManager()->RegisterFrameSinkId( | 96 context_factory_private->GetFrameSinkManager()->RegisterFrameSinkId( |
96 frame_sink_id_); | 97 frame_sink_id_); |
97 } | 98 } |
98 root_web_layer_ = cc::Layer::Create(); | 99 root_web_layer_ = cc::Layer::Create(); |
99 | 100 |
100 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 101 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
101 | 102 |
102 cc::LayerTreeSettings settings; | 103 cc::LayerTreeSettings settings; |
103 | 104 |
104 // This will ensure PictureLayers always can have LCD text, to match the | 105 // This will ensure PictureLayers always can have LCD text, to match the |
105 // previous behaviour with ContentLayers, where LCD-not-allowed notifications | 106 // previous behaviour with ContentLayers, where LCD-not-allowed notifications |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 236 |
236 if (animation_timeline_) | 237 if (animation_timeline_) |
237 animation_host_->RemoveAnimationTimeline(animation_timeline_.get()); | 238 animation_host_->RemoveAnimationTimeline(animation_timeline_.get()); |
238 | 239 |
239 // Stop all outstanding draws before telling the ContextFactory to tear | 240 // Stop all outstanding draws before telling the ContextFactory to tear |
240 // down any contexts that the |host_| may rely upon. | 241 // down any contexts that the |host_| may rely upon. |
241 host_.reset(); | 242 host_.reset(); |
242 | 243 |
243 context_factory_->RemoveCompositor(this); | 244 context_factory_->RemoveCompositor(this); |
244 if (context_factory_private_) { | 245 if (context_factory_private_) { |
245 auto* manager = context_factory_private_->GetSurfaceManager(); | 246 auto* manager = context_factory_private_->GetFrameSinkManager(); |
246 for (auto& client : child_frame_sinks_) { | 247 for (auto& client : child_frame_sinks_) { |
247 DCHECK(client.is_valid()); | 248 DCHECK(client.is_valid()); |
248 manager->UnregisterFrameSinkHierarchy(frame_sink_id_, client); | 249 manager->UnregisterFrameSinkHierarchy(frame_sink_id_, client); |
249 } | 250 } |
250 manager->InvalidateFrameSinkId(frame_sink_id_); | 251 manager->InvalidateFrameSinkId(frame_sink_id_); |
251 } | 252 } |
252 } | 253 } |
253 | 254 |
254 void Compositor::AddFrameSink(const cc::FrameSinkId& frame_sink_id) { | 255 void Compositor::AddFrameSink(const cc::FrameSinkId& frame_sink_id) { |
255 if (!context_factory_private_) | 256 if (!context_factory_private_) |
256 return; | 257 return; |
257 context_factory_private_->GetSurfaceManager()->RegisterFrameSinkHierarchy( | 258 context_factory_private_->GetFrameSinkManager()->RegisterFrameSinkHierarchy( |
258 frame_sink_id_, frame_sink_id); | 259 frame_sink_id_, frame_sink_id); |
259 child_frame_sinks_.insert(frame_sink_id); | 260 child_frame_sinks_.insert(frame_sink_id); |
260 } | 261 } |
261 | 262 |
262 void Compositor::RemoveFrameSink(const cc::FrameSinkId& frame_sink_id) { | 263 void Compositor::RemoveFrameSink(const cc::FrameSinkId& frame_sink_id) { |
263 if (!context_factory_private_) | 264 if (!context_factory_private_) |
264 return; | 265 return; |
265 auto it = child_frame_sinks_.find(frame_sink_id); | 266 auto it = child_frame_sinks_.find(frame_sink_id); |
266 DCHECK(it != child_frame_sinks_.end()); | 267 DCHECK(it != child_frame_sinks_.end()); |
267 DCHECK(it->is_valid()); | 268 DCHECK(it->is_valid()); |
268 context_factory_private_->GetSurfaceManager()->UnregisterFrameSinkHierarchy( | 269 context_factory_private_->GetFrameSinkManager()->UnregisterFrameSinkHierarchy( |
269 frame_sink_id_, *it); | 270 frame_sink_id_, *it); |
270 child_frame_sinks_.erase(it); | 271 child_frame_sinks_.erase(it); |
271 } | 272 } |
272 | 273 |
273 void Compositor::SetCompositorFrameSink( | 274 void Compositor::SetCompositorFrameSink( |
274 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { | 275 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink) { |
275 compositor_frame_sink_requested_ = false; | 276 compositor_frame_sink_requested_ = false; |
276 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 277 host_->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
277 // Display properties are reset when the output surface is lost, so update it | 278 // Display properties are reset when the output surface is lost, so update it |
278 // to match the Compositor's. | 279 // to match the Compositor's. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 for (auto& observer : observer_list_) | 558 for (auto& observer : observer_list_) |
558 observer.OnCompositingLockStateChanged(this); | 559 observer.OnCompositingLockStateChanged(this); |
559 } | 560 } |
560 | 561 |
561 void Compositor::CancelCompositorLock() { | 562 void Compositor::CancelCompositorLock() { |
562 if (compositor_lock_) | 563 if (compositor_lock_) |
563 compositor_lock_->CancelLock(); | 564 compositor_lock_->CancelLock(); |
564 } | 565 } |
565 | 566 |
566 } // namespace ui | 567 } // namespace ui |
OLD | NEW |