| Index: chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
|
| index b6f541c20a974b2b71230a9ed8905ddfc0f98b7a..30f3a82dc6bf66c19a3856f9a2fe2e4158d0558d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
|
| @@ -18,8 +18,6 @@ import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
|
| import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
|
| import org.chromium.gfx.mojom.RectF;
|
| import org.chromium.mojo.system.MojoException;
|
| -import org.chromium.mojo.system.SharedBufferHandle;
|
| -import org.chromium.mojo.system.SharedBufferHandle.MapFlags;
|
| import org.chromium.shape_detection.mojom.TextDetection;
|
| import org.chromium.shape_detection.mojom.TextDetectionResult;
|
|
|
| @@ -40,8 +38,7 @@ public class TextDetectionImpl implements TextDetection {
|
| }
|
|
|
| @Override
|
| - public void detect(
|
| - SharedBufferHandle frameData, int width, int height, DetectResponse callback) {
|
| + public void detect(org.chromium.skia.mojom.Bitmap image, DetectResponse callback) {
|
| if (!ExternalAuthUtils.getInstance().canUseGooglePlayServices(
|
| mContext, new UserRecoverableErrorHandler.Silent())) {
|
| Log.e(TAG, "Google Play Services not available");
|
| @@ -58,9 +55,12 @@ public class TextDetectionImpl implements TextDetection {
|
| return;
|
| }
|
|
|
| + int width = image.width;
|
| + int height = image.height;
|
| final long numPixels = (long) width * height;
|
| // TODO(xianglu): https://crbug.com/670028 homogeneize overflow checking.
|
| - if (!frameData.isValid() || width <= 0 || height <= 0 || numPixels > (Long.MAX_VALUE / 4)) {
|
| + if (image.pixelData == null || width <= 0 || height <= 0
|
| + || numPixels > (Long.MAX_VALUE / 4)) {
|
| callback.call(new TextDetectionResult[0]);
|
| return;
|
| }
|
| @@ -68,7 +68,7 @@ public class TextDetectionImpl implements TextDetection {
|
| // Mapping |frameData| will fail if the intended mapped size is larger
|
| // than its actual capacity, which is limited by the appropriate
|
| // mojo::edk::Configuration entry.
|
| - ByteBuffer imageBuffer = frameData.map(0, numPixels * 4, MapFlags.none());
|
| + ByteBuffer imageBuffer = ByteBuffer.wrap(image.pixelData);
|
| if (imageBuffer.capacity() <= 0) {
|
| callback.call(new TextDetectionResult[0]);
|
| return;
|
|
|