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

Unified Diff: components/cronet/android/api/src/org/chromium/net/NetworkQualityThroughputListener.java

Issue 2045703003: Enable NQE when Cronet Engine is built (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mef comments Created 4 years, 6 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: 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);
}

Powered by Google App Engine
This is Rietveld 408576698