Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Unified Diff: third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp

Issue 2564163003: ShapeDetection: Add ShapeDetectionProvider (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
diff --git a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
index fd0952b230ad67b9c46ea1dbb3e446b3c56507f9..af8d17c24844467c98e29e5e3f3f79eff6fef31e 100644
--- a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
+++ b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
@@ -10,6 +10,7 @@
#include "core/frame/LocalFrame.h"
#include "core/html/canvas/CanvasImageSource.h"
#include "public/platform/InterfaceProvider.h"
+#include "public/platform/modules/shapedetection/shapedetection_provider.mojom-blink.h"
namespace blink {
@@ -20,13 +21,18 @@ FaceDetector* FaceDetector::create(Document& document,
FaceDetector::FaceDetector(LocalFrame& frame,
const FaceDetectorOptions& options)
- : ShapeDetector(frame),
- m_faceDetectorOptions(mojom::blink::FaceDetectorOptions::New()) {
- frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_faceService));
+ : ShapeDetector(frame) {
+ mojom::blink::FaceDetectorOptionsPtr faceDetectorOptions =
+ mojom::blink::FaceDetectorOptions::New();
+ faceDetectorOptions->max_detected_faces = options.maxDetectedFaces();
+ faceDetectorOptions->fast_mode = options.fastMode();
+ mojom::blink::ShapeDetectionProviderPtr provider;
+ frame.interfaceProvider()->getInterface(mojo::GetProxy(&provider));
+ provider->CreateFaceDetection(mojo::GetProxy(&m_faceService),
+ std::move(faceDetectorOptions));
+
m_faceService.set_connection_error_handler(convertToBaseCallback(WTF::bind(
&FaceDetector::onFaceServiceConnectionError, wrapWeakPersistent(this))));
- m_faceDetectorOptions->max_detected_faces = options.maxDetectedFaces();
- m_faceDetectorOptions->fast_mode = options.fastMode();
}
ScriptPromise FaceDetector::doDetect(
@@ -42,7 +48,6 @@ ScriptPromise FaceDetector::doDetect(
}
m_faceServiceRequests.add(resolver);
m_faceService->Detect(std::move(sharedBufferHandle), imageWidth, imageHeight,
- m_faceDetectorOptions.Clone(),
convertToBaseCallback(WTF::bind(
&FaceDetector::onDetectFaces, wrapPersistent(this),
wrapPersistent(resolver))));

Powered by Google App Engine
This is Rietveld 408576698