Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
| 5 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.support.annotation.IntDef; | 8 import android.support.annotation.IntDef; |
| 9 import android.util.Log; | 9 import android.util.Log; |
| 10 | 10 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 hint.put(CronetEngineBuilderList.QUIC_HINT_PORT, port); | 307 hint.put(CronetEngineBuilderList.QUIC_HINT_PORT, port); |
| 308 hint.put(CronetEngineBuilderList.QUIC_HINT_ALT_PORT, alternatePo rt); | 308 hint.put(CronetEngineBuilderList.QUIC_HINT_ALT_PORT, alternatePo rt); |
| 309 quicHints.put(hint); | 309 quicHints.put(hint); |
| 310 } catch (JSONException e) { | 310 } catch (JSONException e) { |
| 311 // Intentionally do nothing. | 311 // Intentionally do nothing. |
| 312 } | 312 } |
| 313 return this; | 313 return this; |
| 314 } | 314 } |
| 315 | 315 |
| 316 /** | 316 /** |
| 317 * Sets experimental QUIC connection options, overwriting any pre-existi ng | 317 * Sets experimental options to be used in Cronet. |
| 318 * options. List of options is subject to change. | |
| 319 * | 318 * |
| 320 * @param quicConnectionOptions comma-separated QUIC options (for exampl e | 319 * Experimental options encoded as a string in a JSON format containing |
| 321 * "PACE,IW10") to use if QUIC is enabled. | 320 * experiments and their corresponding configuration options. The format |
| 322 * @return the builder to facilitate chaining. | 321 * is a JSON object with the name of the experiment as the key, and |
| 322 * experiment options as the value. The experiment options for an | |
| 323 * experiment is encoded as a JSON object with option name as the key | |
| 324 * and option value as the value: | |
| 325 * {"experiment1": {"option1": "option_value1", "option2": | |
| 326 * "option_value2", ...}, "experiment2: {"option3", "option_value3", | |
| 327 * ...}, ...} | |
|
mef
2015/10/30 17:15:41
Maybe add an example of how existing quicConnectio
xunjieli
2015/10/30 17:44:48
Done. Yes, that is right.
| |
| 328 * | |
| 329 * @param experimentalOptions experimental options as a JSON formatted | |
| 330 * string | |
| 323 */ | 331 */ |
| 324 public Builder setExperimentalQuicConnectionOptions(String quicConnectio nOptions) { | 332 public Builder setExperimentalOptions(String experimentalOptions) { |
| 325 return putString(CronetEngineBuilderList.QUIC_OPTIONS, quicConnectio nOptions); | 333 return putString(CronetEngineBuilderList.EXPERIMENTAL_OPTIONS, exper imentalOptions); |
| 326 } | 334 } |
| 327 | 335 |
| 328 /** | 336 /** |
| 329 * Sets a native MockCertVerifier for testing. | 337 * Sets a native MockCertVerifier for testing. |
| 330 */ | 338 */ |
| 331 Builder setMockCertVerifierForTesting(long mockCertVerifier) { | 339 Builder setMockCertVerifierForTesting(long mockCertVerifier) { |
| 332 return putString( | 340 return putString( |
| 333 CronetEngineBuilderList.MOCK_CERT_VERIFIER, String.valueOf(m ockCertVerifier)); | 341 CronetEngineBuilderList.MOCK_CERT_VERIFIER, String.valueOf(m ockCertVerifier)); |
| 334 } | 342 } |
| 335 | 343 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 cronetEngine = possibleEngine; | 683 cronetEngine = possibleEngine; |
| 676 } | 684 } |
| 677 } catch (ClassNotFoundException e) { | 685 } catch (ClassNotFoundException e) { |
| 678 // Leave as null. | 686 // Leave as null. |
| 679 } catch (Exception e) { | 687 } catch (Exception e) { |
| 680 throw new IllegalStateException("Cannot instantiate: " + CRONET_URL_ REQUEST_CONTEXT, e); | 688 throw new IllegalStateException("Cannot instantiate: " + CRONET_URL_ REQUEST_CONTEXT, e); |
| 681 } | 689 } |
| 682 return cronetEngine; | 690 return cronetEngine; |
| 683 } | 691 } |
| 684 } | 692 } |
| OLD | NEW |