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

Unified Diff: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp

Issue 2615093002: Typemap WebBluetoothDeviceId to WTF::String (Closed)
Patch Set: merge master Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
index ac700a466c6ca5967edc954a55ef91ee1332ba24..08e9cd96e9ed3ffca211fa7098934110e7b009c4 100644
--- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
@@ -160,8 +160,8 @@ void Bluetooth::RequestDeviceCallback(
return;
if (result == mojom::blink::WebBluetoothResult::SUCCESS) {
- BluetoothDevice* bluetoothDevice = getBluetoothDeviceRepresentingDevice(
- device->id->device_id, device->name, resolver);
+ BluetoothDevice* bluetoothDevice =
+ getBluetoothDeviceRepresentingDevice(std::move(device), resolver);
resolver->resolve(bluetoothDevice);
} else {
resolver->reject(BluetoothError::take(resolver, result));
@@ -275,25 +275,24 @@ void Bluetooth::RemoteCharacteristicValueChanged(
characteristic->dispatchCharacteristicValueChanged(value);
}
-void Bluetooth::GattServerDisconnected(
- mojom::blink::WebBluetoothDeviceIdPtr deviceId) {
- BluetoothDevice* device = m_connectedDevices.get(deviceId->device_id);
+void Bluetooth::GattServerDisconnected(const WTF::String& deviceId) {
+ BluetoothDevice* device = m_connectedDevices.get(deviceId);
if (device) {
// Remove device from the map before calling dispatchGattServerDisconnected
// to avoid removing a device the gattserverdisconnected event handler might
// have re-connected.
- m_connectedDevices.remove(deviceId->device_id);
+ m_connectedDevices.remove(deviceId);
device->dispatchGattServerDisconnected();
}
}
BluetoothDevice* Bluetooth::getBluetoothDeviceRepresentingDevice(
- const String& id,
- const String& name,
+ mojom::blink::WebBluetoothDevicePtr devicePtr,
ScriptPromiseResolver* resolver) {
+ WTF::String id = devicePtr->id;
BluetoothDevice* device = m_deviceInstanceMap.get(id);
if (!device) {
- device = BluetoothDevice::take(resolver, id, name, this);
+ device = BluetoothDevice::take(resolver, std::move(devicePtr), this);
auto result = m_deviceInstanceMap.add(id, device);
DCHECK(result.isNewEntry);
}

Powered by Google App Engine
This is Rietveld 408576698