| Index: content/browser/bluetooth/bluetooth_metrics.cc
|
| diff --git a/content/browser/bluetooth/bluetooth_metrics.cc b/content/browser/bluetooth/bluetooth_metrics.cc
|
| index e9a34c82ad9e2912e0e44609ed87a224e4116337..fb9e60023fa92a35487304a3805e06cc7157b84f 100644
|
| --- a/content/browser/bluetooth/bluetooth_metrics.cc
|
| +++ b/content/browser/bluetooth/bluetooth_metrics.cc
|
| @@ -103,6 +103,11 @@ void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) {
|
| static_cast<int>(UMAConnectGATTOutcome::COUNT));
|
| }
|
|
|
| +void RecordConnectGATTOutcome(CacheQueryOutcome outcome) {
|
| + DCHECK(outcome == CacheQueryOutcome::NO_DEVICE);
|
| + RecordConnectGATTOutcome(UMAConnectGATTOutcome::NO_DEVICE);
|
| +}
|
| +
|
| void RecordConnectGATTTimeSuccess(const base::TimeDelta& duration) {
|
| UMA_HISTOGRAM_MEDIUM_TIMES("Bluetooth.Web.ConnectGATT.TimeSuccess", duration);
|
| }
|
| @@ -126,6 +131,11 @@ void RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome outcome) {
|
| static_cast<int>(UMAGetPrimaryServiceOutcome::COUNT));
|
| }
|
|
|
| +void RecordGetPrimaryServiceOutcome(CacheQueryOutcome outcome) {
|
| + DCHECK(outcome == CacheQueryOutcome::NO_DEVICE);
|
| + RecordGetPrimaryServiceOutcome(UMAGetPrimaryServiceOutcome::NO_DEVICE);
|
| +}
|
| +
|
| // getCharacteristic
|
|
|
| void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome) {
|
| @@ -134,6 +144,24 @@ void RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome outcome) {
|
| static_cast<int>(UMAGetCharacteristicOutcome::COUNT));
|
| }
|
|
|
| +void RecordGetCharacteristicOutcome(CacheQueryOutcome outcome) {
|
| + switch (outcome) {
|
| + case CacheQueryOutcome::SUCCESS:
|
| + case CacheQueryOutcome::BAD_RENDERER:
|
| + NOTIMPLEMENTED() << "No need to record a success or renderer crash";
|
| + return;
|
| + case CacheQueryOutcome::NO_DEVICE:
|
| + RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_DEVICE);
|
| + return;
|
| + case CacheQueryOutcome::NO_SERVICE:
|
| + RecordGetCharacteristicOutcome(UMAGetCharacteristicOutcome::NO_SERVICE);
|
| + return;
|
| + case CacheQueryOutcome::NO_CHARACTERISTIC:
|
| + NOTIMPLEMENTED();
|
| + return;
|
| + }
|
| +}
|
| +
|
| void RecordGetCharacteristicCharacteristic(const std::string& characteristic) {
|
| UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic",
|
| HashUUID(characteristic));
|
| @@ -160,6 +188,22 @@ void RecordGATTOperationOutcome(UMAGATTOperation operation,
|
| NOTREACHED();
|
| }
|
|
|
| +static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
|
| + CacheQueryOutcome outcome) {
|
| + switch (outcome) {
|
| + case CacheQueryOutcome::SUCCESS:
|
| + case CacheQueryOutcome::BAD_RENDERER:
|
| + NOTIMPLEMENTED() << "No need to record success or renderer crash";
|
| + return UMAGATTOperationOutcome::NOT_SUPPORTED;
|
| + case CacheQueryOutcome::NO_DEVICE:
|
| + return UMAGATTOperationOutcome::NO_DEVICE;
|
| + case CacheQueryOutcome::NO_SERVICE:
|
| + return UMAGATTOperationOutcome::NO_SERVICE;
|
| + case CacheQueryOutcome::NO_CHARACTERISTIC:
|
| + return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
|
| + }
|
| +}
|
| +
|
| // Characteristic.readValue
|
|
|
| // static
|
| @@ -169,6 +213,11 @@ void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) {
|
| static_cast<int>(UMAGATTOperationOutcome::COUNT));
|
| }
|
|
|
| +void RecordCharacteristicReadValueOutcome(CacheQueryOutcome outcome) {
|
| + RecordCharacteristicReadValueOutcome(
|
| + TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
|
| +}
|
| +
|
| // Characteristic.writeValue
|
|
|
| void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome outcome) {
|
| @@ -177,6 +226,11 @@ void RecordCharacteristicWriteValueOutcome(UMAGATTOperationOutcome outcome) {
|
| static_cast<int>(UMAGATTOperationOutcome::COUNT));
|
| }
|
|
|
| +void RecordCharacteristicWriteValueOutcome(CacheQueryOutcome outcome) {
|
| + RecordCharacteristicWriteValueOutcome(
|
| + TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
|
| +}
|
| +
|
| // Characteristic.startNotifications
|
| void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome) {
|
| UMA_HISTOGRAM_ENUMERATION(
|
| @@ -185,4 +239,9 @@ void RecordStartNotificationsOutcome(UMAGATTOperationOutcome outcome) {
|
| static_cast<int>(UMAGATTOperationOutcome::COUNT));
|
| }
|
|
|
| +void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) {
|
| + RecordStartNotificationsOutcome(
|
| + TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
|
| +}
|
| +
|
| } // namespace content
|
|
|