| Index: components/cronet/android/api/src/org/chromium/net/NetworkQualityRttListener.java
|
| diff --git a/components/cronet/android/api/src/org/chromium/net/NetworkQualityRttListener.java b/components/cronet/android/api/src/org/chromium/net/NetworkQualityRttListener.java
|
| index cd04f6ebfcca635cbaba2f0d9888c2aae6c7d383..29dd1c10d43af208624940a66daf990549d82880 100644
|
| --- a/components/cronet/android/api/src/org/chromium/net/NetworkQualityRttListener.java
|
| +++ b/components/cronet/android/api/src/org/chromium/net/NetworkQualityRttListener.java
|
| @@ -4,19 +4,46 @@
|
|
|
| package org.chromium.net;
|
|
|
| +import java.util.concurrent.Executor;
|
| +
|
| /**
|
| - * Interface to watch for observations of various round trip times (RTTs) at
|
| - * various layers of the network stack. These include RTT estimates by QUIC
|
| - * and TCP, as well as the time between when a URL request is sent and when
|
| - * the first byte of the response is received.
|
| + * Watches observations of various round trip times (RTTs) at various layers of
|
| + * the network stack. These include RTT estimates by QUIC and TCP, as well as
|
| + * the time between when a URL request is sent and when the first byte of the
|
| + * response is received.
|
| * {@hide} as it's a prototype.
|
| */
|
| -public interface NetworkQualityRttListener {
|
| +public abstract class NetworkQualityRttListener {
|
| + /**
|
| + * 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;
|
| +
|
| + // TODO(tbansal): http://crbug.com/618034 Remove this constructor.
|
| + public NetworkQualityRttListener() {
|
| + mExecutor = null;
|
| + }
|
| +
|
| + /**
|
| + * @param executor The executor on which the observations are reported.
|
| + */
|
| + public NetworkQualityRttListener(Executor executor) {
|
| + if (executor == null) {
|
| + throw new IllegalStateException("Executor must not be null");
|
| + }
|
| + mExecutor = executor;
|
| + }
|
| +
|
| + public Executor getExecutor() {
|
| + return mExecutor;
|
| + }
|
| +
|
| /**
|
| * Reports a new round trip time observation.
|
| * @param rttMs the round trip time in milliseconds.
|
| * @param whenMs milliseconds since the Epoch (January 1st 1970, 00:00:00.000).
|
| * @param source the observation source from {@link NetworkQualityObservationSource}.
|
| */
|
| - public void onRttObservation(int rttMs, long whenMs, int source);
|
| + public abstract void onRttObservation(int rttMs, long whenMs, int source);
|
| }
|
|
|