Chromium Code Reviews| 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..44d2c93037fad9f059f31d06030a34752f7a4f56 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,81 @@ 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. |
| + * @deprecated not really deprecated but hidden for now as it's a prototype. |
| + */ |
| + @Deprecated 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. |
| + * @deprecated not really deprecated but hidden for now as it's a prototype. |
| + */ |
| + @Deprecated |
|
pauljensen
2015/10/05 14:49:40
@VisibleForTesting
bengr
2015/10/06 16:16:50
Done.
|
| + abstract void enableNetworkQualityEstimator( |
|
pauljensen
2015/10/05 14:49:40
nit: might be good to add "ForTesting" suffix
bengr
2015/10/06 16:16:50
Done.
|
| + boolean useLocalHostRequests, boolean useSmallerResponses, Executor executor); |
| + |
| + /** |
| + * Registers a 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 |
|
pauljensen
2015/10/05 14:49:40
might be good to mention what happens if not calle
bengr
2015/10/06 16:16:50
Done.
|
| + * 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. |
| + * @deprecated not really deprecated but hidden for now as it's a prototype. |
| + */ |
| + @Deprecated public abstract void addRttListener(NetworkQualityRttListener listener); |
| + |
| + /** |
| + * Removes a listener of round trip times if on the listener list. This |
|
pauljensen
2015/10/05 14:49:40
"the listener list" is not a term a reader might b
bengr
2015/10/06 16:16:50
Done.
|
| + * should be called after a NetworkQualityRttListener is added in order to |
|
pauljensen
2015/10/05 14:49:40
wrap NQERttListener in @link
bengr
2015/10/06 16:16:50
Done.
|
| + * stop receiving observations. |
| + * @param listener the listener of round trip times. |
| + * @deprecated not really deprecated but hidden for now as it's a prototype. |
| + */ |
| + @Deprecated public abstract void removeRttListener(NetworkQualityRttListener listener); |
| + |
| + /** |
| + * Registers a listener that gets called whenever the network quality |
| + * 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. |
| + * @deprecated not really deprecated but hidden for now as it's a prototype. |
| + */ |
| + @Deprecated |
| + public abstract void addThroughputListener(NetworkQualityThroughputListener listener); |
| + |
| + /** |
| + * Removes a listener of throughput. This should be called after a |
| + * NetworkQualityThroughputListener is added in order to stop receiving |
|
pauljensen
2015/10/05 14:49:40
"is added"->"is added with {@link #addThroughputLi
pauljensen
2015/10/05 14:49:40
wrap NetworkQualityThroughputListener in @link
bengr
2015/10/06 16:16:50
Done.
bengr
2015/10/06 16:16:50
Done.
|
| + * observations. |
| + * @param listener the listener of throughput. |
| + * @deprecated not really deprecated but hidden for now as it's a prototype. |
| + */ |
| + @Deprecated |
| + public abstract void removeThroughputListener(NetworkQualityThroughputListener listener); |
| + |
| + /** |
| * Creates a {@link UrlRequestContext} with the given |
| * {@link UrlRequestContextConfig}. |
| * @param context Android {@link Context}. |