Chromium Code Reviews| 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()); |
| + } |
| } |
| } |