| Index: chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionImpl.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionImpl.java
|
| index 2035620acc09e46e70692baf37bfbe6cbac930e5..ee952766a7354594a548b3f382f38721049f9eb7 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionImpl.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionImpl.java
|
| @@ -20,8 +20,6 @@ import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
|
| import org.chromium.gfx.mojom.PointF;
|
| 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.BarcodeDetection;
|
| import org.chromium.shape_detection.mojom.BarcodeDetectionResult;
|
|
|
| @@ -42,8 +40,7 @@ public class BarcodeDetectionImpl implements BarcodeDetection {
|
| }
|
|
|
| @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");
|
| @@ -60,9 +57,12 @@ public class BarcodeDetectionImpl implements BarcodeDetection {
|
| return;
|
| }
|
|
|
| + int width = image.width;
|
| + int height = image.height;
|
| final long numPixels = (long) width * height;
|
| // TODO(mcasas): 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 BarcodeDetectionResult[0]);
|
| return;
|
| }
|
| @@ -70,7 +70,7 @@ public class BarcodeDetectionImpl implements BarcodeDetection {
|
| // 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 BarcodeDetectionResult[0]);
|
| return;
|
|
|