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

Unified Diff: content/browser/bluetooth/bluetooth_metrics.cc

Issue 2506813003: Use new wrapper types for web_bluetooth.mojom (Closed)
Patch Set: merge master and resolve conflicts 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_metrics.cc
diff --git a/content/browser/bluetooth/bluetooth_metrics.cc b/content/browser/bluetooth/bluetooth_metrics.cc
index c9e540517d0e3603a7503fb9a15ddd536b554390..dcbc576f88bf9699c31fb8a18c1a3956cd68295f 100644
--- a/content/browser/bluetooth/bluetooth_metrics.cc
+++ b/content/browser/bluetooth/bluetooth_metrics.cc
@@ -63,13 +63,16 @@ void RecordRequestDeviceOutcome(UMARequestDeviceOutcome outcome) {
}
static void RecordRequestDeviceFilters(
- const mojo::Array<blink::mojom::WebBluetoothScanFilterPtr>& filters) {
+ const std::vector<blink::mojom::WebBluetoothScanFilterPtr>& filters) {
UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.Filters.Count",
filters.size());
for (const auto& filter : filters) {
+ if (!filter->services) {
+ continue;
+ }
UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.FilterSize",
- filter->services.size());
- for (const base::Optional<BluetoothUUID>& service : filter->services) {
+ filter->services->size());
+ for (const BluetoothUUID& service : filter->services.value()) {
// TODO(ortuno): Use a macro to histogram strings.
// http://crbug.com/520284
UMA_HISTOGRAM_SPARSE_SLOWLY(
@@ -79,10 +82,10 @@ static void RecordRequestDeviceFilters(
}
static void RecordRequestDeviceOptionalServices(
- const mojo::Array<base::Optional<BluetoothUUID>>& optional_services) {
+ const std::vector<BluetoothUUID>& optional_services) {
UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.OptionalServices.Count",
optional_services.size());
- for (const base::Optional<BluetoothUUID>& service : optional_services) {
+ for (const BluetoothUUID& service : optional_services) {
// TODO(ortuno): Use a macro to histogram strings.
// http://crbug.com/520284
UMA_HISTOGRAM_SPARSE_SLOWLY(
@@ -94,14 +97,16 @@ static void RecordRequestDeviceOptionalServices(
static void RecordUnionOfServices(
const blink::mojom::WebBluetoothRequestDeviceOptionsPtr& options) {
std::unordered_set<std::string> union_of_services;
- for (const base::Optional<BluetoothUUID>& service :
- options->optional_services) {
- union_of_services.insert(service->canonical_value());
+ for (const BluetoothUUID& service : options->optional_services) {
+ union_of_services.insert(service.canonical_value());
}
for (const auto& filter : options->filters) {
- for (const base::Optional<BluetoothUUID>& service : filter->services) {
- union_of_services.insert(service->canonical_value());
+ if (!filter->services) {
+ continue;
+ }
+ for (const BluetoothUUID& service : filter->services.value()) {
+ union_of_services.insert(service.canonical_value());
}
}

Powered by Google App Engine
This is Rietveld 408576698