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

Unified Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc

Issue 1825263002: [Extensions] Convert APIs to use movable types [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Antony's Created 4 years, 9 months 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: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
index 7b257fdbed2b94c1ae1359718f3abc8fec791e79..75c0670c63af18882335a361901cf66145a2a96c 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
@@ -342,18 +342,11 @@ bool BluetoothLowEnergyEventRouter::GetServices(
out_services->clear();
- const std::vector<BluetoothGattService*>& services =
- device->GetGattServices();
- for (std::vector<BluetoothGattService*>::const_iterator iter =
- services.begin();
- iter != services.end();
- ++iter) {
+ for (const BluetoothGattService* service : device->GetGattServices()) {
// Populate an API service and add it to the return value.
- const BluetoothGattService* service = *iter;
- linked_ptr<apibtle::Service> api_service(new apibtle::Service());
- PopulateService(service, api_service.get());
-
- out_services->push_back(api_service);
+ apibtle::Service api_service;
+ PopulateService(service, &api_service);
+ out_services->push_back(std::move(api_service));
}
return true;
@@ -398,18 +391,11 @@ BluetoothLowEnergyEventRouter::GetIncludedServices(
out_services->clear();
- const std::vector<BluetoothGattService*>& includes =
- service->GetIncludedServices();
- for (std::vector<BluetoothGattService*>::const_iterator iter =
- includes.begin();
- iter != includes.end();
- ++iter) {
+ for (const BluetoothGattService* included : service->GetIncludedServices()) {
// Populate an API service and add it to the return value.
- const BluetoothGattService* included = *iter;
- linked_ptr<apibtle::Service> api_service(new apibtle::Service());
- PopulateService(included, api_service.get());
-
- out_services->push_back(api_service);
+ apibtle::Service api_service;
+ PopulateService(included, &api_service);
+ out_services->push_back(std::move(api_service));
}
return kStatusSuccess;
@@ -443,19 +429,12 @@ BluetoothLowEnergyEventRouter::GetCharacteristics(
out_characteristics->clear();
- const std::vector<BluetoothGattCharacteristic*>& characteristics =
- service->GetCharacteristics();
- for (std::vector<BluetoothGattCharacteristic*>::const_iterator iter =
- characteristics.begin();
- iter != characteristics.end();
- ++iter) {
+ for (const BluetoothGattCharacteristic* characteristic :
+ service->GetCharacteristics()) {
// Populate an API characteristic and add it to the return value.
- const BluetoothGattCharacteristic* characteristic = *iter;
- linked_ptr<apibtle::Characteristic> api_characteristic(
- new apibtle::Characteristic());
- PopulateCharacteristic(characteristic, api_characteristic.get());
-
- out_characteristics->push_back(api_characteristic);
+ apibtle::Characteristic api_characteristic;
+ PopulateCharacteristic(characteristic, &api_characteristic);
+ out_characteristics->push_back(std::move(api_characteristic));
}
return kStatusSuccess;
@@ -523,18 +502,12 @@ BluetoothLowEnergyEventRouter::GetDescriptors(
out_descriptors->clear();
- const std::vector<BluetoothGattDescriptor*>& descriptors =
- characteristic->GetDescriptors();
- for (std::vector<BluetoothGattDescriptor*>::const_iterator iter =
- descriptors.begin();
- iter != descriptors.end();
- ++iter) {
+ for (const BluetoothGattDescriptor* descriptor :
+ characteristic->GetDescriptors()) {
// Populate an API descriptor and add it to the return value.
- const BluetoothGattDescriptor* descriptor = *iter;
- linked_ptr<apibtle::Descriptor> api_descriptor(new apibtle::Descriptor());
- PopulateDescriptor(descriptor, api_descriptor.get());
-
- out_descriptors->push_back(api_descriptor);
+ apibtle::Descriptor api_descriptor;
+ PopulateDescriptor(descriptor, &api_descriptor);
+ out_descriptors->push_back(std::move(api_descriptor));
}
return kStatusSuccess;

Powered by Google App Engine
This is Rietveld 408576698