Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/frame/LocalFrame.h" | |
| 10 #include "core/html/canvas/CanvasImageSource.h" | 9 #include "core/html/canvas/CanvasImageSource.h" |
| 11 #include "modules/shapedetection/DetectedText.h" | 10 #include "modules/shapedetection/DetectedText.h" |
| 12 #include "public/platform/InterfaceProvider.h" | 11 #include "public/platform/InterfaceProvider.h" |
| 12 #include "public/platform/Platform.h" | |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 TextDetector* TextDetector::create(Document& document) { | 16 TextDetector* TextDetector::create(ExecutionContext* executionContext) { |
| 17 return new TextDetector(*document.frame()); | 17 return new TextDetector(executionContext); |
| 18 } | 18 } |
| 19 | 19 |
| 20 TextDetector::TextDetector(LocalFrame& frame) : ShapeDetector(frame) { | 20 TextDetector::TextDetector(ExecutionContext* executionContext) |
|
Reilly Grant (use Gerrit)
2017/01/17 19:51:47
This parameter is unused.
| |
| 21 frame.interfaceProvider()->getInterface(mojo::MakeRequest(&m_textService)); | 21 : ShapeDetector() { |
| 22 Platform::current()->interfaceProvider()->getInterface( | |
| 23 mojo::MakeRequest(&m_textService)); | |
| 22 m_textService.set_connection_error_handler(convertToBaseCallback(WTF::bind( | 24 m_textService.set_connection_error_handler(convertToBaseCallback(WTF::bind( |
| 23 &TextDetector::onTextServiceConnectionError, wrapWeakPersistent(this)))); | 25 &TextDetector::onTextServiceConnectionError, wrapWeakPersistent(this)))); |
| 24 } | 26 } |
| 25 | 27 |
| 26 ScriptPromise TextDetector::doDetect( | 28 ScriptPromise TextDetector::doDetect( |
| 27 ScriptPromiseResolver* resolver, | 29 ScriptPromiseResolver* resolver, |
| 28 mojo::ScopedSharedBufferHandle sharedBufferHandle, | 30 mojo::ScopedSharedBufferHandle sharedBufferHandle, |
| 29 int imageWidth, | 31 int imageWidth, |
| 30 int imageHeight) { | 32 int imageHeight) { |
| 31 ScriptPromise promise = resolver->promise(); | 33 ScriptPromise promise = resolver->promise(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 m_textServiceRequests.clear(); | 71 m_textServiceRequests.clear(); |
| 70 m_textService.reset(); | 72 m_textService.reset(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 DEFINE_TRACE(TextDetector) { | 75 DEFINE_TRACE(TextDetector) { |
| 74 ShapeDetector::trace(visitor); | 76 ShapeDetector::trace(visitor); |
| 75 visitor->trace(m_textServiceRequests); | 77 visitor->trace(m_textServiceRequests); |
| 76 } | 78 } |
| 77 | 79 |
| 78 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |