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

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

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 9 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 visitor->trace(m_activeCharacteristics); 254 visitor->trace(m_activeCharacteristics);
255 visitor->trace(m_connectedDevices); 255 visitor->trace(m_connectedDevices);
256 } 256 }
257 257
258 Bluetooth::Bluetooth() : m_clientBinding(this) {} 258 Bluetooth::Bluetooth() : m_clientBinding(this) {}
259 259
260 void Bluetooth::RemoteCharacteristicValueChanged( 260 void Bluetooth::RemoteCharacteristicValueChanged(
261 const WTF::String& characteristicInstanceId, 261 const WTF::String& characteristicInstanceId,
262 const WTF::Vector<uint8_t>& value) { 262 const WTF::Vector<uint8_t>& value) {
263 BluetoothRemoteGATTCharacteristic* characteristic = 263 BluetoothRemoteGATTCharacteristic* characteristic =
264 m_activeCharacteristics.get(characteristicInstanceId); 264 m_activeCharacteristics.at(characteristicInstanceId);
265 if (characteristic) 265 if (characteristic)
266 characteristic->dispatchCharacteristicValueChanged(value); 266 characteristic->dispatchCharacteristicValueChanged(value);
267 } 267 }
268 268
269 void Bluetooth::GattServerDisconnected(const WTF::String& deviceId) { 269 void Bluetooth::GattServerDisconnected(const WTF::String& deviceId) {
270 BluetoothDevice* device = m_connectedDevices.get(deviceId); 270 BluetoothDevice* device = m_connectedDevices.at(deviceId);
271 if (device) { 271 if (device) {
272 // Remove device from the map before calling dispatchGattServerDisconnected 272 // Remove device from the map before calling dispatchGattServerDisconnected
273 // to avoid removing a device the gattserverdisconnected event handler might 273 // to avoid removing a device the gattserverdisconnected event handler might
274 // have re-connected. 274 // have re-connected.
275 m_connectedDevices.remove(deviceId); 275 m_connectedDevices.remove(deviceId);
276 device->dispatchGattServerDisconnected(); 276 device->dispatchGattServerDisconnected();
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.at(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.insert(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

Powered by Google App Engine
This is Rietveld 408576698