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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/BluetoothAttributeInstanceMap.h" 5 #include "modules/bluetooth/BluetoothAttributeInstanceMap.h"
6 6
7 #include "modules/bluetooth/BluetoothDevice.h" 7 #include "modules/bluetooth/BluetoothDevice.h"
8 #include "modules/bluetooth/BluetoothRemoteGATTService.h" 8 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
9 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic Init.h" 9 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTCharacteristic Init.h"
10 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h" 10 #include "public/platform/modules/bluetooth/WebBluetoothRemoteGATTService.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 if (!characteristic) { 52 if (!characteristic) {
53 characteristic = BluetoothRemoteGATTCharacteristic::create( 53 characteristic = BluetoothRemoteGATTCharacteristic::create(
54 context, std::move(webCharacteristic), service); 54 context, std::move(webCharacteristic), service);
55 m_characteristicIdToObject.add(characteristicInstanceId, characteristic); 55 m_characteristicIdToObject.add(characteristicInstanceId, characteristic);
56 } 56 }
57 57
58 return characteristic; 58 return characteristic;
59 } 59 }
60 60
61 bool BluetoothAttributeInstanceMap::containsCharacteristic(
62 const String& characteristicInstanceId) {
63 return m_characteristicIdToObject.contains(characteristicInstanceId);
64 }
65
61 void BluetoothAttributeInstanceMap::Clear() { 66 void BluetoothAttributeInstanceMap::Clear() {
62 m_serviceIdToObject.clear(); 67 m_serviceIdToObject.clear();
68 m_characteristicIdToObject.clear();
63 } 69 }
64 70
65 DEFINE_TRACE(BluetoothAttributeInstanceMap) { 71 DEFINE_TRACE(BluetoothAttributeInstanceMap) {
66 visitor->trace(m_device); 72 visitor->trace(m_device);
67 visitor->trace(m_serviceIdToObject); 73 visitor->trace(m_serviceIdToObject);
68 visitor->trace(m_characteristicIdToObject); 74 visitor->trace(m_characteristicIdToObject);
69 } 75 }
70 76
71 } // namespace blink 77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698