Index: components/cronet/android/api/src/org/chromium/net/NetworkQualityThroughputListener.java |
diff --git a/components/cronet/android/api/src/org/chromium/net/NetworkQualityThroughputListener.java b/components/cronet/android/api/src/org/chromium/net/NetworkQualityThroughputListener.java |
index 196dbeccb2d7389599b04852c6d49cc54202924f..44caac8987b5e63cb350e9f081e8a9cc1a57de3e 100644 |
--- a/components/cronet/android/api/src/org/chromium/net/NetworkQualityThroughputListener.java |
+++ b/components/cronet/android/api/src/org/chromium/net/NetworkQualityThroughputListener.java |
@@ -4,16 +4,39 @@ |
package org.chromium.net; |
+import java.util.concurrent.Executor; |
+ |
/** |
- * Interface to watch for observations of throughput. |
+ * Listener that is notified of throughput observations from the network quality |
+ * estimator. |
* {@hide} as it's a prototype. |
*/ |
-public interface NetworkQualityThroughputListener { |
+public abstract class NetworkQualityThroughputListener { |
+ /** |
+ * The executor on which this listener will be notified. Set as a final |
+ * field, so it can be safely accessed across threads. |
+ */ |
+ private final Executor mExecutor; |
+ |
+ /** |
+ * @param executor The executor on which the observations are reported. |
+ */ |
+ public NetworkQualityThroughputListener(Executor executor) { |
+ if (executor == null) { |
+ throw new IllegalStateException("Executor must not be null"); |
+ } |
+ mExecutor = executor; |
+ } |
+ |
+ public Executor getExecutor() { |
+ return mExecutor; |
+ } |
+ |
/** |
* Reports a new throughput observation. |
* @param throughputKbps the downstream throughput in kilobits per second. |
* @param whenMs milliseconds since the Epoch (January 1st 1970, 00:00:00.000). |
* @param source the observation source from {@link NetworkQualityObservationSource}. |
*/ |
- public void onThroughputObservation(int throughputKbps, long whenMs, int source); |
+ public abstract void onThroughputObservation(int throughputKbps, long whenMs, int source); |
} |