Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequest.java

Issue 2178053002: Change RequestFinishedListener to provide executor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more tests, other comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.impl; 5 package org.chromium.net.impl;
6 6
7 import android.os.SystemClock; 7 import android.os.SystemClock;
8 import android.support.annotation.Nullable; 8 import android.support.annotation.Nullable;
9 import android.util.Log; 9 import android.util.Log;
10 10
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 }; 485 };
486 postTaskToExecutor(task); 486 postTaskToExecutor(task);
487 } 487 }
488 488
489 //////////////////////////////////////////////// 489 ////////////////////////////////////////////////
490 // Private methods called by the native code. 490 // Private methods called by the native code.
491 // Always called on network thread. 491 // Always called on network thread.
492 //////////////////////////////////////////////// 492 ////////////////////////////////////////////////
493 493
494 /** 494 /**
495 * Called before following redirects. The redirect will automatically be 495 * Called before following redirects. The redirect will only be followed if
496 * followed, unless the request is paused or canceled during this 496 * {@link #followRedirect()} is called. If the redirect response has a body, it will be ignored.
497 * callback. If the redirect response has a body, it will be ignored.
498 * This will only be called between start and onResponseStarted. 497 * This will only be called between start and onResponseStarted.
499 * 498 *
500 * @param newLocation Location where request is redirected. 499 * @param newLocation Location where request is redirected.
501 * @param httpStatusCode from redirect response 500 * @param httpStatusCode from redirect response
502 * @param receivedBytesCount count of bytes received for redirect response 501 * @param receivedBytesCount count of bytes received for redirect response
503 * @param headers an array of response headers with keys at the even indices 502 * @param headers an array of response headers with keys at the even indices followed by the
xunjieli 2016/07/29 16:35:24 Why is this line changed? Could you revert?
mgersh 2016/07/29 18:21:52 Done.
504 * followed by the corresponding values at the odd indices. 503 * corresponding values at the odd indices.
505 */ 504 */
506 @SuppressWarnings("unused") 505 @SuppressWarnings("unused")
507 @CalledByNative 506 @CalledByNative
508 private void onRedirectReceived(final String newLocation, int httpStatusCode , 507 private void onRedirectReceived(final String newLocation, int httpStatusCode ,
509 String httpStatusText, String[] headers, boolean wasCached, String n egotiatedProtocol, 508 String httpStatusText, String[] headers, boolean wasCached, String n egotiatedProtocol,
510 String proxyServer, long receivedBytesCount) { 509 String proxyServer, long receivedBytesCount) {
511 final UrlResponseInfo responseInfo = prepareResponseInfoOnNetworkThread( httpStatusCode, 510 final UrlResponseInfo responseInfo = prepareResponseInfoOnNetworkThread( httpStatusCode,
512 httpStatusText, headers, wasCached, negotiatedProtocol, proxySer ver); 511 httpStatusText, headers, wasCached, negotiatedProtocol, proxySer ver);
513 mReceivedBytesCountFromRedirects += receivedBytesCount; 512 mReceivedBytesCountFromRedirects += receivedBytesCount;
514 responseInfo.setReceivedBytesCount(mReceivedBytesCountFromRedirects); 513 responseInfo.setReceivedBytesCount(mReceivedBytesCountFromRedirects);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 @NativeClassQualifiedName("CronetURLRequestAdapter") 757 @NativeClassQualifiedName("CronetURLRequestAdapter")
759 private native boolean nativeReadData( 758 private native boolean nativeReadData(
760 long nativePtr, ByteBuffer byteBuffer, int position, int capacity); 759 long nativePtr, ByteBuffer byteBuffer, int position, int capacity);
761 760
762 @NativeClassQualifiedName("CronetURLRequestAdapter") 761 @NativeClassQualifiedName("CronetURLRequestAdapter")
763 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); 762 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled);
764 763
765 @NativeClassQualifiedName("CronetURLRequestAdapter") 764 @NativeClassQualifiedName("CronetURLRequestAdapter")
766 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener); 765 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener);
767 } 766 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698