| Index: components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java
|
| diff --git a/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java b/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java
|
| index 9ab5f648e77d91a56f64f62f9a0a044273373563..3705e2cd3141c508e8f547de952d236100919ab9 100644
|
| --- a/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java
|
| +++ b/components/cronet/android/api/src/org/chromium/net/ExperimentalCronetEngine.java
|
| @@ -7,6 +7,7 @@ import android.content.Context;
|
| import android.support.annotation.VisibleForTesting;
|
|
|
| import java.io.IOException;
|
| +import java.net.InetAddress;
|
| import java.net.Proxy;
|
| import java.net.URL;
|
| import java.net.URLConnection;
|
| @@ -434,4 +435,32 @@ public abstract class ExperimentalCronetEngine extends CronetEngine {
|
| public int getDownstreamThroughputKbps() {
|
| return CONNECTION_METRIC_UNKNOWN;
|
| }
|
| +
|
| + /**
|
| + * Put an entry for a host in the host resolver cache. This can save time
|
| + * when making requests to this host in the future by avoiding having to
|
| + * resolve the host.
|
| + * <p>
|
| + * <b>Caveats:</b>
|
| + * <ul>
|
| + * <li>Only add trustworthy entries. Incorrect entries can provoke
|
| + * security vulnerabilities like man-in-the-middle attacks when SSL/TLS
|
| + * is not used.</li>
|
| + * <li>Putting an entry in the cache evicts any previously existing entry
|
| + * for the host.</li>
|
| + * <li>Hosts can resolve to different IP addresses accessible with varying
|
| + * latencies. An entry placed in the cache accessible with high latency,
|
| + * e.g. a far away server, can harm performance if normal host
|
| + * resolution would have provided more optimal results, e.g. the address
|
| + * of a nearby server.</li>
|
| + * <li>The entry may be purged from the cache prior to the given lifetime
|
| + * when certain events happen, for example if the default network
|
| + * connection changes.</li>
|
| + * </ul>
|
| + * @param hostName the name of the host to add an entry for.
|
| + * @param addresses the list of addresses to add for the host.
|
| + * @param secondsToLive the maximum number of seconds this entry should live
|
| + * in the cache.
|
| + */
|
| + public void putHostCache(String hostName, InetAddress[] addresses, int secondsToLive) {}
|
| }
|
|
|