| 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/BluetoothRemoteGATTCharacteristic.h" | 5 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.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/DOMDataView.h" | 10 #include "core/dom/DOMDataView.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) | 112 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) |
| 113 return; | 113 return; |
| 114 | 114 |
| 115 DOMDataView* domDataView = ConvertWebVectorToDataView(value); | 115 DOMDataView* domDataView = ConvertWebVectorToDataView(value); |
| 116 if (m_webCharacteristic) | 116 if (m_webCharacteristic) |
| 117 m_webCharacteristic->setValue(domDataView); | 117 m_webCharacteristic->setValue(domDataView); |
| 118 | 118 |
| 119 m_resolver->resolve(domDataView); | 119 m_resolver->resolve(domDataView); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void onError(const WebBluetoothError& e) override | 122 void onError(const mojom::WebBluetoothError& e) override |
| 123 { | 123 { |
| 124 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) | 124 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) |
| 125 return; | 125 return; |
| 126 m_resolver->reject(BluetoothError::take(m_resolver, e)); | 126 m_resolver->reject(BluetoothError::take(m_resolver, e)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic; | 130 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic; |
| 131 Persistent<ScriptPromiseResolver> m_resolver; | 131 Persistent<ScriptPromiseResolver> m_resolver; |
| 132 }; | 132 }; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 157 { | 157 { |
| 158 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) | 158 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) |
| 159 return; | 159 return; |
| 160 | 160 |
| 161 if (m_webCharacteristic) { | 161 if (m_webCharacteristic) { |
| 162 m_webCharacteristic->setValue(ConvertWebVectorToDataView(value)); | 162 m_webCharacteristic->setValue(ConvertWebVectorToDataView(value)); |
| 163 } | 163 } |
| 164 m_resolver->resolve(); | 164 m_resolver->resolve(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void onError(const WebBluetoothError& e) override | 167 void onError(const mojom::WebBluetoothError& e) override |
| 168 { | 168 { |
| 169 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) | 169 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex
t()->activeDOMObjectsAreStopped()) |
| 170 return; | 170 return; |
| 171 m_resolver->reject(BluetoothError::take(m_resolver, e)); | 171 m_resolver->reject(BluetoothError::take(m_resolver, e)); |
| 172 } | 172 } |
| 173 | 173 |
| 174 private: | 174 private: |
| 175 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic; | 175 WeakPersistent<BluetoothRemoteGATTCharacteristic> m_webCharacteristic; |
| 176 Persistent<ScriptPromiseResolver> m_resolver; | 176 Persistent<ScriptPromiseResolver> m_resolver; |
| 177 }; | 177 }; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) | 242 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) |
| 243 { | 243 { |
| 244 visitor->trace(m_properties); | 244 visitor->trace(m_properties); |
| 245 visitor->trace(m_value); | 245 visitor->trace(m_value); |
| 246 EventTargetWithInlineData::trace(visitor); | 246 EventTargetWithInlineData::trace(visitor); |
| 247 ActiveDOMObject::trace(visitor); | 247 ActiveDOMObject::trace(visitor); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |