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

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

Issue 2693433002: Migrate WTF::HashMap::add() to ::insert() [final] (Closed)
Patch Set: more platform-specific references 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 service()->RequestDevice( 224 service()->RequestDevice(
225 std::move(deviceOptions), 225 std::move(deviceOptions),
226 convertToBaseCallback(WTF::bind(&Bluetooth::RequestDeviceCallback, 226 convertToBaseCallback(WTF::bind(&Bluetooth::RequestDeviceCallback,
227 wrapPersistent(this), 227 wrapPersistent(this),
228 wrapPersistent(resolver)))); 228 wrapPersistent(resolver))));
229 return promise; 229 return promise;
230 } 230 }
231 231
232 void Bluetooth::addToConnectedDevicesMap(const String& deviceId, 232 void Bluetooth::addToConnectedDevicesMap(const String& deviceId,
233 BluetoothDevice* device) { 233 BluetoothDevice* device) {
234 m_connectedDevices.add(deviceId, device); 234 m_connectedDevices.insert(deviceId, device);
235 } 235 }
236 236
237 void Bluetooth::removeFromConnectedDevicesMap(const String& deviceId) { 237 void Bluetooth::removeFromConnectedDevicesMap(const String& deviceId) {
238 m_connectedDevices.remove(deviceId); 238 m_connectedDevices.remove(deviceId);
239 } 239 }
240 240
241 void Bluetooth::registerCharacteristicObject( 241 void Bluetooth::registerCharacteristicObject(
242 const String& characteristicInstanceId, 242 const String& characteristicInstanceId,
243 BluetoothRemoteGATTCharacteristic* characteristic) { 243 BluetoothRemoteGATTCharacteristic* characteristic) {
244 m_activeCharacteristics.add(characteristicInstanceId, characteristic); 244 m_activeCharacteristics.insert(characteristicInstanceId, characteristic);
245 } 245 }
246 246
247 void Bluetooth::characteristicObjectRemoved( 247 void Bluetooth::characteristicObjectRemoved(
248 const String& characteristicInstanceId) { 248 const String& characteristicInstanceId) {
249 m_activeCharacteristics.remove(characteristicInstanceId); 249 m_activeCharacteristics.remove(characteristicInstanceId);
250 } 250 }
251 251
252 DEFINE_TRACE(Bluetooth) { 252 DEFINE_TRACE(Bluetooth) {
253 visitor->trace(m_deviceInstanceMap); 253 visitor->trace(m_deviceInstanceMap);
254 visitor->trace(m_activeCharacteristics); 254 visitor->trace(m_activeCharacteristics);
(...skipping 22 matching lines...) Expand all
277 } 277 }
278 } 278 }
279 279
280 BluetoothDevice* Bluetooth::getBluetoothDeviceRepresentingDevice( 280 BluetoothDevice* Bluetooth::getBluetoothDeviceRepresentingDevice(
281 mojom::blink::WebBluetoothDevicePtr devicePtr, 281 mojom::blink::WebBluetoothDevicePtr devicePtr,
282 ScriptPromiseResolver* resolver) { 282 ScriptPromiseResolver* resolver) {
283 WTF::String id = devicePtr->id; 283 WTF::String id = devicePtr->id;
284 BluetoothDevice* device = m_deviceInstanceMap.get(id); 284 BluetoothDevice* device = m_deviceInstanceMap.get(id);
285 if (!device) { 285 if (!device) {
286 device = BluetoothDevice::take(resolver, std::move(devicePtr), this); 286 device = BluetoothDevice::take(resolver, std::move(devicePtr), this);
287 auto result = m_deviceInstanceMap.add(id, device); 287 auto result = m_deviceInstanceMap.insert(id, device);
288 DCHECK(result.isNewEntry); 288 DCHECK(result.isNewEntry);
289 } 289 }
290 return device; 290 return device;
291 } 291 }
292 292
293 } // namespace blink 293 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/modules/nfc/NFC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698