| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 optional_services.size()); | 84 optional_services.size()); |
| 85 for (const base::Optional<BluetoothUUID>& service : optional_services) { | 85 for (const base::Optional<BluetoothUUID>& service : optional_services) { |
| 86 // TODO(ortuno): Use a macro to histogram strings. | 86 // TODO(ortuno): Use a macro to histogram strings. |
| 87 // http://crbug.com/520284 | 87 // http://crbug.com/520284 |
| 88 UMA_HISTOGRAM_SPARSE_SLOWLY( | 88 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 89 "Bluetooth.Web.RequestDevice.OptionalServices.Services", | 89 "Bluetooth.Web.RequestDevice.OptionalServices.Services", |
| 90 HashUUID(service)); | 90 HashUUID(service)); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 static void RecordRequestDeviceAcceptAllDevices(bool accept_all_devices) { |
| 95 UMA_HISTOGRAM_BOOLEAN("Bluetooth.Web.RequestDevice.AcceptAllDevices", |
| 96 accept_all_devices); |
| 97 } |
| 98 |
| 94 static void RecordUnionOfServices( | 99 static void RecordUnionOfServices( |
| 95 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { | 100 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { |
| 96 std::unordered_set<std::string> union_of_services; | 101 std::unordered_set<std::string> union_of_services; |
| 97 for (const base::Optional<BluetoothUUID>& service : | 102 for (const base::Optional<BluetoothUUID>& service : |
| 98 options->optional_services) { | 103 options->optional_services) { |
| 99 union_of_services.insert(service->canonical_value()); | 104 union_of_services.insert(service->canonical_value()); |
| 100 } | 105 } |
| 101 | 106 |
| 102 for (const auto& filter : options->filters) { | 107 for (const auto& filter : options->filters) { |
| 103 for (const base::Optional<BluetoothUUID>& service : filter->services) { | 108 for (const base::Optional<BluetoothUUID>& service : filter->services) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 114 UMA_HISTOGRAM_SPARSE_SLOWLY( | 119 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 115 "Bluetooth.Web.RequestDevice.UnionOfServices.Services", | 120 "Bluetooth.Web.RequestDevice.UnionOfServices.Services", |
| 116 HashUUID(service)); | 121 HashUUID(service)); |
| 117 } | 122 } |
| 118 } | 123 } |
| 119 | 124 |
| 120 void RecordRequestDeviceOptions( | 125 void RecordRequestDeviceOptions( |
| 121 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { | 126 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { |
| 122 RecordRequestDeviceFilters(options->filters); | 127 RecordRequestDeviceFilters(options->filters); |
| 123 RecordRequestDeviceOptionalServices(options->optional_services); | 128 RecordRequestDeviceOptionalServices(options->optional_services); |
| 129 RecordRequestDeviceAcceptAllDevices(options->accept_all_devices); |
| 124 RecordUnionOfServices(options); | 130 RecordUnionOfServices(options); |
| 125 } | 131 } |
| 126 | 132 |
| 127 // GATTServer.Connect | 133 // GATTServer.Connect |
| 128 | 134 |
| 129 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) { | 135 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) { |
| 130 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome", | 136 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome", |
| 131 static_cast<int>(outcome), | 137 static_cast<int>(outcome), |
| 132 static_cast<int>(UMAConnectGATTOutcome::COUNT)); | 138 static_cast<int>(UMAConnectGATTOutcome::COUNT)); |
| 133 } | 139 } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 static_cast<int>(outcome), | 328 static_cast<int>(outcome), |
| 323 static_cast<int>(UMAGATTOperationOutcome::COUNT)); | 329 static_cast<int>(UMAGATTOperationOutcome::COUNT)); |
| 324 } | 330 } |
| 325 | 331 |
| 326 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { | 332 void RecordStartNotificationsOutcome(CacheQueryOutcome outcome) { |
| 327 RecordStartNotificationsOutcome( | 333 RecordStartNotificationsOutcome( |
| 328 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); | 334 TranslateCacheQueryOutcomeToGATTOperationOutcome(outcome)); |
| 329 } | 335 } |
| 330 | 336 |
| 331 } // namespace content | 337 } // namespace content |
| OLD | NEW |