| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "cc/surfaces/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // For display root surfaces, the surface is no longer going to be visible | 40 // For display root surfaces, the surface is no longer going to be visible |
| 41 // so make it unreachable from the top-level root. | 41 // so make it unreachable from the top-level root. |
| 42 if (surface_manager_->using_surface_references() && is_root_ && | 42 if (surface_manager_->using_surface_references() && is_root_ && |
| 43 reference_tracker_.current_surface_id().is_valid()) | 43 reference_tracker_.current_surface_id().is_valid()) |
| 44 RemoveTopLevelRootReference(reference_tracker_.current_surface_id()); | 44 RemoveTopLevelRootReference(reference_tracker_.current_surface_id()); |
| 45 | 45 |
| 46 // SurfaceFactory's destructor will attempt to return resources which will | 46 // SurfaceFactory's destructor will attempt to return resources which will |
| 47 // call back into here and access |client_| so we should destroy | 47 // call back into here and access |client_| so we should destroy |
| 48 // |surface_factory_|'s resources early on. | 48 // |surface_factory_|'s resources early on. |
| 49 surface_factory_->EvictSurface(); | 49 surface_factory_->EvictSurface(); |
| 50 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); | 50 surface_manager_->UnregisterFrameSinkManagerClient(frame_sink_id_); |
| 51 if (handles_frame_sink_id_invalidation_) | 51 if (handles_frame_sink_id_invalidation_) |
| 52 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); | 52 surface_manager_->InvalidateFrameSinkId(frame_sink_id_); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void CompositorFrameSinkSupport::ReferencedSurfacesChanged( | 55 void CompositorFrameSinkSupport::ReferencedSurfacesChanged( |
| 56 const LocalSurfaceId& local_surface_id, | 56 const LocalSurfaceId& local_surface_id, |
| 57 const std::vector<SurfaceId>* active_referenced_surfaces) { | 57 const std::vector<SurfaceId>* active_referenced_surfaces) { |
| 58 if (!surface_manager_->using_surface_references()) | 58 if (!surface_manager_->using_surface_references()) |
| 59 return; | 59 return; |
| 60 | 60 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 : client_(client), | 229 : client_(client), |
| 230 frame_sink_id_(frame_sink_id), | 230 frame_sink_id_(frame_sink_id), |
| 231 reference_tracker_(frame_sink_id), | 231 reference_tracker_(frame_sink_id), |
| 232 is_root_(is_root), | 232 is_root_(is_root), |
| 233 handles_frame_sink_id_invalidation_(handles_frame_sink_id_invalidation), | 233 handles_frame_sink_id_invalidation_(handles_frame_sink_id_invalidation), |
| 234 weak_factory_(this) {} | 234 weak_factory_(this) {} |
| 235 | 235 |
| 236 void CompositorFrameSinkSupport::Init(SurfaceManager* surface_manager, | 236 void CompositorFrameSinkSupport::Init(SurfaceManager* surface_manager, |
| 237 bool needs_sync_points) { | 237 bool needs_sync_points) { |
| 238 surface_manager_ = surface_manager; | 238 surface_manager_ = surface_manager; |
| 239 surface_factory_ = | 239 surface_factory_ = base::MakeUnique<SurfaceFactory>( |
| 240 base::MakeUnique<SurfaceFactory>(frame_sink_id_, surface_manager_, this); | 240 frame_sink_id_, surface_manager_, this, this, this); |
| 241 if (handles_frame_sink_id_invalidation_) | 241 if (handles_frame_sink_id_invalidation_) |
| 242 surface_manager_->RegisterFrameSinkId(frame_sink_id_); | 242 surface_manager_->RegisterFrameSinkId(frame_sink_id_); |
| 243 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this); | 243 surface_manager_->RegisterFrameSinkManagerClient(frame_sink_id_, this); |
| 244 surface_factory_->set_needs_sync_points(needs_sync_points); | 244 surface_factory_->set_needs_sync_points(needs_sync_points); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void CompositorFrameSinkSupport::OnBeginFrame(const BeginFrameArgs& args) { | 247 void CompositorFrameSinkSupport::OnBeginFrame(const BeginFrameArgs& args) { |
| 248 UpdateNeedsBeginFramesInternal(); | 248 UpdateNeedsBeginFramesInternal(); |
| 249 last_begin_frame_args_ = args; | 249 last_begin_frame_args_ = args; |
| 250 if (client_) | 250 if (client_) |
| 251 client_->OnBeginFrame(args); | 251 client_->OnBeginFrame(args); |
| 252 } | 252 } |
| 253 | 253 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 272 begin_frame_source_->RemoveObserver(this); | 272 begin_frame_source_->RemoveObserver(this); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void CompositorFrameSinkSupport::RequestCopyOfSurface( | 275 void CompositorFrameSinkSupport::RequestCopyOfSurface( |
| 276 std::unique_ptr<CopyOutputRequest> request) { | 276 std::unique_ptr<CopyOutputRequest> request) { |
| 277 DCHECK(surface_factory_); | 277 DCHECK(surface_factory_); |
| 278 surface_factory_->RequestCopyOfSurface(std::move(request)); | 278 surface_factory_->RequestCopyOfSurface(std::move(request)); |
| 279 } | 279 } |
| 280 | 280 |
| 281 } // namespace cc | 281 } // namespace cc |
| OLD | NEW |