| Index: content/browser/android/content_view_core_impl.cc
|
| diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
|
| index 182c0a6f336ca2071a3303065f41072bb9fa2e4b..7201d10674caeb04331921ca3cf5e6da0a4bd6d4 100644
|
| --- a/content/browser/android/content_view_core_impl.cc
|
| +++ b/content/browser/android/content_view_core_impl.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/android/jni_array.h"
|
| #include "base/android/jni_string.h"
|
| #include "base/android/scoped_java_ref.h"
|
| +#include "base/callback_helpers.h"
|
| #include "base/command_line.h"
|
| #include "base/json/json_writer.h"
|
| #include "base/logging.h"
|
| @@ -591,14 +592,41 @@ void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) {
|
| static_cast<jint>(y_dip));
|
| }
|
|
|
| -unsigned int ContentViewCoreImpl::GetScaledContentTexture(
|
| - float scale,
|
| - gfx::Size* out_size) {
|
| +void ContentViewCoreImpl::OnFinishGetScaledContentBitmap(
|
| + const base::Callback<void(bool, const SkBitmap&)>& compositor_callback,
|
| + bool success,
|
| + const SkBitmap& bitmap) {
|
| + base::ScopedClosureRunner scoped_callback_runner(
|
| + base::Bind(compositor_callback, false, SkBitmap()));
|
| +
|
| RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
|
| if (!view)
|
| - return 0;
|
| + return;
|
| + view->UnlockResources();
|
| +
|
| + if (!success)
|
| + return;
|
| + ignore_result(scoped_callback_runner.Release());
|
| + compositor_callback.Run(success, bitmap);
|
| +}
|
| +
|
| +void ContentViewCoreImpl::GetScaledContentBitmap(
|
| + float scale,
|
| + gfx::Size* out_size,
|
| + const base::Callback<void(bool, const SkBitmap&)>& compositor_callback) {
|
| + RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
|
| + if (!view || !view->IsSurfaceAvailableForCopy()) {
|
| + base::ScopedClosureRunner scoped_callback_runner(
|
| + base::Bind(compositor_callback, false, SkBitmap()));
|
| + return;
|
| + }
|
|
|
| - return view->GetScaledContentTexture(scale, out_size);
|
| + base::Callback<void(bool, const SkBitmap&)> callback =
|
| + base::Bind(&ContentViewCoreImpl::OnFinishGetScaledContentBitmap,
|
| + base::Unretained(this),
|
| + compositor_callback);
|
| + view->LockResources();
|
| + view->GetScaledContentBitmap(scale, out_size, callback);
|
| }
|
|
|
| void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) {
|
|
|