Chromium Code Reviews| 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/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/events/Event.h" | 9 #include "core/events/Event.h" |
| 10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 return new BluetoothRemoteGATTCharacteristic( | 44 return new BluetoothRemoteGATTCharacteristic( |
| 45 context, std::move(characteristic), service, device); | 45 context, std::move(characteristic), service, device); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void BluetoothRemoteGATTCharacteristic::setValue(DOMDataView* domDataView) { | 48 void BluetoothRemoteGATTCharacteristic::setValue(DOMDataView* domDataView) { |
| 49 m_value = domDataView; | 49 m_value = domDataView; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void BluetoothRemoteGATTCharacteristic::dispatchCharacteristicValueChanged( | 52 void BluetoothRemoteGATTCharacteristic::dispatchCharacteristicValueChanged( |
| 53 const Vector<uint8_t>& value) { | 53 const Vector<uint8_t>& value) { |
| 54 if (!getGatt()->connected()) | |
|
Jeffrey Yasskin
2017/01/20 21:29:41
Did/could you double-check that we don't have any
ortuno
2017/01/24 02:38:25
So there are 7 instances of checking for connected
| |
| 55 return; | |
| 54 this->setValue(BluetoothRemoteGATTUtils::ConvertWTFVectorToDataView(value)); | 56 this->setValue(BluetoothRemoteGATTUtils::ConvertWTFVectorToDataView(value)); |
| 55 dispatchEvent(Event::create(EventTypeNames::characteristicvaluechanged)); | 57 dispatchEvent(Event::create(EventTypeNames::characteristicvaluechanged)); |
| 56 } | 58 } |
| 57 | 59 |
| 58 void BluetoothRemoteGATTCharacteristic::contextDestroyed(ExecutionContext*) { | 60 void BluetoothRemoteGATTCharacteristic::contextDestroyed(ExecutionContext*) { |
| 59 notifyCharacteristicObjectRemoved(); | 61 notifyCharacteristicObjectRemoved(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 void BluetoothRemoteGATTCharacteristic::dispose() { | 64 void BluetoothRemoteGATTCharacteristic::dispose() { |
| 63 notifyCharacteristicObjectRemoved(); | 65 notifyCharacteristicObjectRemoved(); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) { | 432 DEFINE_TRACE(BluetoothRemoteGATTCharacteristic) { |
| 431 visitor->trace(m_service); | 433 visitor->trace(m_service); |
| 432 visitor->trace(m_properties); | 434 visitor->trace(m_properties); |
| 433 visitor->trace(m_value); | 435 visitor->trace(m_value); |
| 434 visitor->trace(m_device); | 436 visitor->trace(m_device); |
| 435 EventTargetWithInlineData::trace(visitor); | 437 EventTargetWithInlineData::trace(visitor); |
| 436 ContextLifecycleObserver::trace(visitor); | 438 ContextLifecycleObserver::trace(visitor); |
| 437 } | 439 } |
| 438 | 440 |
| 439 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |