Commit f5403749 authored by junweifu's avatar junweifu Committed by Commit Bot

ShapeDetection: Split Mac provider from Face Detection implementation

Split the provider in order to support Vision Framework [1] which is more
accurate and can detect more landmarks with computer vision techniques.
This proposal has been merged in Shape Detection specification [2].

Link Mac 10.13 build bots [3] and Face Detection demo[4] here.
Split original large CL[5] up in smaller subpatches including this CL.

[1] https://developer.apple.com/documentation/vision
[2] https://github.com/WICG/shape-detection-api/pull/38
[3] https://codepen.io/miguelao/pen/PmJWro
[4] https://ci.chromium.org/buildbot/chromium.fyi/Chromium%20Mac%2010.13/
[5] https://chromium-review.googlesource.com/c/chromium/src/+/867651/10

BUG=799319

Cq-Include-Trybots: master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win10_chromium_x64_rel_ng
Change-Id: I1910f572f83ae4def3d1f669af3fcd91d53b6305
Reviewed-on: https://chromium-review.googlesource.com/888478
Commit-Queue: Junwei Fu <junwei.fu@intel.com>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533208}
parent d4ceadcb
......@@ -9,7 +9,6 @@ import("//testing/test.gni")
source_set("lib") {
sources = [
"barcode_detection_impl.h",
"face_detection_provider_impl.h",
"shape_detection_service.cc",
"shape_detection_service.h",
"text_detection_impl.h",
......@@ -23,12 +22,13 @@ source_set("lib") {
"detection_utils_mac.mm",
"face_detection_impl_mac.h",
"face_detection_impl_mac.mm",
"face_detection_provider_mac.h",
"face_detection_provider_mac.mm",
"text_detection_impl_mac.h",
"text_detection_impl_mac.mm",
]
libs = [ "QuartzCore.framework" ]
} else if (is_win) {
sources -= [ "face_detection_provider_impl.h" ]
sources += [
"barcode_detection_impl.cc",
"detection_utils_win.cc",
......@@ -44,6 +44,7 @@ source_set("lib") {
sources += [
"barcode_detection_impl.cc",
"face_detection_provider_impl.cc",
"face_detection_provider_impl.h",
"text_detection_impl.cc",
]
}
......
......@@ -5,20 +5,10 @@
#include "services/shape_detection/face_detection_impl_mac.h"
#include "base/mac/scoped_cftyperef.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/shape_detection/detection_utils_mac.h"
#include "services/shape_detection/face_detection_provider_impl.h"
namespace shape_detection {
void FaceDetectionProviderImpl::CreateFaceDetection(
shape_detection::mojom::FaceDetectionRequest request,
shape_detection::mojom::FaceDetectorOptionsPtr options) {
mojo::MakeStrongBinding(
std::make_unique<FaceDetectionImplMac>(std::move(options)),
std::move(request));
}
FaceDetectionImplMac::FaceDetectionImplMac(
shape_detection::mojom::FaceDetectorOptionsPtr options) {
NSString* const accuracy =
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_SHAPE_DETECTION_FACE_DETECTION_PROVIDER_MAC_H_
#define SERVICES_SHAPE_DETECTION_FACE_DETECTION_PROVIDER_MAC_H_
#include "base/macros.h"
#include "services/shape_detection/public/interfaces/facedetection_provider.mojom.h"
namespace shape_detection {
// The FaceDetectionProviderMac class is a provider that binds an implementation
// of mojom::FaceDetection with Core Image or Vision Framework.
class FaceDetectionProviderMac
: public shape_detection::mojom::FaceDetectionProvider {
public:
FaceDetectionProviderMac();
~FaceDetectionProviderMac() override;
// Binds FaceDetection provider request to the implementation of
// mojom::FaceDetectionProvider.
static void Create(mojom::FaceDetectionProviderRequest request);
void CreateFaceDetection(mojom::FaceDetectionRequest request,
mojom::FaceDetectorOptionsPtr options) override;
private:
DISALLOW_COPY_AND_ASSIGN(FaceDetectionProviderMac);
};
} // namespace shape_detection
#endif // SERVICES_SHAPE_DETECTION_FACE_DETECTION_PROVIDER_MAC_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/shape_detection/face_detection_provider_mac.h"
#include <memory>
#include <utility>
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/shape_detection/face_detection_impl_mac.h"
namespace shape_detection {
FaceDetectionProviderMac::FaceDetectionProviderMac() = default;
FaceDetectionProviderMac::~FaceDetectionProviderMac() = default;
// static
void FaceDetectionProviderMac::Create(
mojom::FaceDetectionProviderRequest request) {
mojo::MakeStrongBinding(std::make_unique<FaceDetectionProviderMac>(),
std::move(request));
}
void FaceDetectionProviderMac::CreateFaceDetection(
mojom::FaceDetectionRequest request,
mojom::FaceDetectorOptionsPtr options) {
mojo::MakeStrongBinding(
std::make_unique<FaceDetectionImplMac>(std::move(options)),
std::move(request));
}
} // namespace shape_detection
......@@ -4,12 +4,18 @@
#include "services/shape_detection/shape_detection_service.h"
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/macros.h"
#include "build/build_config.h"
#include "services/service_manager/public/cpp/service_context.h"
#include "services/shape_detection/barcode_detection_impl.h"
#if defined(OS_WIN)
#include "services/shape_detection/face_detection_provider_win.h"
#elif defined(OS_MACOSX)
#include "services/shape_detection/face_detection_provider_mac.h"
#else
#include "services/shape_detection/face_detection_provider_impl.h"
#endif
......@@ -47,6 +53,10 @@ void ShapeDetectionService::OnStart() {
registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create));
registry_.AddInterface(base::Bind(&TextDetectionImpl::Create));
registry_.AddInterface(base::Bind(&FaceDetectionProviderWin::Create));
#elif defined(OS_MACOSX)
registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create));
registry_.AddInterface(base::Bind(&TextDetectionImpl::Create));
registry_.AddInterface(base::Bind(&FaceDetectionProviderMac::Create));
#else
registry_.AddInterface(base::Bind(&BarcodeDetectionImpl::Create));
registry_.AddInterface(base::Bind(&TextDetectionImpl::Create));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment