| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bluetooth/BluetoothRemoteGATTService.h" | 5 #include "modules/bluetooth/BluetoothRemoteGATTService.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 BluetoothDevice* device) | 37 BluetoothDevice* device) |
| 38 : m_service(std::move(service)), | 38 : m_service(std::move(service)), |
| 39 m_isPrimary(isPrimary), | 39 m_isPrimary(isPrimary), |
| 40 m_deviceInstanceId(deviceInstanceId), | 40 m_deviceInstanceId(deviceInstanceId), |
| 41 m_device(device) {} | 41 m_device(device) {} |
| 42 | 42 |
| 43 DEFINE_TRACE(BluetoothRemoteGATTService) { | 43 DEFINE_TRACE(BluetoothRemoteGATTService) { |
| 44 visitor->trace(m_device); | 44 visitor->trace(m_device); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Callback that allows us to resolve the promise with a single Characteristic | 47 // Callback that allows us to resolve the promise with a single characteristic |
| 48 // or with a vector owning the characteristics. | 48 // or with a vector owning the characteristics. |
| 49 void BluetoothRemoteGATTService::GetCharacteristicsCallback( | 49 void BluetoothRemoteGATTService::GetCharacteristicsCallback( |
| 50 const String& serviceInstanceId, | 50 const String& serviceInstanceId, |
| 51 mojom::blink::WebBluetoothGATTQueryQuantity quantity, | 51 mojom::blink::WebBluetoothGATTQueryQuantity quantity, |
| 52 ScriptPromiseResolver* resolver, | 52 ScriptPromiseResolver* resolver, |
| 53 mojom::blink::WebBluetoothResult result, | 53 mojom::blink::WebBluetoothResult result, |
| 54 Optional<Vector<mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr>> | 54 Optional<Vector<mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr>> |
| 55 characteristics) { | 55 characteristics) { |
| 56 if (!resolver->getExecutionContext() || | 56 if (!resolver->getExecutionContext() || |
| 57 resolver->getExecutionContext()->isContextDestroyed()) | 57 resolver->getExecutionContext()->isContextDestroyed()) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 m_service->instance_id, quantity, uuid, | 154 m_service->instance_id, quantity, uuid, |
| 155 convertToBaseCallback( | 155 convertToBaseCallback( |
| 156 WTF::bind(&BluetoothRemoteGATTService::GetCharacteristicsCallback, | 156 WTF::bind(&BluetoothRemoteGATTService::GetCharacteristicsCallback, |
| 157 wrapPersistent(this), m_service->instance_id, quantity, | 157 wrapPersistent(this), m_service->instance_id, quantity, |
| 158 wrapPersistent(resolver)))); | 158 wrapPersistent(resolver)))); |
| 159 | 159 |
| 160 return promise; | 160 return promise; |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |