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

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

Issue 2476173002: bluetooth: Invalidate characteristics when disconnecting (Closed)
Patch Set: Fix test expectations Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/BluetoothDevice.h" 5 #include "modules/bluetooth/BluetoothDevice.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 BluetoothRemoteGATTCharacteristic* 53 BluetoothRemoteGATTCharacteristic*
54 BluetoothDevice::getOrCreateBluetoothRemoteGATTCharacteristic( 54 BluetoothDevice::getOrCreateBluetoothRemoteGATTCharacteristic(
55 ExecutionContext* context, 55 ExecutionContext* context,
56 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic, 56 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit> webCharacteristic,
57 BluetoothRemoteGATTService* service) { 57 BluetoothRemoteGATTService* service) {
58 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTCharacteristic( 58 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTCharacteristic(
59 context, std::move(webCharacteristic), service); 59 context, std::move(webCharacteristic), service);
60 } 60 }
61 61
62 bool BluetoothDevice::isValidCharacteristic(
63 const String& characteristicInstanceId) {
64 return m_attributeInstanceMap->containsCharacteristic(
65 characteristicInstanceId);
66 }
67
62 void BluetoothDevice::dispose() { 68 void BluetoothDevice::dispose() {
63 disconnectGATTIfConnected(); 69 disconnectGATTIfConnected();
64 } 70 }
65 71
66 void BluetoothDevice::contextDestroyed() { 72 void BluetoothDevice::contextDestroyed() {
67 disconnectGATTIfConnected(); 73 disconnectGATTIfConnected();
68 } 74 }
69 75
70 void BluetoothDevice::disconnectGATTIfConnected() { 76 void BluetoothDevice::disconnectGATTIfConnected() {
71 if (m_gatt->connected()) { 77 if (m_gatt->connected()) {
(...skipping 28 matching lines...) Expand all
100 } 106 }
101 107
102 DEFINE_TRACE(BluetoothDevice) { 108 DEFINE_TRACE(BluetoothDevice) {
103 EventTargetWithInlineData::trace(visitor); 109 EventTargetWithInlineData::trace(visitor);
104 ContextLifecycleObserver::trace(visitor); 110 ContextLifecycleObserver::trace(visitor);
105 visitor->trace(m_attributeInstanceMap); 111 visitor->trace(m_attributeInstanceMap);
106 visitor->trace(m_gatt); 112 visitor->trace(m_gatt);
107 } 113 }
108 114
109 } // namespace blink 115 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698