| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 package org.chromium.net; | 4 package org.chromium.net; |
| 5 | 5 |
| 6 import android.content.Context; | 6 import android.content.Context; |
| 7 import android.support.annotation.VisibleForTesting; | 7 import android.support.annotation.VisibleForTesting; |
| 8 | 8 |
| 9 import java.io.IOException; | 9 import java.io.IOException; |
| 10 import java.net.InetAddress; |
| 10 import java.net.Proxy; | 11 import java.net.Proxy; |
| 11 import java.net.URL; | 12 import java.net.URL; |
| 12 import java.net.URLConnection; | 13 import java.net.URLConnection; |
| 13 import java.util.Date; | 14 import java.util.Date; |
| 14 import java.util.Set; | 15 import java.util.Set; |
| 15 import java.util.concurrent.Executor; | 16 import java.util.concurrent.Executor; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * {@link CronetEngine} that exposes experimental features. To obtain an | 19 * {@link CronetEngine} that exposes experimental features. To obtain an |
| 19 * instance of this class, cast a {@code CronetEngine} to this type. Every | 20 * instance of this class, cast a {@code CronetEngine} to this type. Every |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 * computed by the network quality estimator. Set to | 428 * computed by the network quality estimator. Set to |
| 428 * {@link #CONNECTION_METRIC_UNKNOWN} if the value is | 429 * {@link #CONNECTION_METRIC_UNKNOWN} if the value is |
| 429 * unavailable. This must be called after | 430 * unavailable. This must be called after |
| 430 * {@link Builder#enableNetworkQualityEstimator}, and will | 431 * {@link Builder#enableNetworkQualityEstimator}, and will |
| 431 * throw an exception otherwise. | 432 * throw an exception otherwise. |
| 432 * @return Estimate of the downstream throughput in kilobits per second. | 433 * @return Estimate of the downstream throughput in kilobits per second. |
| 433 */ | 434 */ |
| 434 public int getDownstreamThroughputKbps() { | 435 public int getDownstreamThroughputKbps() { |
| 435 return CONNECTION_METRIC_UNKNOWN; | 436 return CONNECTION_METRIC_UNKNOWN; |
| 436 } | 437 } |
| 438 |
| 439 /** |
| 440 * Put an entry for a host in the host resolver cache. This can save time |
| 441 * when making requests to this host in the future by avoiding having to |
| 442 * resolve the host. |
| 443 * <p> |
| 444 * <b>Caveats:</b> |
| 445 * <ul> |
| 446 * <li>Only add trustworthy entries. Incorrect entries can provoke |
| 447 * security vulnerabilities like man-in-the-middle attacks when SSL/TLS |
| 448 * is not used.</li> |
| 449 * <li>Putting an entry in the cache evicts any previously existing entry |
| 450 * for the host.</li> |
| 451 * <li>Hosts can resolve to different IP addresses accessible with varying |
| 452 * latencies. An entry placed in the cache accessible with high latency, |
| 453 * e.g. a far away server, can harm performance if normal host |
| 454 * resolution would have provided more optimal results, e.g. the address |
| 455 * of a nearby server.</li> |
| 456 * <li>The entry may be purged from the cache prior to the given lifetime |
| 457 * when certain events happen, for example if the default network |
| 458 * connection changes.</li> |
| 459 * </ul> |
| 460 * @param hostName the name of the host to add an entry for. |
| 461 * @param addresses the list of addresses to add for the host. |
| 462 * @param secondsToLive the maximum number of seconds this entry should live |
| 463 * in the cache. |
| 464 */ |
| 465 public void putHostCache(String hostName, InetAddress[] addresses, int secon
dsToLive) {} |
| 437 } | 466 } |
| OLD | NEW |