| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 static void RecordUnionOfServices( | 97 static void RecordUnionOfServices( |
| 98 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { | 98 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { |
| 99 std::unordered_set<std::string> union_of_services; | 99 std::unordered_set<std::string> union_of_services; |
| 100 for (const BluetoothUUID& service : options->optional_services) { | 100 for (const BluetoothUUID& service : options->optional_services) { |
| 101 union_of_services.insert(service.canonical_value()); | 101 union_of_services.insert(service.canonical_value()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 for (const auto& filter : options->filters) { | 104 if (options->filters) { |
| 105 if (!filter->services) { | 105 for (const auto& filter : options->filters.value()) { |
| 106 continue; | 106 if (!filter->services) { |
| 107 } | 107 continue; |
| 108 for (const BluetoothUUID& service : filter->services.value()) { | 108 } |
| 109 union_of_services.insert(service.canonical_value()); | 109 for (const BluetoothUUID& service : filter->services.value()) { |
| 110 union_of_services.insert(service.canonical_value()); |
| 111 } |
| 110 } | 112 } |
| 111 } | 113 } |
| 112 | 114 |
| 113 UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.UnionOfServices.Count", | 115 UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.UnionOfServices.Count", |
| 114 union_of_services.size()); | 116 union_of_services.size()); |
| 115 | 117 |
| 116 for (const std::string& service : union_of_services) { | 118 for (const std::string& service : union_of_services) { |
| 117 // TODO(ortuno): Use a macro to histogram strings. | 119 // TODO(ortuno): Use a macro to histogram strings. |
| 118 // http://crbug.com/520284 | 120 // http://crbug.com/520284 |
| 119 UMA_HISTOGRAM_SPARSE_SLOWLY( | 121 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 120 "Bluetooth.Web.RequestDevice.UnionOfServices.Services", | 122 "Bluetooth.Web.RequestDevice.UnionOfServices.Services", |
| 121 HashUUID(service)); | 123 HashUUID(service)); |
| 122 } | 124 } |
| 123 } | 125 } |
| 124 | 126 |
| 125 void RecordRequestDeviceOptions( | 127 void RecordRequestDeviceOptions( |
| 126 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { | 128 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { |
| 127 RecordRequestDeviceFilters(options->filters); | 129 UMA_HISTOGRAM_BOOLEAN("Bluetooth.Web.RequestDevice.Options.AcceptAllDevices", |
| 130 options->accept_all_devices); |
| 131 |
| 132 if (options->filters) { |
| 133 RecordRequestDeviceFilters(options->filters.value()); |
| 134 } |
| 135 |
| 128 RecordRequestDeviceOptionalServices(options->optional_services); | 136 RecordRequestDeviceOptionalServices(options->optional_services); |
| 129 RecordUnionOfServices(options); | 137 RecordUnionOfServices(options); |
| 130 } | 138 } |
| 131 | 139 |
| 132 // GATTServer.Connect | 140 // GATTServer.Connect |
| 133 | 141 |
| 134 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) { | 142 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) { |
| 135 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome", | 143 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome", |
| 136 static_cast<int>(outcome), | 144 static_cast<int>(outcome), |
| 137 static_cast<int>(UMAConnectGATTOutcome::COUNT)); | 145 static_cast<int>(UMAConnectGATTOutcome::COUNT)); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 347 } |
| 340 | 348 |
| 341 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { | 349 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { |
| 342 UMA_HISTOGRAM_ENUMERATION( | 350 UMA_HISTOGRAM_ENUMERATION( |
| 343 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", | 351 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", |
| 344 static_cast<int>(level), | 352 static_cast<int>(level), |
| 345 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); | 353 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); |
| 346 } | 354 } |
| 347 | 355 |
| 348 } // namespace content | 356 } // namespace content |
| OLD | NEW |