| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/bluetooth/bluetooth_metrics.h" | 5 #include "content/browser/bluetooth/bluetooth_metrics.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 NOTREACHED(); | 162 NOTREACHED(); |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { | 167 void RecordGetCharacteristicCharacteristic(const std::string& characteristic) { |
| 168 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", | 168 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristic.Characteristic", |
| 169 HashUUID(characteristic)); | 169 HashUUID(characteristic)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 // getCharacteristics |
| 173 |
| 174 void RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome outcome) { |
| 175 UMA_HISTOGRAM_ENUMERATION( |
| 176 "Bluetooth.Web.GetCharacteristics.Outcome", static_cast<int>(outcome), |
| 177 static_cast<int>(UMAGetCharacteristicOutcome::COUNT)); |
| 178 } |
| 179 |
| 180 void RecordGetCharacteristicsOutcome(CacheQueryOutcome outcome) { |
| 181 switch (outcome) { |
| 182 case CacheQueryOutcome::SUCCESS: |
| 183 case CacheQueryOutcome::BAD_RENDERER: |
| 184 NOTREACHED() << "No need to record a success or renderer crash"; |
| 185 return; |
| 186 case CacheQueryOutcome::NO_DEVICE: |
| 187 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_DEVICE); |
| 188 return; |
| 189 case CacheQueryOutcome::NO_SERVICE: |
| 190 RecordGetCharacteristicsOutcome(UMAGetCharacteristicOutcome::NO_SERVICE); |
| 191 return; |
| 192 case CacheQueryOutcome::NO_CHARACTERISTIC: |
| 193 NOTREACHED(); |
| 194 return; |
| 195 } |
| 196 } |
| 197 |
| 198 void RecordGetCharacteristicsCharacteristic(const std::string& characteristic) { |
| 199 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetCharacteristics.Characteristic", |
| 200 HashUUID(characteristic)); |
| 201 } |
| 202 |
| 172 // GATT Operations | 203 // GATT Operations |
| 173 | 204 |
| 174 void RecordGATTOperationOutcome(UMAGATTOperation operation, | 205 void RecordGATTOperationOutcome(UMAGATTOperation operation, |
| 175 UMAGATTOperationOutcome outcome) { | 206 UMAGATTOperationOutcome outcome) { |
| 176 switch (operation) { | 207 switch (operation) { |
| 177 case UMAGATTOperation::CHARACTERISTIC_READ: | 208 case UMAGATTOperation::CHARACTERISTIC_READ: |
| 178 RecordCharacteristicReadValueOutcome(outcome); | 209 RecordCharacteristicReadValueOutcome(outcome); |
| 179 return; | 210 return; |
| 180 case UMAGATTOperation::CHARACTERISTIC_WRITE: | 211 case UMAGATTOperation::CHARACTERISTIC_WRITE: |
| 181 RecordCharacteristicWriteValueOutcome(outcome); | 212 RecordCharacteristicWriteValueOutcome(outcome); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 static_cast<int>(outcome), | 273 static_cast<int>(outcome), |
| 243 static_cast<int>(UMAGATTOperationOutcome::COUNT)); | 274 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
| 244 } | 275 } |
| 245 | 276 |
| 246 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { | 277 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { |
| 247 RecordStartNotificationsOutcome( | 278 RecordStartNotificationsOutcome( |
| 248 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); | 279 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); |
| 249 } | 280 } |
| 250 | 281 |
| 251 } // namespace content | 282 } // namespace content |
| OLD | NEW |