| Index: services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java
|
| diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java
|
| index 158e925553dc0a9a1daa9983cb11795a59b8f79c..4d88df132ea630035c9358cb2dcdfaf8b07fd996 100644
|
| --- a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java
|
| +++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImpl.java
|
| @@ -11,7 +11,6 @@
|
| import android.os.AsyncTask;
|
|
|
| import org.chromium.base.Log;
|
| -import org.chromium.base.VisibleForTesting;
|
| import org.chromium.gfx.mojom.RectF;
|
| import org.chromium.mojo.system.MojoException;
|
| import org.chromium.mojo.system.SharedBufferHandle;
|
| @@ -30,18 +29,12 @@
|
| public class FaceDetectionImpl implements FaceDetection {
|
| private static final String TAG = "FaceDetectionImpl";
|
| private static final int MAX_FACES = 32;
|
| - private static FaceDetector sFaceDetector;
|
| private final boolean mFastMode;
|
| private final int mMaxFaces;
|
|
|
| FaceDetectionImpl(FaceDetectorOptions options) {
|
| mFastMode = options.fastMode;
|
| mMaxFaces = Math.min(options.maxDetectedFaces, MAX_FACES);
|
| - }
|
| -
|
| - @VisibleForTesting
|
| - public static void setFaceDetector(FaceDetector faceDetector) {
|
| - sFaceDetector = faceDetector;
|
| }
|
|
|
| @Override
|
| @@ -70,12 +63,7 @@
|
| // to create this intermediate Bitmap.
|
| // TODO(xianglu): Consider worker pool as appropriate threads.
|
| // http://crbug.com/655814
|
| - try {
|
| - bitmap.copyPixelsFromBuffer(imageBuffer);
|
| - } catch (RuntimeException e) {
|
| - callback.call(new FaceDetectionResult[0]);
|
| - return;
|
| - }
|
| + bitmap.copyPixelsFromBuffer(imageBuffer);
|
|
|
| // A Bitmap must be in 565 format for findFaces() to work. See
|
| // http://androidxref.com/7.0.0_r1/xref/frameworks/base/media/java/android/media/FaceDetector.java#124
|
| @@ -96,9 +84,7 @@
|
| AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
|
| @Override
|
| public void run() {
|
| - final FaceDetector detector = (sFaceDetector != null)
|
| - ? sFaceDetector
|
| - : new FaceDetector(width, height, mMaxFaces);
|
| + final FaceDetector detector = new FaceDetector(width, height, mMaxFaces);
|
| Face[] detectedFaces = new Face[mMaxFaces];
|
| // findFaces() will stop at |mMaxFaces|.
|
| final int numberOfFaces = detector.findFaces(unPremultipliedBitmap, detectedFaces);
|
|
|