| Index: content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| diff --git a/content/browser/bluetooth/frame_connected_bluetooth_devices.cc b/content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| index d469a50f0e21b21d3ad3b963c5ebdad13b2a93bd..aa75a1e6506def632bd08cd2d0b01f31e1e89df4 100644
|
| --- a/content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| +++ b/content/browser/bluetooth/frame_connected_bluetooth_devices.cc
|
| @@ -29,13 +29,14 @@ bool FrameConnectedBluetoothDevices::IsConnectedToDeviceWithId(
|
| if (connection_iter == device_id_to_connection_map_.end()) {
|
| return false;
|
| }
|
| - DCHECK(connection_iter->second->IsConnected());
|
| + DCHECK(connection_iter->second.first->IsConnected());
|
| return true;
|
| }
|
|
|
| void FrameConnectedBluetoothDevices::Insert(
|
| const WebBluetoothDeviceId& device_id,
|
| - std::unique_ptr<device::BluetoothGattConnection> connection) {
|
| + std::unique_ptr<device::BluetoothGattConnection> connection,
|
| + blink::mojom::WebBluetoothServerClientAssociatedPtr client) {
|
| if (device_id_to_connection_map_.find(device_id) !=
|
| device_id_to_connection_map_.end()) {
|
| // It's possible for WebBluetoothServiceImpl to issue two successive
|
| @@ -50,7 +51,8 @@ void FrameConnectedBluetoothDevices::Insert(
|
| return;
|
| }
|
| device_address_to_id_map_[connection->GetDeviceAddress()] = device_id;
|
| - device_id_to_connection_map_[device_id] = std::move(connection);
|
| + device_id_to_connection_map_[device_id] =
|
| + std::make_pair(std::move(connection), std::move(client));
|
| IncrementDevicesConnectedCount();
|
| }
|
|
|
| @@ -61,7 +63,7 @@ void FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithId(
|
| return;
|
| }
|
| CHECK(device_address_to_id_map_.erase(
|
| - connection_iter->second->GetDeviceAddress()));
|
| + connection_iter->second.first->GetDeviceAddress()));
|
| device_id_to_connection_map_.erase(connection_iter);
|
| DecrementDevicesConnectedCount();
|
| }
|
| @@ -74,8 +76,11 @@ FrameConnectedBluetoothDevices::CloseConnectionToDeviceWithAddress(
|
| return base::nullopt;
|
| }
|
| WebBluetoothDeviceId device_id = device_address_iter->second;
|
| + auto device_id_iter = device_id_to_connection_map_.find(device_id);
|
| + CHECK(device_id_iter != device_id_to_connection_map_.end());
|
| + device_id_iter->second.second->GATTServerDisconnected();
|
| CHECK(device_address_to_id_map_.erase(device_address));
|
| - CHECK(device_id_to_connection_map_.erase(device_id));
|
| + device_id_to_connection_map_.erase(device_id);
|
| DecrementDevicesConnectedCount();
|
| return base::make_optional(device_id);
|
| }
|
|
|