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 | |
|
pauljensen
2015/10/30 18:05:23
change semicolon to period?
xunjieli
2015/10/30 18:30:57
Done.
| |
| 323 * experiment is encoded as a JSON object with option name as the key | |
|
pauljensen
2015/10/30 18:05:23
remove "for an experiment"
pauljensen
2015/10/30 18:05:23
is->are
xunjieli
2015/10/30 18:30:57
Done.
xunjieli
2015/10/30 18:30:57
Done.
| |
| 324 * and option value as the value: | |
| 325 * <pre> | |
| 326 * {"experiment1": {"option1": "option_value1", "option2": | |
| 327 * "option_value2", ...}, "experiment2: {"option3", "option_value3", | |
| 328 * ...}, ...} | |
| 329 * </pre> | |
| 330 * Here's an example to set QUIC connection options using this method: | |
|
pauljensen
2015/10/30 18:05:23
I don't think we want specific examples in our pub
xunjieli
2015/10/30 18:30:57
Done.
| |
| 331 * <pre> | |
| 332 * {@code | |
| 333 * JSONObject quicParams = new JSONObject().put("connection_options", | |
| 334 * "PACE,IW10,FOO,DEADBEEF"); | |
| 335 * JSONObject experimentalOptions = new JSONObject().put("QUIC", | |
| 336 * quicParams); | |
| 337 * builder.setExperimentalOptions(experimentalOptions.toString()); | |
| 338 * } | |
| 339 * </pre> | |
| 340 * @param experimentalOptions experimental options as a JSON formatted | |
| 341 * string | |
| 323 */ | 342 */ |
| 324 public Builder setExperimentalQuicConnectionOptions(String quicConnectio nOptions) { | 343 public Builder setExperimentalOptions(String experimentalOptions) { |
| 325 return putString(CronetEngineBuilderList.QUIC_OPTIONS, quicConnectio nOptions); | 344 return putString(CronetEngineBuilderList.EXPERIMENTAL_OPTIONS, exper imentalOptions); |
| 326 } | 345 } |
| 327 | 346 |
| 328 /** | 347 /** |
| 329 * Sets a native MockCertVerifier for testing. | 348 * Sets a native MockCertVerifier for testing. |
| 330 */ | 349 */ |
| 331 Builder setMockCertVerifierForTesting(long mockCertVerifier) { | 350 Builder setMockCertVerifierForTesting(long mockCertVerifier) { |
| 332 return putString( | 351 return putString( |
| 333 CronetEngineBuilderList.MOCK_CERT_VERIFIER, String.valueOf(m ockCertVerifier)); | 352 CronetEngineBuilderList.MOCK_CERT_VERIFIER, String.valueOf(m ockCertVerifier)); |
| 334 } | 353 } |
| 335 | 354 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 cronetEngine = possibleEngine; | 694 cronetEngine = possibleEngine; |
| 676 } | 695 } |
| 677 } catch (ClassNotFoundException e) { | 696 } catch (ClassNotFoundException e) { |
| 678 // Leave as null. | 697 // Leave as null. |
| 679 } catch (Exception e) { | 698 } catch (Exception e) { |
| 680 throw new IllegalStateException("Cannot instantiate: " + CRONET_URL_ REQUEST_CONTEXT, e); | 699 throw new IllegalStateException("Cannot instantiate: " + CRONET_URL_ REQUEST_CONTEXT, e); |
| 681 } | 700 } |
| 682 return cronetEngine; | 701 return cronetEngine; |
| 683 } | 702 } |
| 684 } | 703 } |
| OLD | NEW |