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

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

Issue 2696183002: Migrate WTF::HashSet::remove() to ::erase() [part 1] (Closed)
Patch Set: one more platform-specific reference Created 3 years, 10 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/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/DetectedText.h" 10 #include "modules/shapedetection/DetectedText.h"
(...skipping 30 matching lines...) Expand all
41 &TextDetector::onDetectText, wrapPersistent(this), 41 &TextDetector::onDetectText, wrapPersistent(this),
42 wrapPersistent(resolver)))); 42 wrapPersistent(resolver))));
43 return promise; 43 return promise;
44 } 44 }
45 45
46 void TextDetector::onDetectText( 46 void TextDetector::onDetectText(
47 ScriptPromiseResolver* resolver, 47 ScriptPromiseResolver* resolver,
48 Vector<shape_detection::mojom::blink::TextDetectionResultPtr> 48 Vector<shape_detection::mojom::blink::TextDetectionResultPtr>
49 textDetectionResults) { 49 textDetectionResults) {
50 DCHECK(m_textServiceRequests.contains(resolver)); 50 DCHECK(m_textServiceRequests.contains(resolver));
51 m_textServiceRequests.remove(resolver); 51 m_textServiceRequests.erase(resolver);
52 52
53 HeapVector<Member<DetectedText>> detectedText; 53 HeapVector<Member<DetectedText>> detectedText;
54 for (const auto& text : textDetectionResults) { 54 for (const auto& text : textDetectionResults) {
55 detectedText.push_back(DetectedText::create( 55 detectedText.push_back(DetectedText::create(
56 text->raw_value, 56 text->raw_value,
57 DOMRect::create(text->bounding_box->x, text->bounding_box->y, 57 DOMRect::create(text->bounding_box->x, text->bounding_box->y,
58 text->bounding_box->width, 58 text->bounding_box->width,
59 text->bounding_box->height))); 59 text->bounding_box->height)));
60 } 60 }
61 61
62 resolver->resolve(detectedText); 62 resolver->resolve(detectedText);
63 } 63 }
64 64
65 void TextDetector::onTextServiceConnectionError() { 65 void TextDetector::onTextServiceConnectionError() {
66 for (const auto& request : m_textServiceRequests) { 66 for (const auto& request : m_textServiceRequests) {
67 request->reject(DOMException::create(NotSupportedError, 67 request->reject(DOMException::create(NotSupportedError,
68 "Text Detection not implemented.")); 68 "Text Detection not implemented."));
69 } 69 }
70 m_textServiceRequests.clear(); 70 m_textServiceRequests.clear();
71 m_textService.reset(); 71 m_textService.reset();
72 } 72 }
73 73
74 DEFINE_TRACE(TextDetector) { 74 DEFINE_TRACE(TextDetector) {
75 ShapeDetector::trace(visitor); 75 ShapeDetector::trace(visitor);
76 visitor->trace(m_textServiceRequests); 76 visitor->trace(m_textServiceRequests);
77 } 77 }
78 78
79 } // namespace blink 79 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698