| OLD | NEW |
| 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/BarcodeDetector.h" | 5 #include "modules/shapedetection/BarcodeDetector.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/imagecapture/Point2D.h" | 10 #include "modules/imagecapture/Point2D.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 wrapPersistent(this), | 44 wrapPersistent(this), |
| 45 wrapPersistent(resolver)))); | 45 wrapPersistent(resolver)))); |
| 46 return promise; | 46 return promise; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void BarcodeDetector::onDetectBarcodes( | 49 void BarcodeDetector::onDetectBarcodes( |
| 50 ScriptPromiseResolver* resolver, | 50 ScriptPromiseResolver* resolver, |
| 51 Vector<shape_detection::mojom::blink::BarcodeDetectionResultPtr> | 51 Vector<shape_detection::mojom::blink::BarcodeDetectionResultPtr> |
| 52 barcodeDetectionResults) { | 52 barcodeDetectionResults) { |
| 53 DCHECK(m_barcodeServiceRequests.contains(resolver)); | 53 DCHECK(m_barcodeServiceRequests.contains(resolver)); |
| 54 m_barcodeServiceRequests.remove(resolver); | 54 m_barcodeServiceRequests.erase(resolver); |
| 55 | 55 |
| 56 HeapVector<Member<DetectedBarcode>> detectedBarcodes; | 56 HeapVector<Member<DetectedBarcode>> detectedBarcodes; |
| 57 for (const auto& barcode : barcodeDetectionResults) { | 57 for (const auto& barcode : barcodeDetectionResults) { |
| 58 HeapVector<Point2D> cornerPoints; | 58 HeapVector<Point2D> cornerPoints; |
| 59 for (const auto& corner_point : barcode->corner_points) { | 59 for (const auto& corner_point : barcode->corner_points) { |
| 60 Point2D point; | 60 Point2D point; |
| 61 point.setX(corner_point->x); | 61 point.setX(corner_point->x); |
| 62 point.setY(corner_point->y); | 62 point.setY(corner_point->y); |
| 63 cornerPoints.push_back(point); | 63 cornerPoints.push_back(point); |
| 64 } | 64 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 m_barcodeServiceRequests.clear(); | 81 m_barcodeServiceRequests.clear(); |
| 82 m_barcodeService.reset(); | 82 m_barcodeService.reset(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 DEFINE_TRACE(BarcodeDetector) { | 85 DEFINE_TRACE(BarcodeDetector) { |
| 86 ShapeDetector::trace(visitor); | 86 ShapeDetector::trace(visitor); |
| 87 visitor->trace(m_barcodeServiceRequests); | 87 visitor->trace(m_barcodeServiceRequests); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |