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

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

Issue 2510323002: bluetooth: Implement acceptAllDevices (Closed)
Patch Set: Clean up Created 4 years, 1 month 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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 static void RecordUnionOfServices( 94 static void RecordUnionOfServices(
95 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { 95 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) {
96 std::unordered_set<std::string> union_of_services; 96 std::unordered_set<std::string> union_of_services;
97 for (const base::Optional<BluetoothUUID>& service : 97 for (const base::Optional<BluetoothUUID>& service :
98 options->optional_services) { 98 options->optional_services) {
99 union_of_services.insert(service->canonical_value()); 99 union_of_services.insert(service->canonical_value());
100 } 100 }
101 101
102 for (const auto& filter : options->filters) { 102 if (!options->filters.is_null()) {
103 for (const base::Optional<BluetoothUUID>& service : filter->services) { 103 for (const auto& filter : options->filters) {
104 union_of_services.insert(service->canonical_value()); 104 for (const base::Optional<BluetoothUUID>& service : filter->services) {
105 union_of_services.insert(service->canonical_value());
106 }
105 } 107 }
106 } 108 }
107 109
108 UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.UnionOfServices.Count", 110 UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.UnionOfServices.Count",
109 union_of_services.size()); 111 union_of_services.size());
110 112
111 for (const std::string& service : union_of_services) { 113 for (const std::string& service : union_of_services) {
112 // TODO(ortuno): Use a macro to histogram strings. 114 // TODO(ortuno): Use a macro to histogram strings.
113 // http://crbug.com/520284 115 // http://crbug.com/520284
114 UMA_HISTOGRAM_SPARSE_SLOWLY( 116 UMA_HISTOGRAM_SPARSE_SLOWLY(
115 "Bluetooth.Web.RequestDevice.UnionOfServices.Services", 117 "Bluetooth.Web.RequestDevice.UnionOfServices.Services",
116 HashUUID(service)); 118 HashUUID(service));
117 } 119 }
118 } 120 }
119 121
120 void RecordRequestDeviceOptions( 122 void RecordRequestDeviceOptions(
121 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) { 123 const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) {
122 RecordRequestDeviceFilters(options->filters); 124 UMA_HISTOGRAM_BOOLEAN("Bluetooth.Web.RequestDevice.Options.AcceptAllDevices",
125 options->accept_all_devices);
126
127 if (!options->filters.is_null()) {
128 RecordRequestDeviceFilters(options->filters);
129 }
130
123 RecordRequestDeviceOptionalServices(options->optional_services); 131 RecordRequestDeviceOptionalServices(options->optional_services);
124 RecordUnionOfServices(options); 132 RecordUnionOfServices(options);
125 } 133 }
126 134
127 // GATTServer.Connect 135 // GATTServer.Connect
128 136
129 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) { 137 void RecordConnectGATTOutcome(UMAConnectGATTOutcome outcome) {
130 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome", 138 UMA_HISTOGRAM_ENUMERATION("Bluetooth.Web.ConnectGATT.Outcome",
131 static_cast<int>(outcome), 139 static_cast<int>(outcome),
132 static_cast<int>(UMAConnectGATTOutcome::COUNT)); 140 static_cast<int>(UMAConnectGATTOutcome::COUNT));
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 342 }
335 343
336 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) { 344 void RecordRSSISignalStrengthLevel(UMARSSISignalStrengthLevel level) {
337 UMA_HISTOGRAM_ENUMERATION( 345 UMA_HISTOGRAM_ENUMERATION(
338 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel", 346 "Bluetooth.Web.RequestDevice.RSSISignalStrengthLevel",
339 static_cast<int>(level), 347 static_cast<int>(level),
340 static_cast<int>(UMARSSISignalStrengthLevel::COUNT)); 348 static_cast<int>(UMARSSISignalStrengthLevel::COUNT));
341 } 349 }
342 350
343 } // namespace content 351 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698