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

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

Issue 2528743002: Shape Detection: Implement FaceDetection on Mac as out-of-process service (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/ShapeDetector.cpp
diff --git a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
index abfa2e3ddf937b308d08632890be87dd3294b2fc..a94c8a52eee4549d7b304ad1eb5101431910bb49 100644
--- a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
+++ b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
@@ -15,8 +15,10 @@
#include "core/html/HTMLVideoElement.h"
#include "core/html/canvas/CanvasImageSource.h"
#include "modules/shapedetection/DetectedBarcode.h"
+#include "platform/ServiceConnector.h"
#include "platform/graphics/Image.h"
#include "public/platform/InterfaceProvider.h"
+#include "services/shape_detection/public/interfaces/constants.mojom-blink.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "wtf/CheckedNumeric.h"
@@ -43,12 +45,23 @@ static CanvasImageSource* toImageSourceInternal(
} // anonymous namespace
+// TODO(xianglu): We don't need a service per frame. Remove this argument.
ShapeDetector::ShapeDetector(LocalFrame& frame) {
DCHECK(!m_faceService.is_bound());
DCHECK(!m_barcodeService.is_bound());
+#if OS(MACOSX)
+ ServiceConnector::instance().ConnectToInterface(
+ shape_detection::mojom::blink::kServiceName,
+ mojo::GetProxy(&m_faceService));
+ ServiceConnector::instance().ConnectToInterface(
+ shape_detection::mojom::blink::kServiceName,
+ mojo::GetProxy(&m_barcodeService));
+#else
+ // TODO(xianglu): Move Android implementation to service/ as well.
DCHECK(frame.interfaceProvider());
frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_faceService));
frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_barcodeService));
+#endif
m_faceService.set_connection_error_handler(convertToBaseCallback(WTF::bind(
&ShapeDetector::onFaceServiceConnectionError, wrapWeakPersistent(this))));
m_barcodeService.set_connection_error_handler(convertToBaseCallback(

Powered by Google App Engine
This is Rietveld 408576698