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..168902f78931a559dc36cd7b5248788e91b6f222 100644 |
--- a/cc/surfaces/compositor_frame_sink_support.cc |
+++ b/cc/surfaces/compositor_frame_sink_support.cc |
@@ -179,4 +179,33 @@ void CompositorFrameSinkSupport::UpdateNeedsBeginFramesInternal() { |
begin_frame_source_->RemoveObserver(this); |
} |
+void CompositorFrameSinkSupport::RequestCopyOfSurface( |
+ std::unique_ptr<CopyOutputRequest> request) { |
+ request->set_result_callback( |
+ base::Bind(&CompositorFrameSinkSupport::OnTextureReceived, |
+ weak_factory_.GetWeakPtr(), request->result_callback())); |
+ surface_factory_.RequestCopyOfSurface(std::move(request)); |
+} |
+ |
+void CompositorFrameSinkSupport::DeleteMailbox(const gpu::Mailbox& mailbox, |
+ const gpu::SyncToken& sync_token, |
+ bool is_lost) { |
+ auto callback_iter = release_callbacks_.find(mailbox); |
+ if (!release_callbacks_.count(mailbox)) { |
+ DLOG(ERROR) << "Attempted to delete a mailbox that does not exist"; |
+ return; |
+ } |
+ callback_iter->second->Run(sync_token, is_lost); |
+ release_callbacks_.erase(callback_iter); |
+} |
+ |
+void CompositorFrameSinkSupport::OnTextureReceived( |
+ CopyOutputRequest::CopyOutputRequestCallback callback, |
+ std::unique_ptr<CopyOutputResult> result) { |
+ DCHECK(result->HasTexture()); |
+ DCHECK(!release_callbacks_.count(result->mailbox())); |
+ release_callbacks_[result->mailbox()] = result->TakeReleaseCallback(); |
+ callback.Run(std::move(result)); |
+} |
+ |
} // namespace cc |