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

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

Issue 2650003005: Mark Bluetooth devices connected after they are actually connected (Closed)
Patch Set: mark Bluetooth devices connected after they are actually connected 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
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/Bluetooth.h" 5 #include "modules/bluetooth/Bluetooth.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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ScriptPromise promise = resolver->promise(); 233 ScriptPromise promise = resolver->promise();
234 234
235 service()->RequestDevice( 235 service()->RequestDevice(
236 std::move(deviceOptions), 236 std::move(deviceOptions),
237 convertToBaseCallback(WTF::bind(&Bluetooth::RequestDeviceCallback, 237 convertToBaseCallback(WTF::bind(&Bluetooth::RequestDeviceCallback,
238 wrapPersistent(this), 238 wrapPersistent(this),
239 wrapPersistent(resolver)))); 239 wrapPersistent(resolver))));
240 return promise; 240 return promise;
241 } 241 }
242 242
243 void Bluetooth::addDevice(const String& deviceId, BluetoothDevice* device) { 243 void Bluetooth::addToConnectedDevicesMap(const String& deviceId,
244 BluetoothDevice* device) {
244 m_connectedDevices.add(deviceId, device); 245 m_connectedDevices.add(deviceId, device);
245 } 246 }
246 247
247 void Bluetooth::removeDevice(const String& deviceId) { 248 void Bluetooth::removeFromConnectedDevicesMap(const String& deviceId) {
248 m_connectedDevices.remove(deviceId); 249 m_connectedDevices.remove(deviceId);
249 } 250 }
250 251
251 void Bluetooth::registerCharacteristicObject( 252 void Bluetooth::registerCharacteristicObject(
252 const String& characteristicInstanceId, 253 const String& characteristicInstanceId,
253 BluetoothRemoteGATTCharacteristic* characteristic) { 254 BluetoothRemoteGATTCharacteristic* characteristic) {
254 m_activeCharacteristics.add(characteristicInstanceId, characteristic); 255 m_activeCharacteristics.add(characteristicInstanceId, characteristic);
255 } 256 }
256 257
257 void Bluetooth::characteristicObjectRemoved( 258 void Bluetooth::characteristicObjectRemoved(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 BluetoothDevice* device = m_deviceInstanceMap.get(id); 295 BluetoothDevice* device = m_deviceInstanceMap.get(id);
295 if (!device) { 296 if (!device) {
296 device = BluetoothDevice::take(resolver, std::move(devicePtr), this); 297 device = BluetoothDevice::take(resolver, std::move(devicePtr), this);
297 auto result = m_deviceInstanceMap.add(id, device); 298 auto result = m_deviceInstanceMap.add(id, device);
298 DCHECK(result.isNewEntry); 299 DCHECK(result.isNewEntry);
299 } 300 }
300 return device; 301 return device;
301 } 302 }
302 303
303 } // namespace blink 304 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698