| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 HashUUID(characteristic)); | 259 HashUUID(characteristic)); |
| 260 return; | 260 return; |
| 261 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: | 261 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: |
| 262 UMA_HISTOGRAM_SPARSE_SLOWLY( | 262 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 263 "Bluetooth.Web.GetCharacteristics.Characteristic", | 263 "Bluetooth.Web.GetCharacteristics.Characteristic", |
| 264 HashUUID(characteristic)); | 264 HashUUID(characteristic)); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 void RecordGetDescriptorsDescriptor( |
| 270 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 271 const base::Optional<BluetoothUUID>& descriptor) { |
| 272 switch (quantity) { |
| 273 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: |
| 274 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetDescriptor.Descriptor", |
| 275 HashUUID(descriptor)); |
| 276 return; |
| 277 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: |
| 278 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.GetDescriptors.Descriptor", |
| 279 HashUUID(descriptor)); |
| 280 return; |
| 281 } |
| 282 } |
| 283 |
| 284 void RecordGetDescriptorsOutcome( |
| 285 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 286 UMAGetDescriptorOutcome outcome) { |
| 287 switch (quantity) { |
| 288 case blink::mojom::WebBluetoothGATTQueryQuantity::SINGLE: |
| 289 UMA_HISTOGRAM_ENUMERATION( |
| 290 "Bluetooth.Web.GetDescriptor.Outcome", static_cast<int>(outcome), |
| 291 static_cast<int>(UMAGetDescriptorOutcome::COUNT)); |
| 292 return; |
| 293 case blink::mojom::WebBluetoothGATTQueryQuantity::MULTIPLE: |
| 294 UMA_HISTOGRAM_ENUMERATION( |
| 295 "Bluetooth.Web.GetDescriptors.Outcome", static_cast<int>(outcome), |
| 296 static_cast<int>(UMAGetDescriptorOutcome::COUNT)); |
| 297 return; |
| 298 } |
| 299 } |
| 300 |
| 301 void RecordGetDescriptorsOutcome( |
| 302 blink::mojom::WebBluetoothGATTQueryQuantity quantity, |
| 303 CacheQueryOutcome outcome) { |
| 304 switch (outcome) { |
| 305 case CacheQueryOutcome::SUCCESS: |
| 306 case CacheQueryOutcome::BAD_RENDERER: |
| 307 // No need to record a success or renderer crash. |
| 308 NOTREACHED(); |
| 309 return; |
| 310 case CacheQueryOutcome::NO_DEVICE: |
| 311 RecordGetDescriptorsOutcome(quantity, UMAGetDescriptorOutcome::NO_DEVICE); |
| 312 return; |
| 313 case CacheQueryOutcome::NO_SERVICE: |
| 314 RecordGetDescriptorsOutcome(quantity, |
| 315 UMAGetDescriptorOutcome::NO_SERVICE); |
| 316 return; |
| 317 case CacheQueryOutcome::NO_CHARACTERISTIC: |
| 318 RecordGetDescriptorsOutcome(quantity, |
| 319 UMAGetDescriptorOutcome::NO_CHARACTERISTIC); |
| 320 return; |
| 321 case CacheQueryOutcome::NO_DESCRIPTOR: |
| 322 NOTREACHED(); |
| 323 return; |
| 324 } |
| 325 } |
| 326 |
| 269 // GATT Operations | 327 // GATT Operations |
| 270 | 328 |
| 271 void RecordGATTOperationOutcome(UMAGATTOperation operation, | 329 void RecordGATTOperationOutcome(UMAGATTOperation operation, |
| 272 UMAGATTOperationOutcome outcome) { | 330 UMAGATTOperationOutcome outcome) { |
| 273 switch (operation) { | 331 switch (operation) { |
| 274 case UMAGATTOperation::CHARACTERISTIC_READ: | 332 case UMAGATTOperation::CHARACTERISTIC_READ: |
| 275 RecordCharacteristicReadValueOutcome(outcome); | 333 RecordCharacteristicReadValueOutcome(outcome); |
| 276 return; | 334 return; |
| 277 case UMAGATTOperation::CHARACTERISTIC_WRITE: | 335 case UMAGATTOperation::CHARACTERISTIC_WRITE: |
| 278 RecordCharacteristicWriteValueOutcome(outcome); | 336 RecordCharacteristicWriteValueOutcome(outcome); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { | 452 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { |
| 395 if (!accept_all_devices) { | 453 if (!accept_all_devices) { |
| 396 UMA_HISTOGRAM_SPARSE_SLOWLY( | 454 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 397 "Bluetooth.Web.RequestDevice." | 455 "Bluetooth.Web.RequestDevice." |
| 398 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", | 456 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", |
| 399 std::min(num_of_devices, kMaxNumOfDevices)); | 457 std::min(num_of_devices, kMaxNumOfDevices)); |
| 400 } | 458 } |
| 401 } | 459 } |
| 402 | 460 |
| 403 } // namespace content | 461 } // namespace content |
| OLD | NEW |