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

Side by Side Diff: third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp

Issue 2681913003: RELAND: ShapeDetection: use mojom::Bitmap for mojo interface. (Closed)
Patch Set: Fix the issue of failing to fetch bitmap module Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/shapedetection/FaceDetector.h" 5 #include "modules/shapedetection/FaceDetector.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/dom/DOMRect.h" 8 #include "core/dom/DOMRect.h"
9 #include "core/html/canvas/CanvasImageSource.h" 9 #include "core/html/canvas/CanvasImageSource.h"
10 #include "modules/shapedetection/DetectedFace.h" 10 #include "modules/shapedetection/DetectedFace.h"
(...skipping 17 matching lines...) Expand all
28 shape_detection::mojom::blink::FaceDetectionProviderPtr provider; 28 shape_detection::mojom::blink::FaceDetectionProviderPtr provider;
29 Platform::current()->interfaceProvider()->getInterface( 29 Platform::current()->interfaceProvider()->getInterface(
30 mojo::MakeRequest(&provider)); 30 mojo::MakeRequest(&provider));
31 provider->CreateFaceDetection(mojo::MakeRequest(&m_faceService), 31 provider->CreateFaceDetection(mojo::MakeRequest(&m_faceService),
32 std::move(faceDetectorOptions)); 32 std::move(faceDetectorOptions));
33 33
34 m_faceService.set_connection_error_handler(convertToBaseCallback(WTF::bind( 34 m_faceService.set_connection_error_handler(convertToBaseCallback(WTF::bind(
35 &FaceDetector::onFaceServiceConnectionError, wrapWeakPersistent(this)))); 35 &FaceDetector::onFaceServiceConnectionError, wrapWeakPersistent(this))));
36 } 36 }
37 37
38 ScriptPromise FaceDetector::doDetect( 38 ScriptPromise FaceDetector::doDetect(ScriptPromiseResolver* resolver,
39 ScriptPromiseResolver* resolver, 39 skia::mojom::blink::BitmapPtr bitmap) {
40 mojo::ScopedSharedBufferHandle sharedBufferHandle,
41 int imageWidth,
42 int imageHeight) {
43 ScriptPromise promise = resolver->promise(); 40 ScriptPromise promise = resolver->promise();
44 if (!m_faceService) { 41 if (!m_faceService) {
45 resolver->reject(DOMException::create( 42 resolver->reject(DOMException::create(
46 NotSupportedError, "Face detection service unavailable.")); 43 NotSupportedError, "Face detection service unavailable."));
47 return promise; 44 return promise;
48 } 45 }
49 m_faceServiceRequests.insert(resolver); 46 m_faceServiceRequests.insert(resolver);
50 m_faceService->Detect(std::move(sharedBufferHandle), imageWidth, imageHeight, 47 m_faceService->Detect(std::move(bitmap),
51 convertToBaseCallback(WTF::bind( 48 convertToBaseCallback(WTF::bind(
52 &FaceDetector::onDetectFaces, wrapPersistent(this), 49 &FaceDetector::onDetectFaces, wrapPersistent(this),
53 wrapPersistent(resolver)))); 50 wrapPersistent(resolver))));
54 return promise; 51 return promise;
55 } 52 }
56 53
57 void FaceDetector::onDetectFaces( 54 void FaceDetector::onDetectFaces(
58 ScriptPromiseResolver* resolver, 55 ScriptPromiseResolver* resolver,
59 shape_detection::mojom::blink::FaceDetectionResultPtr faceDetectionResult) { 56 shape_detection::mojom::blink::FaceDetectionResultPtr faceDetectionResult) {
60 DCHECK(m_faceServiceRequests.contains(resolver)); 57 DCHECK(m_faceServiceRequests.contains(resolver));
(...skipping 17 matching lines...) Expand all
78 m_faceServiceRequests.clear(); 75 m_faceServiceRequests.clear();
79 m_faceService.reset(); 76 m_faceService.reset();
80 } 77 }
81 78
82 DEFINE_TRACE(FaceDetector) { 79 DEFINE_TRACE(FaceDetector) {
83 ShapeDetector::trace(visitor); 80 ShapeDetector::trace(visitor);
84 visitor->trace(m_faceServiceRequests); 81 visitor->trace(m_faceServiceRequests);
85 } 82 }
86 83
87 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698