| 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" | |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMDataView.h" | 9 #include "core/dom/DOMDataView.h" |
| 11 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| 12 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 13 #include "core/events/Event.h" | 12 #include "core/events/Event.h" |
| 14 #include "core/inspector/ConsoleMessage.h" | 13 #include "core/inspector/ConsoleMessage.h" |
| 15 #include "modules/bluetooth/BluetoothCharacteristicProperties.h" | 14 #include "modules/bluetooth/BluetoothCharacteristicProperties.h" |
| 16 #include "modules/bluetooth/BluetoothError.h" | 15 #include "modules/bluetooth/BluetoothError.h" |
| 17 #include "modules/bluetooth/BluetoothRemoteGATTService.h" | 16 #include "modules/bluetooth/BluetoothRemoteGATTService.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 45 : ActiveDOMObject(context), | 44 : ActiveDOMObject(context), |
| 46 m_webCharacteristic(std::move(webCharacteristic)), | 45 m_webCharacteristic(std::move(webCharacteristic)), |
| 47 m_service(service), | 46 m_service(service), |
| 48 m_stopped(false) { | 47 m_stopped(false) { |
| 49 m_properties = BluetoothCharacteristicProperties::create( | 48 m_properties = BluetoothCharacteristicProperties::create( |
| 50 m_webCharacteristic->characteristicProperties); | 49 m_webCharacteristic->characteristicProperties); |
| 51 // See example in Source/platform/heap/ThreadState.h | 50 // See example in Source/platform/heap/ThreadState.h |
| 52 ThreadState::current()->registerPreFinalizer(this); | 51 ThreadState::current()->registerPreFinalizer(this); |
| 53 } | 52 } |
| 54 | 53 |
| 55 BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::take( | 54 BluetoothRemoteGATTCharacteristic* BluetoothRemoteGATTCharacteristic::create( |
| 56 ScriptPromiseResolver* resolver, | 55 ExecutionContext* context, |
| 57 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic, | 56 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic, |
| 58 BluetoothRemoteGATTService* service) { | 57 BluetoothRemoteGATTService* service) { |
| 59 if (!webCharacteristic) { | 58 DCHECK(webCharacteristic); |
| 60 return nullptr; | 59 |
| 61 } | |
| 62 BluetoothRemoteGATTCharacteristic* characteristic = | 60 BluetoothRemoteGATTCharacteristic* characteristic = |
| 63 new BluetoothRemoteGATTCharacteristic(resolver->getExecutionContext(), | 61 new BluetoothRemoteGATTCharacteristic( |
| 64 std::move(webCharacteristic), | 62 context, std::move(webCharacteristic), service); |
| 65 service); | |
| 66 // See note in ActiveDOMObject about suspendIfNeeded. | 63 // See note in ActiveDOMObject about suspendIfNeeded. |
| 67 characteristic->suspendIfNeeded(); | 64 characteristic->suspendIfNeeded(); |
| 68 return characteristic; | 65 return characteristic; |
| 69 } | 66 } |
| 70 | 67 |
| 71 void BluetoothRemoteGATTCharacteristic::setValue(DOMDataView* domDataView) { | 68 void BluetoothRemoteGATTCharacteristic::setValue(DOMDataView* domDataView) { |
| 72 m_value = domDataView; | 69 m_value = domDataView; |
| 73 } | 70 } |
| 74 | 71 |
| 75 void BluetoothRemoteGATTCharacteristic::dispatchCharacteristicValueChanged( | 72 void BluetoothRemoteGATTCharacteristic::dispatchCharacteristicValueChanged( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 369 |
| 373 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) { | 370 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) { |
| 374 visitor->trace(m_service); | 371 visitor->trace(m_service); |
| 375 visitor->trace(m_properties); | 372 visitor->trace(m_properties); |
| 376 visitor->trace(m_value); | 373 visitor->trace(m_value); |
| 377 EventTargetWithInlineData::trace(visitor); | 374 EventTargetWithInlineData::trace(visitor); |
| 378 ActiveDOMObject::trace(visitor); | 375 ActiveDOMObject::trace(visitor); |
| 379 } | 376 } |
| 380 | 377 |
| 381 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |