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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 593503003: Support error handling for Surface readbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary headers. Created 6 years, 3 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: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index f2a0f74dd0be0d5abaa9a5ac17b99f8c89617c12..320c28bc67facae764c203e0ef120806ac1a28e9 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -288,9 +288,9 @@ void BrowserPluginGuest::UpdateVisibility() {
}
void BrowserPluginGuest::CopyFromCompositingSurface(
- gfx::Rect src_subrect,
- gfx::Size dst_size,
- const base::Callback<void(bool, const SkBitmap&)>& callback) {
+ gfx::Rect src_subrect,
+ gfx::Size dst_size,
+ CopyFromCompositingSurfaceCallback& callback) {
copy_request_callbacks_.insert(std::make_pair(++copy_request_id_, callback));
SendMessageToEmbedder(
new BrowserPluginMsg_CopyFromCompositingSurface(
@@ -734,8 +734,12 @@ void BrowserPluginGuest::OnCopyFromCompositingSurfaceAck(
CHECK(copy_request_callbacks_.count(request_id));
if (!copy_request_callbacks_.count(request_id))
return;
- const CopyRequestCallback& callback = copy_request_callbacks_[request_id];
- callback.Run(!bitmap.empty() && !bitmap.isNull(), bitmap);
+ const CopyFromCompositingSurfaceCallback& callback =
+ copy_request_callbacks_[request_id];
+ bool success = !bitmap.empty() && !bitmap.isNull();
+ callback.Run(success,
+ bitmap,
+ success ? content::READBACK_SUCCESS : content::READBACK_FAILED);
copy_request_callbacks_.erase(request_id);
}

Powered by Google App Engine
This is Rietveld 408576698