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

Unified Diff: device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java

Issue 2536413002: Fix an exception in BatterMonitorFactory (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
diff --git a/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java b/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
index d17e2869a72c80124779f5977cf90c28875424d3..0d38e8b63b4fe3eb1808c719fef1b90817b0347f 100644
--- a/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
+++ b/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorFactory.java
@@ -13,7 +13,9 @@ import org.chromium.device.BatteryStatus;
import org.chromium.device.battery.BatteryStatusManager.BatteryStatusCallback;
import org.chromium.services.service_manager.InterfaceFactory;
+import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
/**
* Factory that creates instances of BatteryMonitor implementations and notifies them about battery
@@ -33,7 +35,8 @@ public class BatteryMonitorFactory implements InterfaceFactory<BatteryMonitor> {
public void onBatteryStatusChanged(BatteryStatus batteryStatus) {
ThreadUtils.assertOnUiThread();
- for (BatteryMonitorImpl monitor : mSubscribedMonitors) {
+ List<BatteryMonitorImpl> monitors = new ArrayList<>(mSubscribedMonitors);
+ for (BatteryMonitorImpl monitor : monitors) {
monitor.didChange(batteryStatus);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698