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

Unified Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

Issue 2752663002: Remove RemoteServerDisconnect() from web_bluetooth.mojom (Closed)
Patch Set: address ortuno@'s comments 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/web_bluetooth_service_impl.cc
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.cc b/content/browser/bluetooth/web_bluetooth_service_impl.cc
index 9c6b89958aba9da4647a53297600c6036a12b4f1..7249d52b9feabda9759254f198ea41a2086ef837 100644
--- a/content/browser/bluetooth/web_bluetooth_service_impl.cc
+++ b/content/browser/bluetooth/web_bluetooth_service_impl.cc
@@ -355,18 +355,6 @@ void WebBluetoothServiceImpl::RemoteServerConnect(
weak_ptr_factory_.GetWeakPtr(), start_time, callback));
}
-void WebBluetoothServiceImpl::RemoteServerDisconnect(
- const WebBluetoothDeviceId& device_id) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- RecordWebBluetoothFunctionCall(
- UMAWebBluetoothFunction::REMOTE_GATT_SERVER_DISCONNECT);
-
- if (connected_devices_->IsConnectedToDeviceWithId(device_id)) {
- DVLOG(1) << "Disconnecting device: " << device_id.str();
- connected_devices_->CloseConnectionToDeviceWithId(device_id);
- }
-}
-
void WebBluetoothServiceImpl::RemoteServerGetPrimaryServices(
const WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
@@ -847,6 +835,20 @@ void WebBluetoothServiceImpl::RequestDeviceImpl(
weak_ptr_factory_.GetWeakPtr(), callback));
}
+void WebBluetoothServiceImpl::OnGATTServerClientDisconnection(
+ const WebBluetoothDeviceId& device_id) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ RecordWebBluetoothFunctionCall(
scheib 2017/03/30 22:45:51 Please address the UMA patch, and make this change
+ UMAWebBluetoothFunction::REMOTE_GATT_SERVER_DISCONNECT);
+
+ // If a GATT connection exists for device identified by |device_id| then
+ // decreases the ref count for that connection.
+ if (connected_devices_->IsConnectedToDeviceWithId(device_id)) {
+ DVLOG(1) << "Disconnecting device: " << device_id.str();
+ connected_devices_->CloseConnectionToDeviceWithId(device_id);
+ }
+}
+
void WebBluetoothServiceImpl::RemoteServerGetPrimaryServicesImpl(
const WebBluetoothDeviceId& device_id,
blink::mojom::WebBluetoothGATTQueryQuantity quantity,
@@ -959,6 +961,9 @@ void WebBluetoothServiceImpl::OnCreateGATTConnectionSuccess(
return;
}
+ client.set_connection_error_handler(
+ base::Bind(&WebBluetoothServiceImpl::OnGATTServerClientDisconnection,
+ weak_ptr_factory_.GetWeakPtr(), device_id));
callback.Run(blink::mojom::WebBluetoothResult::SUCCESS);
connected_devices_->Insert(device_id, std::move(connection),
std::move(client));
« no previous file with comments | « content/browser/bluetooth/web_bluetooth_service_impl.h ('k') | third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698