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

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

Issue 1286883002: bluetooth: Add histograms and logging for getCharacteristic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uma-refactoring
Patch Set: Merge with ToT 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
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 6cad374ff57675ece2d3c8c0eabaa7148a11f094..9d72b2e0af60258a990d80c3c0d7a4e1ca86278a 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -37,6 +37,8 @@ using UMARequestDeviceOutcome =
using UMAConnectGATTOutcome = content::BluetoothMetrics::UMAConnectGATTOutcome;
using UMAGetPrimaryServiceOutcome =
content::BluetoothMetrics::UMAGetPrimaryServiceOutcome;
+using UMAGetCharacteristicOutcome =
+ content::BluetoothMetrics::UMAGetCharacteristicOutcome;
using UMAGATTError = content::BluetoothMetrics::UMAGATTError;
namespace {
@@ -388,6 +390,7 @@ void BluetoothDispatcherHost::OnGetCharacteristic(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
BluetoothMetrics::RecordWebBluetoothFunctionCall(
UMAWebBluetoothFunction::GET_CHARACTERISTIC);
+ BluetoothMetrics::RecordGetCharacteristicCharacteristic(characteristic_uuid);
auto device_iter = service_to_device_.find(service_instance_id);
// A service_instance_id not in the map implies a hostile renderer
@@ -405,6 +408,9 @@ void BluetoothDispatcherHost::OnGetCharacteristic(
adapter_->GetDevice(device_iter->second /* device_instance_id */);
if (device == nullptr) { // See "NETWORK_ERROR Note" above.
+ BluetoothMetrics::RecordGetCharacteristicOutcome(
+ UMAGetCharacteristicOutcome::NO_DEVICE);
+ VLOG(1) << "Bluetooth Device is no longer in range.";
Jeffrey Yasskin 2015/08/13 21:32:53 As discussed over IM, we should drop the VLOGs wit
ortuno 2015/08/14 16:23:35 Done.
Send(new BluetoothMsg_GetCharacteristicError(
thread_id, request_id, WebBluetoothError::DeviceNoLongerInRange));
return;
@@ -415,6 +421,9 @@ void BluetoothDispatcherHost::OnGetCharacteristic(
device::BluetoothGattService* service =
device->GetGattService(service_instance_id);
if (!service) {
+ BluetoothMetrics::RecordGetCharacteristicOutcome(
+ UMAGetCharacteristicOutcome::NO_SERVICE);
+ VLOG(1) << "GATT Service no longer exists.";
Send(new BluetoothMsg_GetCharacteristicError(
thread_id, request_id, WebBluetoothError::ServiceNoLongerExists));
return;
@@ -433,6 +442,8 @@ void BluetoothDispatcherHost::OnGetCharacteristic(
if (!insert_result.second)
DCHECK(insert_result.first->second == service_instance_id);
+ BluetoothMetrics::RecordGetCharacteristicOutcome(
+ UMAGetCharacteristicOutcome::SUCCESS);
// TODO(ortuno): Use generated instance ID instead.
// https://crbug.com/495379
Send(new BluetoothMsg_GetCharacteristicSuccess(
@@ -440,6 +451,9 @@ void BluetoothDispatcherHost::OnGetCharacteristic(
return;
}
}
+ BluetoothMetrics::RecordGetCharacteristicOutcome(
+ UMAGetCharacteristicOutcome::NOT_FOUND);
+ VLOG(1) << "No GATT Characteristic with UUID: " << characteristic_uuid;
Jeffrey Yasskin 2015/08/13 21:32:52 This one's probably also equivalent to its rejecti
ortuno 2015/08/14 16:23:35 Removed.
Send(new BluetoothMsg_GetCharacteristicError(
thread_id, request_id, WebBluetoothError::CharacteristicNotFound));
}
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_metrics.h » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698