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

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

Issue 1271043002: bluetooth: Add histograms and logging for getPrimaryService() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uma-connecta-gatt
Patch Set: Merge Created 5 years, 4 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
index b4fea1a9a0bcff6a6afa6088f7069dc6469e028f..d85dbd1cce04d6eb748b9aa9e4270c2833aab1b6 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -117,6 +117,27 @@ void RecordUnionOfServices(
union_of_services.size());
}
+enum class UMAGetPrimaryServiceOutcome {
+ SUCCESS,
+ NO_DEVICE,
+ NOT_FOUND,
+ // Note: Add new GetPrimaryService outcomes immediately above this line. Make
+ // sure to update the enum list in tools/metrics/histograms/histograms.xml
+ // accordingly.
+ COUNT
+};
+
+void RecordGetPrimaryServiceService(const BluetoothUUID& service) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetPrimaryService.Services",
+ HashUUID(service.canonical_value()));
+}
+
+void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Bluetooth.Web.GetPrimaryService.Outcome", static_cast<int>(outcome),
+ static_cast<int>(UMAGetPrimaryServiceOutcome::COUNT));
+}
+
enum class UMAConnectGATTOutcome {
SUCCESS,
NO_DEVICE,
@@ -481,6 +502,7 @@ void BluetoothDispatcherHost::OnGetPrimaryService(
const std::string& service_uuid) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::GET_PRIMARY_SERVICE);
+ RecordGetPrimaryServiceService(BluetoothUUID(service_uuid));
// TODO(ortuno): Check if device_instance_id is in "allowed devices"
// https://crbug.com/493459
@@ -804,6 +826,8 @@ void BluetoothDispatcherHost::OnServicesDiscovered(
device::BluetoothDevice* device = adapter_->GetDevice(device_instance_id);
if (device == nullptr) { // See "NETWORK_ERROR Note" above.
+ RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NO_DEVICE);
+ VLOG(1) << "Bluetooth Device is no longer in range.";
Send(new BluetoothMsg_GetPrimaryServiceError(
thread_id, request_id, WebBluetoothError::DeviceNoLongerInRange));
return;
@@ -820,11 +844,14 @@ void BluetoothDispatcherHost::OnServicesDiscovered(
if (!insert_result.second)
DCHECK(insert_result.first->second == device_instance_id);
+ RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::SUCCESS);
Send(new BluetoothMsg_GetPrimaryServiceSuccess(thread_id, request_id,
service_identifier));
return;
}
}
+ RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NOT_FOUND);
+ VLOG(1) << "No GATT services with UUID: " << service_uuid;
Send(new BluetoothMsg_GetPrimaryServiceError(
thread_id, request_id, WebBluetoothError::ServiceNotFound));
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698