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..81c49cf70fb502b5aa6754ccf1ee32b07312b6f8 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,34 @@ public class HttpUrlRequestFactoryConfig { |
} |
/** |
+ * Explicitly mark |server| as supporting QUIC. |
+ * Note that enableHttpCache(DISK) is needed to take advantage of 0-RTT |
+ * connection establishment between sessions. |
+ * |
+ * @param server URL of the server that supports QUIC. |
+ * @param alternatePort to use for QUIC. |
+ */ |
+ public HttpUrlRequestFactoryConfig addQuicHint(String server, |
Ryan Hamilton
2014/09/15 18:29:44
Do you expect callers will effectively hard-code c
mef
2014/09/15 21:01:01
Done.
|
+ 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() { |