Chromium Code Reviews| Index: components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java |
| diff --git a/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java b/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java |
| index 913bae8585e2037268fbb02a54e9bdb6fd285244..7607cf569a40d20106989c8d5043c9ecd87a455b 100644 |
| --- a/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java |
| +++ b/components/cronet/android/java/src/org/chromium/net/HttpUrlRequestFactoryConfig.java |
| @@ -4,6 +4,7 @@ |
| package org.chromium.net; |
| +import org.json.JSONArray; |
| import org.json.JSONException; |
| import org.json.JSONObject; |
| @@ -86,6 +87,37 @@ public class HttpUrlRequestFactoryConfig { |
| } |
| /** |
| + * Explicitly mark |host| as supporting QUIC. |
| + * Note that enableHttpCache(DISK) is needed to take advantage of 0-RTT |
| + * connection establishment between sessions. |
| + * |
| + * @param host Name of the server that supports QUIC. |
| + * @param port port of the server that supports QUIC. |
|
mmenke
2014/09/16 01:51:38
nit: Port
mef
2014/09/16 08:44:14
Done.
|
| + * @param alternatePort to use for QUIC. |
|
mmenke
2014/09/16 01:51:38
Should probably be consistent here: Either use th
mef
2014/09/16 08:44:14
Done.
|
| + */ |
| + public HttpUrlRequestFactoryConfig addQuicHint(String host, |
| + int port, |
| + int alternatePort) { |
| + try { |
| + JSONArray quicHints = mConfig.optJSONArray( |
| + UrlRequestContextConfig.QUIC_HINTS); |
| + if (quicHints == null) { |
| + quicHints = new JSONArray(); |
| + mConfig.put(UrlRequestContextConfig.QUIC_HINTS, quicHints); |
| + } |
| + |
| + JSONObject hint = new JSONObject(); |
| + hint.put(UrlRequestContextConfig.QUIC_HINT_HOST, host); |
| + hint.put(UrlRequestContextConfig.QUIC_HINT_PORT, port); |
| + hint.put(UrlRequestContextConfig.QUIC_HINT_ALT_PORT, alternatePort); |
| + quicHints.put(hint); |
| + } catch (JSONException e) { |
| + ; |
| + } |
| + return this; |
| + } |
| + |
| + /** |
| * Get JSON string representation of the config. |
| */ |
| public String toString() { |