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

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

Issue 2564163003: ShapeDetection: Add ShapeDetectionProvider (Closed)
Patch Set: Name change: mockFaceDetectionProviderReady, rebase 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
« no previous file with comments | « third_party/WebKit/Source/modules/shapedetection/FaceDetector.h ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fc557c67afd7952793bf111ce06566d5af955843..982ecd45c1e0684ee5d625accc5e02583b7f0e29 100644
--- a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
+++ b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
@@ -10,7 +10,9 @@
#include "core/frame/LocalFrame.h"
#include "core/html/canvas/CanvasImageSource.h"
#include "modules/shapedetection/DetectedFace.h"
+#include "modules/shapedetection/FaceDetectorOptions.h"
#include "public/platform/InterfaceProvider.h"
+#include "public/platform/modules/shapedetection/facedetection_provider.mojom-blink.h"
namespace blink {
@@ -21,13 +23,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::FaceDetectionProviderPtr 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(
@@ -43,7 +50,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))));
« no previous file with comments | « third_party/WebKit/Source/modules/shapedetection/FaceDetector.h ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698