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

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

Issue 1248573002: Add a histogram to record requestDevice outcomes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumb-render-frame-host2
Patch Set: Rename to Bluetooth.RequestDevice.Outcome and fix a spelling error. Created 5 years, 5 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 386ede0af36116bdbe0781c4380d9a49a981bc5e..86fdf9f366be1a843106f7a032b3e43b575b2f00 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -42,6 +42,24 @@ enum class BluetoothGATTError {
MAX_ERROR,
};
+enum class UMARequestDeviceOutcome {
+ SUCCESS = 0,
+ NO_BLUETOOTH_ADAPTER = 1,
+ NO_RENDER_FRAME = 2,
+ DISCOVERY_START_FAILED = 3,
+ DISCOVERY_STOP_FAILED = 4,
+ NO_MATCHING_DEVICES_FOUND = 5,
+ // NOTE: Add new requestDevice() outcomes immediately above this line. Make
+ // sure to update the enum list in tools/histogram/histograms.xml accordingly.
+ COUNT
+};
+
+void RecordRequestDeviceOutcome(UMARequestDeviceOutcome outcome) {
+ UMA_HISTOGRAM_ENUMERATION("Bluetooth.RequestDevice.Outcome",
+ static_cast<int>(outcome),
+ static_cast<int>(UMARequestDeviceOutcome::COUNT));
+}
+
// TODO(ortuno): Once we have a chooser for scanning and the right
// callback for discovered services we should delete these constants.
// https://crbug.com/436280 and https://crbug.com/484504
@@ -239,6 +257,7 @@ void BluetoothDispatcherHost::OnRequestDevice(
DLOG(WARNING)
<< "Got a requestDevice IPC without a matching RenderFrameHost: "
<< render_process_id_ << ", " << frame_routing_id;
+ RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_RENDER_FRAME);
Send(new BluetoothMsg_RequestDeviceError(
thread_id, request_id, WebBluetoothError::RequestDeviceWithoutFrame));
}
@@ -265,6 +284,7 @@ void BluetoothDispatcherHost::OnRequestDevice(
weak_ptr_factory_.GetWeakPtr(), thread_id, request_id));
} else {
DLOG(WARNING) << "No BluetoothAdapter. Can't serve requestDevice.";
+ RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER);
Send(new BluetoothMsg_RequestDeviceError(
thread_id, request_id, WebBluetoothError::NoBluetoothAdapter));
}
@@ -512,6 +532,7 @@ void BluetoothDispatcherHost::OnDiscoverySessionStartedError(int thread_id,
int request_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DLOG(WARNING) << "BluetoothDispatcherHost::OnDiscoverySessionStartedError";
+ RecordRequestDeviceOutcome(UMARequestDeviceOutcome::DISCOVERY_START_FAILED);
Send(new BluetoothMsg_RequestDeviceError(
thread_id, request_id, WebBluetoothError::DiscoverySessionStartFailed));
request_device_sessions_.erase(std::make_pair(thread_id, request_id));
@@ -549,12 +570,15 @@ void BluetoothDispatcherHost::OnDiscoverySessionStopped(int thread_id,
device->IsPaired(), // paired
content::BluetoothDevice::UUIDsFromBluetoothUUIDs(
device->GetUUIDs())); // uuids
+ RecordRequestDeviceOutcome(UMARequestDeviceOutcome::SUCCESS);
Send(new BluetoothMsg_RequestDeviceSuccess(thread_id, request_id,
device_ipc));
request_device_sessions_.erase(session);
return;
}
}
+ RecordRequestDeviceOutcome(
+ UMARequestDeviceOutcome::NO_MATCHING_DEVICES_FOUND);
Send(new BluetoothMsg_RequestDeviceError(thread_id, request_id,
WebBluetoothError::NoDevicesFound));
request_device_sessions_.erase(session);
@@ -564,6 +588,7 @@ void BluetoothDispatcherHost::OnDiscoverySessionStoppedError(int thread_id,
int request_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DLOG(WARNING) << "BluetoothDispatcherHost::OnDiscoverySessionStoppedError";
+ RecordRequestDeviceOutcome(UMARequestDeviceOutcome::DISCOVERY_STOP_FAILED);
Send(new BluetoothMsg_RequestDeviceError(
thread_id, request_id, WebBluetoothError::DiscoverySessionStopFailed));
request_device_sessions_.erase(std::make_pair(thread_id, request_id));
« 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