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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothAttributeInstanceMap.h

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Rebase Created 4 years 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 #ifndef BluetoothAttributeInstanceMap_h 5 #ifndef BluetoothAttributeInstanceMap_h
6 #define BluetoothAttributeInstanceMap_h 6 #define BluetoothAttributeInstanceMap_h
7 7
8 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h" 8 #include "modules/bluetooth/BluetoothRemoteGATTCharacteristic.h"
9 #include "modules/bluetooth/BluetoothRemoteGATTDescriptor.h"
9 #include "modules/bluetooth/BluetoothRemoteGATTService.h" 10 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
10 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
11 #include "platform/heap/Heap.h" 12 #include "platform/heap/Heap.h"
12 #include <memory> 13 #include <memory>
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class BluetoothDevice; 17 class BluetoothDevice;
17 class ExecutionContext; 18 class ExecutionContext;
18 class ScriptPromiseResolver; 19 class ScriptPromiseResolver;
(...skipping 28 matching lines...) Expand all
47 BluetoothRemoteGATTCharacteristic* 48 BluetoothRemoteGATTCharacteristic*
48 getOrCreateBluetoothRemoteGATTCharacteristic( 49 getOrCreateBluetoothRemoteGATTCharacteristic(
49 ExecutionContext*, 50 ExecutionContext*,
50 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>, 51 std::unique_ptr<WebBluetoothRemoteGATTCharacteristicInit>,
51 BluetoothRemoteGATTService*); 52 BluetoothRemoteGATTService*);
52 53
53 // Returns true if a BluetoothRemoteGATTCharacteristic with 54 // Returns true if a BluetoothRemoteGATTCharacteristic with
54 // |characteristicInstanceId| is in the map. 55 // |characteristicInstanceId| is in the map.
55 bool containsCharacteristic(const String& characteristicInstanceId); 56 bool containsCharacteristic(const String& characteristicInstanceId);
56 57
58 // Constructs a new BluetoothRemoteGATTDescriptor object if there was no
59 // descriptor with the same instance id and adds it to the map.
60 // Otherwise returns the BluetoothRemoteGATTDescriptor object already in
61 // the map.
62 BluetoothRemoteGATTDescriptor* getOrCreateBluetoothRemoteGATTDescriptor(
ortuno 2016/12/02 06:14:50 Nice!
63 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit>,
64 BluetoothRemoteGATTCharacteristic*);
65
66 // Returns true if a BluetoothRemoteGATTDescriptor with
67 // |descriptorInstanceId| is in the map.
68 bool containsDescriptor(const String& descriptorInstanceId);
69
57 // Removes all Attributes from the map. 70 // Removes all Attributes from the map.
58 // TODO(crbug.com/654950): Remove descriptors when implemented. 71 // TODO(crbug.com/654950): Remove descriptors when implemented.
59 void Clear(); 72 void Clear();
60 73
61 DECLARE_VIRTUAL_TRACE(); 74 DECLARE_VIRTUAL_TRACE();
62 75
63 private: 76 private:
64 // BluetoothDevice that owns this map. 77 // BluetoothDevice that owns this map.
65 Member<BluetoothDevice> m_device; 78 Member<BluetoothDevice> m_device;
66 // Map of service instance ids to objects. 79 // Map of service instance ids to objects.
67 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject; 80 HeapHashMap<String, Member<BluetoothRemoteGATTService>> m_serviceIdToObject;
68 // Map of characteristic instance ids to objects. 81 // Map of characteristic instance ids to objects.
69 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>> 82 HeapHashMap<String, Member<BluetoothRemoteGATTCharacteristic>>
70 m_characteristicIdToObject; 83 m_characteristicIdToObject;
84 // Map of descriptor instance ids to objects.
85 HeapHashMap<String, Member<BluetoothRemoteGATTDescriptor>>
86 m_descriptorIdToObject;
71 }; 87 };
72 88
73 } // namespace blink 89 } // namespace blink
74 90
75 #endif // BluetoothAttributeInstanceMap_h 91 #endif // BluetoothAttributeInstanceMap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698