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

Unified Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 2422933002: Reduce usage of FOR_EACH_OBSERVER macro in content/ (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « content/public/test/mock_render_process_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
index b47276fb9795702d0e2d700520ecc7ee59cc0195..a82f5262532a03570b9bf76e70a395afbc1d7fa6 100644
--- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc
@@ -126,23 +126,23 @@ std::set<BluetoothUUID> GetUUIDs(
// Notifies the adapter's observers for each device id the adapter.
void NotifyDevicesAdded(MockBluetoothAdapter* adapter) {
for (BluetoothDevice* device : adapter->GetMockDevices()) {
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
- DeviceAdded(adapter, device));
+ for (auto& observer : adapter->GetObservers())
+ observer.DeviceAdded(adapter, device);
}
}
// Notifies the adapter's observers that the services have been discovered.
void NotifyServicesDiscovered(MockBluetoothAdapter* adapter,
MockBluetoothDevice* device) {
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
- GattServicesDiscovered(adapter, device));
+ for (auto& observer : adapter->GetObservers())
+ observer.GattServicesDiscovered(adapter, device);
}
// Notifies the adapter's observers that a device has changed.
void NotifyDeviceChanged(MockBluetoothAdapter* adapter,
MockBluetoothDevice* device) {
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
- DeviceChanged(adapter, device));
+ for (auto& observer : adapter->GetObservers())
+ observer.DeviceChanged(adapter, device);
}
} // namespace
@@ -363,16 +363,16 @@ static void AddDevice(scoped_refptr<NiceMockBluetoothAdapter> adapter,
std::unique_ptr<NiceMockBluetoothDevice> new_device) {
NiceMockBluetoothDevice* new_device_ptr = new_device.get();
adapter->AddMockDevice(std::move(new_device));
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
- DeviceAdded(adapter.get(), new_device_ptr));
+ for (auto& observer : adapter->GetObservers())
+ observer.DeviceAdded(adapter.get(), new_device_ptr);
}
static void RemoveDevice(scoped_refptr<NiceMockBluetoothAdapter> adapter,
const std::string& device_address) {
std::unique_ptr<MockBluetoothDevice> removed_device =
adapter->RemoveMockDevice(device_address);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(),
- DeviceRemoved(adapter.get(), removed_device.get()));
+ for (auto& observer : adapter->GetObservers())
+ observer.DeviceRemoved(adapter.get(), removed_device.get());
}
// static
scoped_refptr<NiceMockBluetoothAdapter>
@@ -736,9 +736,8 @@ LayoutTestBluetoothAdapterProvider::GetDisconnectingHeartRateAdapter() {
const std::vector<uint8_t>& value, const base::Closure& success,
const BluetoothRemoteGattCharacteristic::ErrorCallback& error) {
device_ptr->SetConnected(false);
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
- adapter_ptr->GetObservers(),
- DeviceChanged(adapter_ptr, device_ptr));
+ for (auto& observer : adapter_ptr->GetObservers())
+ observer.DeviceChanged(adapter_ptr, device_ptr);
success.Run();
}));
@@ -1209,10 +1208,10 @@ LayoutTestBluetoothAdapterProvider::GetHeartRateService(
location[0] = 1; // Chest
// Read a characteristic has a side effect of
// GattCharacteristicValueChanged being called.
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
- adapter->GetObservers(),
- GattCharacteristicValueChanged(
- adapter, location_chest_ptr, location));
+ for (auto& observer : adapter->GetObservers()) {
+ observer.GattCharacteristicValueChanged(
+ adapter, location_chest_ptr, location);
+ }
return location;
}));
@@ -1231,10 +1230,10 @@ LayoutTestBluetoothAdapterProvider::GetHeartRateService(
location[0] = 2; // Wrist
// Read a characteristic has a side effect of
// GattCharacteristicValueChanged being called.
- FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
- adapter->GetObservers(),
- GattCharacteristicValueChanged(
- adapter, location_wrist_ptr, location));
+ for (auto& observer : adapter->GetObservers()) {
+ observer.GattCharacteristicValueChanged(
+ adapter, location_wrist_ptr, location);
+ }
return location;
}));
« no previous file with comments | « content/public/test/mock_render_process_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698