| 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 * be called on {@code executor}'s thread. {@code executor} must not run | 831 * be called on {@code executor}'s thread. {@code executor} must not run |
| 832 * tasks on the current thread to prevent blocking networking operations | 832 * tasks on the current thread to prevent blocking networking operations |
| 833 * and causing exceptions during shutdown. | 833 * and causing exceptions during shutdown. |
| 834 * | 834 * |
| 835 * @param url {@link URL} for the request. | 835 * @param url {@link URL} for the request. |
| 836 * @param callback callback object that gets invoked on different events. | 836 * @param callback callback object that gets invoked on different events. |
| 837 * @param executor {@link Executor} on which all callbacks will be invoked. | 837 * @param executor {@link Executor} on which all callbacks will be invoked. |
| 838 * @param priority priority of the request which should be one of the | 838 * @param priority priority of the request which should be one of the |
| 839 * {@link UrlRequest.Builder#REQUEST_PRIORITY_IDLE REQUEST_PRIORITY_
*} | 839 * {@link UrlRequest.Builder#REQUEST_PRIORITY_IDLE REQUEST_PRIORITY_
*} |
| 840 * values. | 840 * values. |
| 841 * @param requestAnnotations Objects to pass on to {@link CronetEngine.Reque
stFinishedListener}. | 841 * @param requestAnnotations Objects to pass on to {@link RequestFinishedLis
tener}. |
| 842 * @param disableCache disables cache for the request. | 842 * @param disableCache disables cache for the request. |
| 843 * If context is not set up to use cache this param has no effect. | 843 * If context is not set up to use cache this param has no effect. |
| 844 * @param disableConnectionMigration disables connection migration for this | 844 * @param disableConnectionMigration disables connection migration for this |
| 845 * request if it is enabled for the session. | 845 * request if it is enabled for the session. |
| 846 * @return new request. | 846 * @return new request. |
| 847 * @deprecated Use {@link UrlRequest.Builder#build}. | 847 * @deprecated Use {@link UrlRequest.Builder#build}. |
| 848 * @hide as it references hidden CronetEngine.RequestFinishedListener | 848 * @hide as it references hidden RequestFinishedListener |
| 849 */ | 849 */ |
| 850 @Deprecated | 850 @Deprecated |
| 851 protected abstract UrlRequest createRequest(String url, UrlRequest.Callback
callback, | 851 protected abstract UrlRequest createRequest(String url, UrlRequest.Callback
callback, |
| 852 Executor executor, int priority, Collection<Object> requestAnnotatio
ns, | 852 Executor executor, int priority, Collection<Object> requestAnnotatio
ns, |
| 853 boolean disableCache, boolean disableConnectionMigration); | 853 boolean disableCache, boolean disableConnectionMigration); |
| 854 | 854 |
| 855 /** | 855 /** |
| 856 * Creates a {@link BidirectionalStream} object. {@code callback} methods wi
ll | 856 * Creates a {@link BidirectionalStream} object. {@code callback} methods wi
ll |
| 857 * be invoked on {@code executor}. {@code executor} must not run | 857 * be invoked on {@code executor}. {@code executor} must not run |
| 858 * tasks on the current thread to prevent blocking networking operations | 858 * tasks on the current thread to prevent blocking networking operations |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 /** | 1263 /** |
| 1264 * Returns total bytes received over the network transport layer, or nul
l if not collected. | 1264 * Returns total bytes received over the network transport layer, or nul
l if not collected. |
| 1265 */ | 1265 */ |
| 1266 @Nullable | 1266 @Nullable |
| 1267 public Long getReceivedBytesCount() { | 1267 public Long getReceivedBytesCount() { |
| 1268 return mReceivedBytesCount; | 1268 return mReceivedBytesCount; |
| 1269 } | 1269 } |
| 1270 } | 1270 } |
| 1271 | |
| 1272 /** | |
| 1273 * Interface to listen for finished requests that were created via this Cron
etEngine instance. | |
| 1274 * | |
| 1275 * TODO(tbansal): http://crbug.com/618034 Remove this API, and replace it w
ith a listener | |
| 1276 * whose executor is bound to the lifetime of the listener. | |
| 1277 * @hide as it's a prototype. | |
| 1278 */ | |
| 1279 public interface RequestFinishedListener { | |
| 1280 /** | |
| 1281 * Invoked with request info. | |
| 1282 * @param requestInfo {@link UrlRequestInfo} for finished request. | |
| 1283 */ | |
| 1284 void onRequestFinished(UrlRequestInfo requestInfo); | |
| 1285 } | |
| 1286 } | 1271 } |
| OLD | NEW |