forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shape Detection: Implement FaceDetection on Mac as out-of-process ser…
…vice This CL implements FaceDetection in //services/shape_detection. The Browser forwards requests from the Renderer process to a Utility process, which detects faces using Mac native CoreImage library and returns detection result. DESIGN_DOC=http://tinyurl.com/shape-detection-in-chromium BUG=659139 TEST=content/browser/shapedetection/shapedetection_browsertest.cc CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2528743002 Cr-Commit-Position: refs/heads/master@{#445942}
- Loading branch information
1 parent
12040fd
commit 6dd8f46
Showing
24 changed files
with
466 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
content/browser/shapedetection/face_detection_service_dispatcher.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2017 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 CONTENT_BROWSER_SHAPEDETECTION_FACE_DETECTION_SERVICE_DISPATCHER_H_ | ||
#define CONTENT_BROWSER_SHAPEDETECTION_FACE_DETECTION_SERVICE_DISPATCHER_H_ | ||
|
||
#include "content/common/content_export.h" | ||
#include "content/public/common/service_manager_connection.h" | ||
#include "services/service_manager/public/cpp/connector.h" | ||
#include "services/shape_detection/public/interfaces/constants.mojom.h" | ||
#include "services/shape_detection/public/interfaces/facedetection_provider.mojom.h" | ||
|
||
namespace content { | ||
|
||
// Because the renderer cannot launch an out-of-process service on its own, we | ||
// use |FaceDetectionServiceDispatcher| to forward requests to Service Manager, | ||
// which then starts Face Detection Service in a utility process. | ||
namespace FaceDetectionServiceDispatcher { | ||
|
||
static void CreateMojoService( | ||
shape_detection::mojom::FaceDetectionProviderRequest request) { | ||
service_manager::Connector* connector = | ||
ServiceManagerConnection::GetForProcess()->GetConnector(); | ||
connector->BindInterface(shape_detection::mojom::kServiceName, | ||
std::move(request)); | ||
} | ||
|
||
} // namespace FaceDetectionServiceDispatcher | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_BROWSER_SHAPEDETECTION_FACE_DETECTION_SERVICE_DISPATCHER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright 2017 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. | ||
|
||
import("//services/service_manager/public/cpp/service.gni") | ||
import("//services/service_manager/public/service_manifest.gni") | ||
|
||
source_set("lib") { | ||
sources = [ | ||
"face_detection_provider_impl.h", | ||
"shape_detection_service.cc", | ||
"shape_detection_service.h", | ||
] | ||
|
||
if (is_mac) { | ||
sources += [ | ||
"face_detection_impl_mac.h", | ||
"face_detection_impl_mac.mm", | ||
] | ||
} else { | ||
sources += [ "face_detection_provider_impl.cc" ] | ||
} | ||
|
||
deps = [ | ||
"//mojo/public/cpp/bindings", | ||
"//ui/gfx", | ||
"//ui/gfx/geometry", | ||
] | ||
|
||
public_deps = [ | ||
"//base", | ||
"//media/capture", | ||
"//services/service_manager/public/cpp", | ||
"//services/shape_detection/public/interfaces", | ||
] | ||
|
||
data_deps = [ | ||
":manifest", | ||
] | ||
} | ||
|
||
service_manifest("manifest") { | ||
name = "shape_detection" | ||
source = "manifest.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules = [ | ||
"+media/capture/video/scoped_result_callback.h", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Shape Detection is an isolated service that exists to facilitate safe | ||
face/barcode detection. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2017 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_IMPL_MAC_H_ | ||
#define SERVICES_SHAPE_DETECTION_FACE_DETECTION_IMPL_MAC_H_ | ||
|
||
#import <QuartzCore/QuartzCore.h> | ||
|
||
#include "base/mac/scoped_nsobject.h" | ||
#include "services/shape_detection/public/interfaces/facedetection.mojom.h" | ||
|
||
namespace shape_detection { | ||
|
||
class FaceDetectionImplMac : public shape_detection::mojom::FaceDetection { | ||
public: | ||
FaceDetectionImplMac(shape_detection::mojom::FaceDetectorOptionsPtr options); | ||
~FaceDetectionImplMac() override; | ||
|
||
void Detect(mojo::ScopedSharedBufferHandle frame_data, | ||
uint32_t width, | ||
uint32_t height, | ||
const shape_detection::mojom::FaceDetection::DetectCallback& | ||
callback) override; | ||
|
||
private: | ||
base::scoped_nsobject<CIContext> context_; | ||
base::scoped_nsobject<CIDetector> detector_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(FaceDetectionImplMac); | ||
}; | ||
|
||
} // namespace shape_detection | ||
|
||
#endif // SERVICES_SHAPE_DETECTION_FACE_DETECTION_IMPL_MAC_H_ |
Oops, something went wrong.