Chromium Code Reviews| Index: cc/surfaces/compositor_frame_sink_support.cc |
| diff --git a/cc/surfaces/compositor_frame_sink_support.cc b/cc/surfaces/compositor_frame_sink_support.cc |
| index 95222ed1defc2354e69faf20ac12300a4b439b61..8e29a8c889d7bca34eedc1fea1f4f86674c384b0 100644 |
| --- a/cc/surfaces/compositor_frame_sink_support.cc |
| +++ b/cc/surfaces/compositor_frame_sink_support.cc |
| @@ -17,22 +17,24 @@ CompositorFrameSinkSupport::CompositorFrameSinkSupport( |
| CompositorFrameSinkSupportClient* client, |
| SurfaceManager* surface_manager, |
| const FrameSinkId& frame_sink_id, |
| - std::unique_ptr<Display> display, |
| - std::unique_ptr<BeginFrameSource> display_begin_frame_source) |
| + Display* display, |
| + bool needs_sync_points, |
| + bool for_direct_compositor_frame_sink) |
| : client_(client), |
| surface_manager_(surface_manager), |
| frame_sink_id_(frame_sink_id), |
| - display_begin_frame_source_(std::move(display_begin_frame_source)), |
| - display_(std::move(display)), |
| + display_(display), |
| surface_factory_(frame_sink_id_, surface_manager_, this), |
| + for_direct_compositor_frame_sink_(for_direct_compositor_frame_sink), |
| weak_factory_(this) { |
| - surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| + if (!for_direct_compositor_frame_sink_) |
|
danakj
2017/02/06 16:42:58
The naming of this violates layering. It should ma
Alex Z.
2017/02/07 17:22:00
Done.
|
| + surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| + |
| surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this); |
| + surface_factory_.set_needs_sync_points(needs_sync_points); |
| - if (display_) { |
| + if (display_) |
| display_->Initialize(this, surface_manager_); |
| - display_->SetVisible(true); |
| - } |
| } |
| CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { |
| @@ -46,7 +48,8 @@ CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { |
| // |surface_factory_|'s resources early on. |
| surface_factory_.EvictSurface(); |
| surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); |
| - surface_manager_->InvalidateFrameSinkId(frame_sink_id_); |
| + if (!for_direct_compositor_frame_sink_) |
| + surface_manager_->InvalidateFrameSinkId(frame_sink_id_); |
| } |
| void CompositorFrameSinkSupport::EvictFrame() { |
| @@ -62,14 +65,14 @@ void CompositorFrameSinkSupport::SubmitCompositorFrame( |
| const LocalSurfaceId& local_surface_id, |
| CompositorFrame frame) { |
| ++ack_pending_count_; |
| - surface_factory_.SubmitCompositorFrame( |
| - local_surface_id, std::move(frame), |
| - base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
| - weak_factory_.GetWeakPtr())); |
| if (display_) { |
| display_->SetLocalSurfaceId(local_surface_id, |
| frame.metadata.device_scale_factor); |
| } |
| + surface_factory_.SubmitCompositorFrame( |
| + local_surface_id, std::move(frame), |
| + base::Bind(&CompositorFrameSinkSupport::DidReceiveCompositorFrameAck, |
| + weak_factory_.GetWeakPtr())); |
| } |
| void CompositorFrameSinkSupport::Require(const LocalSurfaceId& local_surface_id, |
| @@ -112,6 +115,10 @@ void CompositorFrameSinkSupport::RemoveChildFrameSink( |
| child_frame_sinks_.erase(it); |
| } |
| +void CompositorFrameSinkSupport::ForceReclaimResources() { |
| + surface_factory_.ClearSurface(); |
| +} |
| + |
| void CompositorFrameSinkSupport::DisplayOutputSurfaceLost() {} |
| void CompositorFrameSinkSupport::DisplayWillDrawAndSwap( |