Chromium Code Reviews| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 case UMAGATTOperation::CHARACTERISTIC_WRITE: | 277 case UMAGATTOperation::CHARACTERISTIC_WRITE: |
| 278 RecordCharacteristicWriteValueOutcome(outcome); | 278 RecordCharacteristicWriteValueOutcome(outcome); |
| 279 return; | 279 return; |
| 280 case UMAGATTOperation::START_NOTIFICATIONS: | 280 case UMAGATTOperation::START_NOTIFICATIONS: |
| 281 RecordStartNotificationsOutcome(outcome); | 281 RecordStartNotificationsOutcome(outcome); |
| 282 return; | 282 return; |
| 283 case UMAGATTOperation::DESCRIPTOR_READ: | 283 case UMAGATTOperation::DESCRIPTOR_READ: |
| 284 RecordDescriptorReadValueOutcome(outcome); | 284 RecordDescriptorReadValueOutcome(outcome); |
| 285 return; | 285 return; |
| 286 case UMAGATTOperation::DESCRIPTOR_WRITE: | 286 case UMAGATTOperation::DESCRIPTOR_WRITE: |
| 287 // TODO(683477) reporting for .writeValue() | 287 RecordDescriptorWriteValueOutcome(outcome); |
| 288 return; | 288 return; |
| 289 case UMAGATTOperation::COUNT: | 289 case UMAGATTOperation::COUNT: |
| 290 NOTREACHED(); | 290 NOTREACHED(); |
| 291 return; | 291 return; |
| 292 } | 292 } |
| 293 NOTREACHED(); | 293 NOTREACHED(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( | 296 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( |
| 297 CacheQueryOutcome outcome) { | 297 CacheQueryOutcome outcome) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Descriptor.ReadValue.Outcome", | 364 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Descriptor.ReadValue.Outcome", |
| 365 static_cast<int>(outcome), | 365 static_cast<int>(outcome), |
| 366 static_cast<int>(UMAGATTOperationOutcome::COUNT)); | 366 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void RecordDescriptorReadValueOutcome(CacheQueryOutcome outcome) { | 369 void RecordDescriptorReadValueOutcome(CacheQueryOutcome outcome) { |
| 370 RecordDescriptorReadValueOutcome( | 370 RecordDescriptorReadValueOutcome( |
| 371 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); | 371 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); |
| 372 } | 372 } |
| 373 | 373 |
| 374 // Descriptor.writeValue | |
| 375 | |
|
ortuno
2017/01/31 19:11:51
nit: remove unnecessary line.
| |
| 376 void RecordDescriptorWriteValueOutcome(UMAGATTOperationOutcome outcome) { | |
| 377 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Descriptor.WriteValue.Outcome", | |
| 378 static_cast<int>(outcome), | |
| 379 static_cast<int>(UMAGATTOperationOutcome::COUNT)); | |
| 380 } | |
| 381 | |
| 382 void RecordDescriptorWriteValueOutcome(CacheQueryOutcome outcome) { | |
| 383 RecordDescriptorWriteValueOutcome( | |
| 384 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); | |
| 385 } | |
| 386 | |
| 374 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { | 387 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { |
| 375 UMA_HISTOGRAM_ENUMERATION( | 388 UMA_HISTOGRAM_ENUMERATION( |
| 376 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", | 389 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", |
| 377 static_cast<int>(level), | 390 static_cast<int>(level), |
| 378 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); | 391 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); |
| 379 } | 392 } |
| 380 | 393 |
| 381 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { | 394 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { |
| 382 if (!accept_all_devices) { | 395 if (!accept_all_devices) { |
| 383 UMA_HISTOGRAM_SPARSE_SLOWLY( | 396 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 384 "Bluetooth.Web.RequestDevice." | 397 "Bluetooth.Web.RequestDevice." |
| 385 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", | 398 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", |
| 386 std::min(num_of_devices, kMaxNumOfDevices)); | 399 std::min(num_of_devices, kMaxNumOfDevices)); |
| 387 } | 400 } |
| 388 } | 401 } |
| 389 | 402 |
| 390 } // namespace content | 403 } // namespace content |
| OLD | NEW |