Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTCharacteristic.cpp

Issue 2648583004: bluetooth: Stop firing value changed events after gatt disconnects (Closed)
Patch Set: Make iframe subscribe to notifications and add comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-iframe.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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())
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/resources/bluetooth/heart-rate-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698