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

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

Issue 2506813003: Use new wrapper types for web_bluetooth.mojom (Closed)
Patch Set: updated web_bluetooth_impl.cc 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..059046f4375b9ea20436a150636892092659a0cd 100644
--- a/content/browser/bluetooth/bluetooth_metrics.cc
+++ b/content/browser/bluetooth/bluetooth_metrics.cc
@@ -63,26 +63,28 @@ 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) {
- UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.FilterSize",
- filter->services.size());
- for (const base::Optional<BluetoothUUID>& service : filter->services) {
- // TODO(ortuno): Use a macro to histogram strings.
- // http://crbug.com/520284
- UMA_HISTOGRAM_SPARSE_SLOWLY(
- "Bluetooth.Web.RequestDevice.Filters.Services", HashUUID(service));
+ if (filter->services) {
ortuno 2016/11/21 04:42:31 if (!filter->services) { continue; } ...
juncai 2016/11/21 21:27:05 Done.
+ UMA_HISTOGRAM_COUNTS_100("Bluetooth.Web.RequestDevice.FilterSize",
+ 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(
+ "Bluetooth.Web.RequestDevice.Filters.Services", HashUUID(service));
+ }
}
}
}
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 +96,15 @@ 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) {
ortuno 2016/11/21 04:42:31 if (!filter->services) { continue; } ...
juncai 2016/11/21 21:27:05 Done.
+ for (const BluetoothUUID& service : filter->services.value()) {
+ union_of_services.insert(service.canonical_value());
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698