| 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/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 for (WebBluetoothRemoteGATTCharacteristicInit* webCharacteristic : | 68 for (WebBluetoothRemoteGATTCharacteristicInit* webCharacteristic : |
| 69 webCharacteristics) { | 69 webCharacteristics) { |
| 70 characteristics.append(BluetoothRemoteGATTCharacteristic::take( | 70 characteristics.append(BluetoothRemoteGATTCharacteristic::take( |
| 71 m_resolver, wrapUnique(webCharacteristic), m_service)); | 71 m_resolver, wrapUnique(webCharacteristic), m_service)); |
| 72 } | 72 } |
| 73 m_resolver->resolve(characteristics); | 73 m_resolver->resolve(characteristics); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void onError( | 76 void onError( |
| 77 int32_t | 77 int32_t |
| 78 error /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) | 78 error /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */) |
| 79 override { | 79 override { |
| 80 if (!m_resolver->getExecutionContext() || | 80 if (!m_resolver->getExecutionContext() || |
| 81 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) | 81 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) |
| 82 return; | 82 return; |
| 83 m_resolver->reject(BluetoothError::take(m_resolver, error)); | 83 m_resolver->reject(BluetoothError::take(m_resolver, error)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 Persistent<BluetoothRemoteGATTService> m_service; | 87 Persistent<BluetoothRemoteGATTService> m_service; |
| 88 mojom::blink::WebBluetoothGATTQueryQuantity m_quantity; | 88 mojom::blink::WebBluetoothGATTQueryQuantity m_quantity; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 BluetoothSupplement::fromScriptState(scriptState); | 135 BluetoothSupplement::fromScriptState(scriptState); |
| 136 webbluetooth->getCharacteristics( | 136 webbluetooth->getCharacteristics( |
| 137 m_webService->serviceInstanceID, static_cast<int32_t>(quantity), | 137 m_webService->serviceInstanceID, static_cast<int32_t>(quantity), |
| 138 characteristicsUUID, | 138 characteristicsUUID, |
| 139 new GetCharacteristicsCallback(this, quantity, resolver)); | 139 new GetCharacteristicsCallback(this, quantity, resolver)); |
| 140 | 140 |
| 141 return promise; | 141 return promise; |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |