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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.net.http.HttpResponseCache; | 9 import android.net.http.HttpResponseCache; |
| 10 import android.support.annotation.IntDef; | 10 import android.support.annotation.IntDef; |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 cronetEngine = new JavaCronetEngine(getUserAgent()); | 773 cronetEngine = new JavaCronetEngine(getUserAgent()); |
| 774 } | 774 } |
| 775 Log.i(TAG, "Using network stack: " + cronetEngine.getVersionString() ); | 775 Log.i(TAG, "Using network stack: " + cronetEngine.getVersionString() ); |
| 776 // Clear MOCK_CERT_VERIFIER reference if there is any, since | 776 // Clear MOCK_CERT_VERIFIER reference if there is any, since |
| 777 // the ownership has been transferred to the engine. | 777 // the ownership has been transferred to the engine. |
| 778 mMockCertVerifier = 0; | 778 mMockCertVerifier = 0; |
| 779 return cronetEngine; | 779 return cronetEngine; |
| 780 } | 780 } |
| 781 } | 781 } |
| 782 | 782 |
| 783 /** | |
| 784 * RTT and throughput estimates are set to {@link INVALID_RTT_THROUGHPUT} if | |
| 785 * a valid value is unavailable, | |
|
mgersh
2016/10/17 16:53:09
nit: comma should be period
tbansal1
2016/10/17 19:20:57
Done.
| |
| 786 */ | |
| 787 public static final int INVALID_RTT_THROUGHPUT = -1; | |
| 788 | |
| 783 private static final String TAG = "UrlRequestFactory"; | 789 private static final String TAG = "UrlRequestFactory"; |
| 784 private static final String CRONET_URL_REQUEST_CONTEXT = | 790 private static final String CRONET_URL_REQUEST_CONTEXT = |
| 785 "org.chromium.net.impl.CronetUrlRequestContext"; | 791 "org.chromium.net.impl.CronetUrlRequestContext"; |
| 786 | 792 |
| 787 /** | 793 /** |
| 788 * Creates a {@link UrlRequest} object. All callbacks will | 794 * Creates a {@link UrlRequest} object. All callbacks will |
| 789 * be called on {@code executor}'s thread. {@code executor} must not run | 795 * be called on {@code executor}'s thread. {@code executor} must not run |
| 790 * tasks on the current thread to prevent blocking networking operations | 796 * tasks on the current thread to prevent blocking networking operations |
| 791 * and causing exceptions during shutdown. Request is given medium priority, | 797 * and causing exceptions during shutdown. Request is given medium priority, |
| 792 * see {@link UrlRequest.Builder#REQUEST_PRIORITY_MEDIUM}. To specify other | 798 * see {@link UrlRequest.Builder#REQUEST_PRIORITY_MEDIUM}. To specify other |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 public abstract byte[] getGlobalMetricsDeltas(); | 992 public abstract byte[] getGlobalMetricsDeltas(); |
| 987 | 993 |
| 988 /** | 994 /** |
| 989 * Returns the effective connection type computed by the network quality | 995 * Returns the effective connection type computed by the network quality |
| 990 * estimator. | 996 * estimator. |
| 991 * @hide as it's a prototype. | 997 * @hide as it's a prototype. |
| 992 */ | 998 */ |
| 993 public abstract int getEffectiveConnectionType(); | 999 public abstract int getEffectiveConnectionType(); |
| 994 | 1000 |
| 995 /** | 1001 /** |
| 1002 * Returns the HTTP RTT estimate (in milliseconds) computed by the network | |
| 1003 * quality estimator. Set to {@link INVALID_RTT_THROUGHPUT} if a valid value | |
|
mgersh
2016/10/17 16:53:09
This javadoc and the others could mention that you
tbansal1
2016/10/17 19:20:57
Done.
| |
| 1004 * is unavailable. | |
| 1005 * @hide as it's a prototype. | |
| 1006 * @return Estimate of the HTTP RTT in milliseconds. | |
| 1007 */ | |
| 1008 public abstract int getHttpRttMsec(); | |
|
mgersh
2016/10/17 16:53:09
Elsewhere in Cronet we use Ms, not Msec. Let's cha
tbansal1
2016/10/17 19:20:57
Done.
| |
| 1009 | |
| 1010 /** | |
| 1011 * Returns the transport RTT estimate (in milliseconds) computed by the | |
| 1012 * network quality estimator. Set to {@link INVALID_RTT_THROUGHPUT} if a | |
| 1013 * valid value is unavailable. | |
| 1014 * @hide as it's a prototype. | |
| 1015 * @return Estimate of the transport RTT in milliseconds. | |
| 1016 */ | |
| 1017 public abstract int getTransportRttMsec(); | |
|
mgersh
2016/10/17 16:53:09
same as above: Msec -> Ms
tbansal1
2016/10/17 19:20:57
Done.
| |
| 1018 | |
| 1019 /** | |
| 1020 * Returns the downstream throughput estimate (in kilobits per second) | |
| 1021 * computed by the network quality estimator. Set to | |
| 1022 * {@link INVALID_RTT_THROUGHPUT} if a valid value is unavailable. | |
| 1023 * @hide as it's a prototype. | |
| 1024 * @return Estimate of the downstream throughput in kilobits per second. | |
| 1025 */ | |
| 1026 public abstract int getDownstreamThroughputKbps(); | |
| 1027 | |
| 1028 /** | |
| 996 * Configures the network quality estimator for testing. This must be called | 1029 * Configures the network quality estimator for testing. This must be called |
| 997 * before round trip time and throughput listeners are added, and after the | 1030 * before round trip time and throughput listeners are added, and after the |
| 998 * network quality estimator has been enabled. | 1031 * network quality estimator has been enabled. |
| 999 * @param useLocalHostRequests include requests to localhost in estimates. | 1032 * @param useLocalHostRequests include requests to localhost in estimates. |
| 1000 * @param useSmallerResponses include small responses in throughput | 1033 * @param useSmallerResponses include small responses in throughput |
| 1001 * estimates. | 1034 * estimates. |
| 1002 * @hide as it's a prototype. | 1035 * @hide as it's a prototype. |
| 1003 */ | 1036 */ |
| 1004 public abstract void configureNetworkQualityEstimatorForTesting( | 1037 public abstract void configureNetworkQualityEstimatorForTesting( |
| 1005 boolean useLocalHostRequests, boolean useSmallerResponses); | 1038 boolean useLocalHostRequests, boolean useSmallerResponses); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1164 * | 1197 * |
| 1165 * @param url URL for the generated requests. | 1198 * @param url URL for the generated requests. |
| 1166 * @param callback callback object that gets invoked on different events. | 1199 * @param callback callback object that gets invoked on different events. |
| 1167 * @param executor {@link Executor} on which all callbacks will be invoked. | 1200 * @param executor {@link Executor} on which all callbacks will be invoked. |
| 1168 */ | 1201 */ |
| 1169 public UrlRequest.Builder newUrlRequestBuilder( | 1202 public UrlRequest.Builder newUrlRequestBuilder( |
| 1170 String url, UrlRequest.Callback callback, Executor executor) { | 1203 String url, UrlRequest.Callback callback, Executor executor) { |
| 1171 return new UrlRequest.Builder(url, callback, executor, this); | 1204 return new UrlRequest.Builder(url, callback, executor, this); |
| 1172 } | 1205 } |
| 1173 } | 1206 } |
| OLD | NEW |