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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: 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 17 matching lines...) Expand all
28 ScriptPromiseResolver* resolver, 28 ScriptPromiseResolver* resolver,
29 mojo::ScopedSharedBufferHandle sharedBufferHandle, 29 mojo::ScopedSharedBufferHandle sharedBufferHandle,
30 int imageWidth, 30 int imageWidth,
31 int imageHeight) { 31 int imageHeight) {
32 ScriptPromise promise = resolver->promise(); 32 ScriptPromise promise = resolver->promise();
33 if (!m_textService) { 33 if (!m_textService) {
34 resolver->reject(DOMException::create( 34 resolver->reject(DOMException::create(
35 NotSupportedError, "Text detection service unavailable.")); 35 NotSupportedError, "Text detection service unavailable."));
36 return promise; 36 return promise;
37 } 37 }
38 m_textServiceRequests.add(resolver); 38 m_textServiceRequests.insert(resolver);
39 m_textService->Detect(std::move(sharedBufferHandle), imageWidth, imageHeight, 39 m_textService->Detect(std::move(sharedBufferHandle), imageWidth, imageHeight,
40 convertToBaseCallback(WTF::bind( 40 convertToBaseCallback(WTF::bind(
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>
(...skipping 21 matching lines...) Expand all
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