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

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

Issue 2928413002: Add RectF and PointF typemaps in blink. (Closed)
Patch Set: address comment Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/TextDetector.h" 5 #include "modules/shapedetection/TextDetector.h"
6 6
7 #include "core/dom/DOMException.h" 7 #include "core/dom/DOMException.h"
8 #include "core/geometry/DOMRect.h" 8 #include "core/geometry/DOMRect.h"
9 #include "core/html/canvas/CanvasImageSource.h" 9 #include "core/html/canvas/CanvasImageSource.h"
10 #include "modules/shapedetection/DetectedText.h" 10 #include "modules/shapedetection/DetectedText.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ScriptPromiseResolver* resolver, 44 ScriptPromiseResolver* resolver,
45 Vector<shape_detection::mojom::blink::TextDetectionResultPtr> 45 Vector<shape_detection::mojom::blink::TextDetectionResultPtr>
46 text_detection_results) { 46 text_detection_results) {
47 DCHECK(text_service_requests_.Contains(resolver)); 47 DCHECK(text_service_requests_.Contains(resolver));
48 text_service_requests_.erase(resolver); 48 text_service_requests_.erase(resolver);
49 49
50 HeapVector<Member<DetectedText>> detected_text; 50 HeapVector<Member<DetectedText>> detected_text;
51 for (const auto& text : text_detection_results) { 51 for (const auto& text : text_detection_results) {
52 detected_text.push_back(DetectedText::Create( 52 detected_text.push_back(DetectedText::Create(
53 text->raw_value, 53 text->raw_value,
54 DOMRect::Create(text->bounding_box->x, text->bounding_box->y, 54 DOMRect::Create(text->bounding_box.x, text->bounding_box.y,
55 text->bounding_box->width, 55 text->bounding_box.width, text->bounding_box.height)));
56 text->bounding_box->height)));
57 } 56 }
58 57
59 resolver->Resolve(detected_text); 58 resolver->Resolve(detected_text);
60 } 59 }
61 60
62 void TextDetector::OnTextServiceConnectionError() { 61 void TextDetector::OnTextServiceConnectionError() {
63 for (const auto& request : text_service_requests_) { 62 for (const auto& request : text_service_requests_) {
64 request->Reject(DOMException::Create(kNotSupportedError, 63 request->Reject(DOMException::Create(kNotSupportedError,
65 "Text Detection not implemented.")); 64 "Text Detection not implemented."));
66 } 65 }
67 text_service_requests_.clear(); 66 text_service_requests_.clear();
68 text_service_.reset(); 67 text_service_.reset();
69 } 68 }
70 69
71 DEFINE_TRACE(TextDetector) { 70 DEFINE_TRACE(TextDetector) {
72 ShapeDetector::Trace(visitor); 71 ShapeDetector::Trace(visitor);
73 visitor->Trace(text_service_requests_); 72 visitor->Trace(text_service_requests_);
74 } 73 }
75 74
76 } // namespace blink 75 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698