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 c36e35121216113a756f8550dfb60068a26f3b84..6c95689f478ca1bd25249ab721b2cb2c9f135dc7 100644 |
| --- a/cc/surfaces/compositor_frame_sink_support.cc |
| +++ b/cc/surfaces/compositor_frame_sink_support.cc |
| @@ -17,7 +17,7 @@ CompositorFrameSinkSupport::CompositorFrameSinkSupport( |
| CompositorFrameSinkSupportClient* client, |
| SurfaceManager* surface_manager, |
| const FrameSinkId& frame_sink_id, |
| - std::unique_ptr<Display> display, |
| + Display* display, |
| std::unique_ptr<BeginFrameSource> display_begin_frame_source) |
| : client_(client), |
| surface_manager_(surface_manager), |
| @@ -26,13 +26,10 @@ CompositorFrameSinkSupport::CompositorFrameSinkSupport( |
| display_(std::move(display)), |
| surface_factory_(frame_sink_id_, surface_manager_, this), |
| weak_factory_(this) { |
| - surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this); |
| - if (display_) { |
| + if (display_) |
| display_->Initialize(this, surface_manager_); |
| - display_->SetVisible(true); |
| - } |
| } |
| CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { |
| @@ -41,12 +38,10 @@ CompositorFrameSinkSupport::~CompositorFrameSinkSupport() { |
| surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| child_frame_sink_id); |
| } |
| - // SurfaceFactory's destructor will attempt to return resources which will |
| - // call back into here and access |client_| so we should destroy |
| - // |surface_factory_|'s resources early on. |
| - surface_factory_.EvictSurface(); |
| + // Unregister the SurfaceFactoryClient here instead of the dtor so that only |
| + // one client is alive for this namespace at any given time. |
| surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); |
| - surface_manager_->InvalidateFrameSinkId(frame_sink_id_); |
|
Fady Samuel
2017/01/04 21:47:40
Why was this deleted? Please restore this code?
Alex Z.
2017/01/05 00:30:13
Done.
|
| + surface_factory_.EvictSurface(); |
| } |
| void CompositorFrameSinkSupport::EvictFrame() { |
| @@ -132,6 +127,23 @@ void CompositorFrameSinkSupport::RemoveChildFrameSink( |
| child_frame_sinks_.erase(it); |
| } |
| +void CompositorFrameSinkSupport::SetNeedsSyncPoints(bool needs_sync_points) { |
| + surface_factory_.set_needs_sync_points(needs_sync_points); |
| +} |
| + |
| +void CompositorFrameSinkSupport::ForceReclaimResources() { |
| + if (local_frame_id_.is_valid()) |
| + surface_factory_.ClearSurface(); |
| +} |
| + |
| +void CompositorFrameSinkSupport::RegisterFrameSinkId() { |
|
Fady Samuel
2017/01/04 21:47:40
Delete this?
Alex Z.
2017/01/05 00:30:13
Done.
|
| + surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| +} |
| + |
| +void CompositorFrameSinkSupport::InvalidateFrameSinkId() { |
|
Fady Samuel
2017/01/04 21:47:40
Delete this?
Alex Z.
2017/01/05 00:30:13
Done.
|
| + surface_manager_->InvalidateFrameSinkId(frame_sink_id_); |
| +} |
| + |
| void CompositorFrameSinkSupport::DisplayOutputSurfaceLost() {} |
| void CompositorFrameSinkSupport::DisplayWillDrawAndSwap( |