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

Side by Side Diff: content/browser/bluetooth/bluetooth_metrics.cc

Issue 2641173009: Add BluetoothRemoteGATTDescriptor reporting for .readValue(). (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 case UMAGATTOperation::CHARACTERISTIC_READ: 274 case UMAGATTOperation::CHARACTERISTIC_READ:
275 RecordCharacteristicReadValueOutcome(outcome); 275 RecordCharacteristicReadValueOutcome(outcome);
276 return; 276 return;
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 // TODO(667319) Add reporting to descriptors 284 RecordDescriptorReadValueOutcome(outcome);
285 return; 285 return;
286 case UMAGATTOperation::COUNT: 286 case UMAGATTOperation::COUNT:
287 NOTREACHED(); 287 NOTREACHED();
288 return; 288 return;
289 } 289 }
290 NOTREACHED(); 290 NOTREACHED();
291 } 291 }
292 292
293 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome( 293 static UMAGATTOperationOutcome TranslateCacheQueryOutcomeToGATTOperationOutcome(
294 CacheQueryOutcome outcome) { 294 CacheQueryOutcome outcome) {
(...skipping 11 matching lines...) Expand all
306 return UMAGATTOperationOutcome::NO_CHARACTERISTIC; 306 return UMAGATTOperationOutcome::NO_CHARACTERISTIC;
307 case CacheQueryOutcome::NO_DESCRIPTOR: 307 case CacheQueryOutcome::NO_DESCRIPTOR:
308 return UMAGATTOperationOutcome::NO_DESCRIPTOR; 308 return UMAGATTOperationOutcome::NO_DESCRIPTOR;
309 } 309 }
310 NOTREACHED() << "No need to record success or renderer crash"; 310 NOTREACHED() << "No need to record success or renderer crash";
311 return UMAGATTOperationOutcome::NOT_SUPPORTED; 311 return UMAGATTOperationOutcome::NOT_SUPPORTED;
312 } 312 }
313 313
314 // Characteristic.readValue 314 // Characteristic.readValue
315 315
316 // static
317 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) { 316 void RecordCharacteristicReadValueOutcome(UMAGATTOperationOutcome outcome) {
318 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome", 317 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Characteristic.ReadValue.Outcome",
319 static_cast<int>(outcome), 318 static_cast<int>(outcome),
320 static_cast<int>(UMAGATTOperationOutcome::COUNT)); 319 static_cast<int>(UMAGATTOperationOutcome::COUNT));
321 } 320 }
322 321
323 void RecordCharacteristicReadValueOutcome(CacheQueryOutcome outcome) { 322 void RecordCharacteristicReadValueOutcome(CacheQueryOutcome outcome) {
324 RecordCharacteristicReadValueOutcome( 323 RecordCharacteristicReadValueOutcome(
325 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); 324 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
326 } 325 }
(...skipping 22 matching lines...) Expand all
349 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { 348 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) {
350 RecordStartNotificationsOutcome( 349 RecordStartNotificationsOutcome(
351 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); 350 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
352 } 351 }
353 352
354 void RecordRSSISignalStrength(int rssi) { 353 void RecordRSSISignalStrength(int rssi) {
355 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.RequestDevice.RSSISignalStrength", 354 UMA_HISTOGRAM_SPARSE_SLOWLY("Bluetooth.Web.RequestDevice.RSSISignalStrength",
356 rssi); 355 rssi);
357 } 356 }
358 357
358 // Descriptor.readValue
359
360 void RecordDescriptorReadValueOutcome(UMAGATTOperationOutcome outcome) {
361 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.Descriptor.ReadValue.Outcome",
362 static_cast<int>(outcome),
363 static_cast<int>(UMAGATTOperationOutcome::COUNT));
364 }
365
366 void RecordDescriptorReadValueOutcome(CacheQueryOutcome outcome) {
367 RecordDescriptorReadValueOutcome(
368 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome));
369 }
370
359 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { 371 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) {
360 UMA_HISTOGRAM_ENUMERATION( 372 UMA_HISTOGRAM_ENUMERATION(
361 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", 373 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel",
362 static_cast<int>(level), 374 static_cast<int>(level),
363 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); 375 static_cast<int>(UMARSSISignalStrengthLevel::COUNT));
364 } 376 }
365 377
366 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) { 378 void RecordNumOfDevices(bool accept_all_devices, size_t num_of_devices) {
367 if (!accept_all_devices) { 379 if (!accept_all_devices) {
368 UMA_HISTOGRAM_SPARSE_SLOWLY( 380 UMA_HISTOGRAM_SPARSE_SLOWLY(
369 "Bluetooth.Web.RequestDevice." 381 "Bluetooth.Web.RequestDevice."
370 "NumOfDevicesInChooserWhenNotAcceptingAllDevices", 382 "NumOfDevicesInChooserWhenNotAcceptingAllDevices",
371 std::min(num_of_devices, kMaxNumOfDevices)); 383 std::min(num_of_devices, kMaxNumOfDevices));
372 } 384 }
373 } 385 }
374 386
375 } // namespace content 387 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_metrics.h ('k') | content/browser/bluetooth/web_bluetooth_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698