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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 418853002: Android:Allow to invoke a read-back while a view is visible only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check hide view logic outside IsSurfaceAvailableForCopy Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 09d1160e8c03896f66841ad98880f5c3d78a4f16..a66dffe37e5e3aaa810060cb715a44b876bd5439 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -300,7 +300,13 @@ void RenderWidgetHostViewAndroid::GetScaledContentBitmap(
SkColorType color_type,
gfx::Rect src_subrect,
const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
+ if (!host_ || host_->is_hidden()) {
+ result_callback.Run(false, SkBitmap());
+ return;
+ }
if (!IsSurfaceAvailableForCopy()) {
+ // TODO(Sikugu): allow a read-back request to wait for a first frame if it
+ // was invoked while no frame was received yet
result_callback.Run(false, SkBitmap());
return;
}
@@ -713,7 +719,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
const gfx::Size& dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback,
const SkColorType color_type) {
- if (!IsReadbackConfigSupported(color_type)) {
+ if ((!host_ || host_->is_hidden()) ||
+ !IsReadbackConfigSupported(color_type)) {
callback.Run(false, SkBitmap());
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698