Chromium Code Reviews| 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( |
|
yzshen1
2016/12/01 21:28:26
Do we always need both m_faceService and m_barcode
xianglu
2016/12/02 18:11:24
That's a good point. I separated them to two const
yzshen1
2016/12/05 17:41:19
Depending on which constructor is called, this ins
xianglu
2016/12/05 18:50:02
Yes. ShapeDetector only serves one task, and users
|
| + 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( |