Allow to invoke a read-back while a view is visible only.

We should allow, the read back while view is active and hold
the frame till, readback gets processed. Dont process a
readback request when the view is hidden.

BUG=376769

Review URL: https://codereview.chromium.org/418853002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285488 0039d316-1c4b-4281-b951-d872f2087c98
parent 7f284dd8
...@@ -300,7 +300,13 @@ void RenderWidgetHostViewAndroid::GetScaledContentBitmap( ...@@ -300,7 +300,13 @@ void RenderWidgetHostViewAndroid::GetScaledContentBitmap(
SkColorType color_type, SkColorType color_type,
gfx::Rect src_subrect, gfx::Rect src_subrect,
const base::Callback<void(bool, const SkBitmap&)>& result_callback) { const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
if (!host_ || host_->is_hidden()) {
result_callback.Run(false, SkBitmap());
return;
}
if (!IsSurfaceAvailableForCopy()) { 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()); result_callback.Run(false, SkBitmap());
return; return;
} }
...@@ -713,7 +719,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( ...@@ -713,7 +719,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface(
const gfx::Size& dst_size, const gfx::Size& dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback, const base::Callback<void(bool, const SkBitmap&)>& callback,
const SkColorType color_type) { const SkColorType color_type) {
if (!IsReadbackConfigSupported(color_type)) { if ((!host_ || host_->is_hidden()) ||
!IsReadbackConfigSupported(color_type)) {
callback.Run(false, SkBitmap()); callback.Run(false, SkBitmap());
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment