Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: cc/surfaces/compositor_frame_sink_support.cc

Issue 2676353002: MojoCompositorFrameSinkPrivate should support copy requests (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698