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

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

Issue 1861013005: bluetooth: Move GetCharacteristic(s) over to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-read-value
Patch Set: Merge Created 4 years, 8 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_metrics.cc
diff --git a/content/browser/bluetooth/bluetooth_metrics.cc b/content/browser/bluetooth/bluetooth_metrics.cc
index 32f7c73dfa7015e6fda33fb643be6be3c95b19bc..02016ad70a12f5af0fff31570e421d2efd36d5e8 100644
--- a/content/browser/bluetooth/bluetooth_metrics.cc
+++ b/content/browser/bluetooth/bluetooth_metrics.cc
@@ -138,47 +138,23 @@ void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome) {
RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NO_DEVICE);
}
-// getCharacteristic
-
-void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome) {
- UMA_HISTOGRAM_ENUMERATION(
- "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome),
- static_cast<int>(UMAGetCharacteristicOutcome::COUNT));
-}
-
-void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome) {
- switch (outcome) {
- case CacheQueryOutcome::SUCCESS:
- case CacheQueryOutcome::BAD_RENDERER:
- // No need to record a success or renderer crash.
- NOTREACHED();
- return;
- case CacheQueryOutcome::NO_DEVICE:
- RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_DEVICE);
- return;
- case CacheQueryOutcome::NO_SERVICE:
- RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_SERVICE);
- return;
- case CacheQueryOutcome::NO_CHARACTERISTIC:
- NOTREACHED();
- return;
+// getCharacteristic & getCharacteristics
+
+void RecordGetCharacteristicsOutcome(bool single_characteristic,
+ UMAGetCharacteristicOutcome outcome) {
+ if (single_characteristic) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Bluetooth.Web.GetCharacteristic.Outcome", static_cast<int>(outcome),
+ static_cast<int>(UMAGetCharacteristicOutcome::COUNT));
+ } else {
+ UMA_HISTOGRAM_ENUMERATION(
+ "Bluetooth.Web.GetCharacteristics.Outcome", static_cast<int>(outcome),
+ static_cast<int>(UMAGetCharacteristicOutcome::COUNT));
}
}
-void RecordGetCharacteristicCharacteristic(const std::string& characteristic) {
- UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic",
- HashUUID(characteristic));
-}
-
-// getCharacteristics
-
-void RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome outcome) {
- UMA_HISTOGRAM_ENUMERATION(
- "Bluetooth.Web.GetCharacteristics.Outcome", static_cast<int>(outcome),
- static_cast<int>(UMAGetCharacteristicOutcome::COUNT));
-}
-
-void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome) {
+void RecordGetCharacteristicsOutcome(bool single_characteristic,
+ CacheQueryOutcome outcome) {
switch (outcome) {
case CacheQueryOutcome::SUCCESS:
case CacheQueryOutcome::BAD_RENDERER:
@@ -186,10 +162,12 @@ void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome) {
NOTREACHED();
return;
case CacheQueryOutcome::NO_DEVICE:
- RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_DEVICE);
+ RecordGetCharacteristicsOutcome(single_characteristic,
+ UMAGetCharacteristicOutcome::NO_DEVICE);
return;
case CacheQueryOutcome::NO_SERVICE:
- RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_SERVICE);
+ RecordGetCharacteristicsOutcome(single_characteristic,
+ UMAGetCharacteristicOutcome::NO_SERVICE);
return;
case CacheQueryOutcome::NO_CHARACTERISTIC:
NOTREACHED();
@@ -197,9 +175,17 @@ void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome) {
}
}
-void RecordGetCharacteristicsCharacteristic(const std::string& characteristic) {
- UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristics.Characteristic",
- HashUUID(characteristic));
+void RecordGetCharacteristicsCharacteristic(bool single_characteristic,
+ const std::string& characteristic) {
+ if (single_characteristic) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "Bluetooth.Web.GetCharacteristic.Characteristic",
+ HashUUID(characteristic));
+ } else {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "Bluetooth.Web.GetCharacteristics.Characteristic",
+ HashUUID(characteristic));
+ }
}
// GATT Operations

Powered by Google App Engine
This is Rietveld 408576698