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..872275a24102414a1f41ad50efb44f17cce9152e 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,33 @@ public class HttpUrlRequestFactoryConfig { |
| } |
| /** |
| + * Explicitly mark |server| as supporting QUIC. |
| + * Note that enableHttpCache(DISK) is needed to take advantage or 0-RTT. |
|
mmenke
2014/09/09 14:53:35
nit: or -> of.
Also, maybe add "0-RTT connection
mef
2014/09/10 16:48:18
Done.
|
| + * |
| + * @param server URL of the server that supports QUIC |
| + * @param alternatePort to use for QUIC |
|
mmenke
2014/09/09 14:53:35
nit: End comments with periods.
mef
2014/09/10 16:48:18
Done.
|
| + */ |
| + public HttpUrlRequestFactoryConfig addQuicHint(String server, |
| + 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_SERVER, server); |
| + 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() { |