Index: components/cronet/android/java/src/org/chromium/net/UrlRequestContext.java |
diff --git a/components/cronet/android/java/src/org/chromium/net/UrlRequestContext.java b/components/cronet/android/java/src/org/chromium/net/UrlRequestContext.java |
index 3ed4106847cd8b989a84a32d38267655d98f8c2b..9b7e356f1a3210c1ddf76f4dc1a005a16935da02 100644 |
--- a/components/cronet/android/java/src/org/chromium/net/UrlRequestContext.java |
+++ b/components/cronet/android/java/src/org/chromium/net/UrlRequestContext.java |
@@ -94,6 +94,72 @@ public abstract class UrlRequestContext { |
public abstract void stopNetLog(); |
/** |
+ * Enables the network quality estimator, which collects and reports |
+ * measurements of round trip time (RTT) and downstream throughput at |
+ * various layers of the network stack. After enabling the estimator, |
+ * listeners of RTT and throughput can be added with |
+ * {@link #addRttListener} and {@link #addThroughputListener} and |
+ * removed with {@link #removeRttListener} and |
+ * {@link #removeThroughputListener}. The estimator uses memory and CPU |
+ * only when enabled. |
+ * @param executor an executor that will be used to notified all |
+ * added RTT and throughput listeners. |
+ */ |
+ public abstract void enableNetworkQualityEstimator(Executor executor); |
+ |
+ /** |
+ * Enables the network quality estimator for testing. This must be called |
+ * before round trip time and throughput listeners are added. Set both |
+ * boolean parameters to false for default behavior. |
+ * @param useLocalHostRequests include requests to localhost in estimates. |
+ * @param useSmallerResponses include small responses in throughput estimates. |
+ * @param executor an {@link java.util.concurrent.Executor} on which all |
+ * listeners will be called. |
+ */ |
+ abstract void enableNetworkQualityEstimator( |
+ boolean useLocalHostRequests, boolean useSmallerResponses, Executor executor); |
+ |
+ /** |
+ * Registers an listener that gets called whenever the network quality |
+ * estimator witnesses a sample round trip time. This must be called |
+ * after {@link #enableNetworkQualityEstimator}. Round trip times may be |
+ * recorded at various layers of the network stack, including TCP, QUIC, |
+ * and at the URL request layer. The listener is called on the |
+ * {@link java.util.concurrent.Executor} that is passed to |
+ * {@link #enableNetworkQualityEstimator}. |
+ * @param listener the listener of round trip times. |
+ */ |
+ public abstract void addRttListener(NetworkQualityRttListener listener); |
+ |
+ /** |
+ * Removes an listener of round trip times if on the listener list. This |
+ * should be called after a NetworkQualityRttListener is added in order to |
+ * stop receiving observations. |
+ * @param listener the listener of round trip times. |
+ */ |
+ public abstract void removeRttListener(NetworkQualityRttListener listener); |
+ |
+ /** |
+ * Registers an listener that gets called whenever the network quality |
mef
2015/10/01 19:02:28
I'm not native speaker, but shouldn't "an listener
bengr
2015/10/01 23:14:35
Damn search and replace. Done.
|
+ * estimator witnesses a sample throughput measurement. This must be called |
+ * after {@link #enableNetworkQualityEstimator}. Throughput observations |
+ * are computed by measuring bytes read over the active network interface |
+ * at times when at least one URL response is being received. The listener |
+ * is called on the {@link java.util.concurrent.Executor} that is passed to |
+ * {@link #enableNetworkQualityEstimator}. |
+ * @param listener the listener of throughput. |
+ */ |
+ public abstract void addThroughputListener(NetworkQualityThroughputListener listener); |
+ |
+ /** |
+ * Removes an listener of throughput. This should be called after a |
+ * NetworkQualityThroughputListener is added in order to stop receiving |
+ * observations. |
+ * @param listener the listener of throughput. |
+ */ |
+ public abstract void removeThroughputListener(NetworkQualityThroughputListener listener); |
+ |
+ /** |
* Creates a {@link UrlRequestContext} with the given |
* {@link UrlRequestContextConfig}. |
* @param context Android {@link Context}. |