| OLD | NEW |
| 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; | 5 package org.chromium.net; |
| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 * Called when error has occured, no callbacks will be called afterwards. | 634 * Called when error has occured, no callbacks will be called afterwards. |
| 635 * | 635 * |
| 636 * @param errorCode error code from {@link UrlRequestException.ERROR_LISTENE
R_EXCEPTION_THROWN | 636 * @param errorCode error code from {@link UrlRequestException.ERROR_LISTENE
R_EXCEPTION_THROWN |
| 637 * UrlRequestException.ERROR_*}. | 637 * UrlRequestException.ERROR_*}. |
| 638 * @param nativeError native net error code. | 638 * @param nativeError native net error code. |
| 639 * @param errorString textual representation of the error code. | 639 * @param errorString textual representation of the error code. |
| 640 * @param receivedBytesCount number of bytes received. | 640 * @param receivedBytesCount number of bytes received. |
| 641 */ | 641 */ |
| 642 @SuppressWarnings("unused") | 642 @SuppressWarnings("unused") |
| 643 @CalledByNative | 643 @CalledByNative |
| 644 private void onError( | 644 private void onError(int errorCode, int nativeError, int nativeErrorDetails,
String errorString, |
| 645 int errorCode, int nativeError, String errorString, long receivedByt
esCount) { | 645 long receivedBytesCount) { |
| 646 if (mResponseInfo != null) { | 646 if (mResponseInfo != null) { |
| 647 mResponseInfo.setReceivedBytesCount( | 647 mResponseInfo.setReceivedBytesCount( |
| 648 mReceivedBytesCountFromRedirects + receivedBytesCount); | 648 mReceivedBytesCountFromRedirects + receivedBytesCount); |
| 649 } | 649 } |
| 650 UrlRequestException requestError = new UrlRequestException( | 650 UrlRequestException requestError = |
| 651 "Exception in CronetUrlRequest: " + errorString, errorCode, nati
veError); | 651 new UrlRequestException("Exception in CronetUrlRequest: " + erro
rString, errorCode, |
| 652 nativeError, nativeErrorDetails); |
| 652 failWithException(requestError); | 653 failWithException(requestError); |
| 653 } | 654 } |
| 654 | 655 |
| 655 /** | 656 /** |
| 656 * Called when request is canceled, no callbacks will be called afterwards. | 657 * Called when request is canceled, no callbacks will be called afterwards. |
| 657 */ | 658 */ |
| 658 @SuppressWarnings("unused") | 659 @SuppressWarnings("unused") |
| 659 @CalledByNative | 660 @CalledByNative |
| 660 private void onCanceled() { | 661 private void onCanceled() { |
| 661 Runnable task = new Runnable() { | 662 Runnable task = new Runnable() { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 @NativeClassQualifiedName("CronetURLRequestAdapter") | 746 @NativeClassQualifiedName("CronetURLRequestAdapter") |
| 746 private native boolean nativeReadData(long nativePtr, ByteBuffer byteBuffer, | 747 private native boolean nativeReadData(long nativePtr, ByteBuffer byteBuffer, |
| 747 int position, int capacity); | 748 int position, int capacity); |
| 748 | 749 |
| 749 @NativeClassQualifiedName("CronetURLRequestAdapter") | 750 @NativeClassQualifiedName("CronetURLRequestAdapter") |
| 750 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 751 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
| 751 | 752 |
| 752 @NativeClassQualifiedName("CronetURLRequestAdapter") | 753 @NativeClassQualifiedName("CronetURLRequestAdapter") |
| 753 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene
r listener); | 754 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene
r listener); |
| 754 } | 755 } |
| OLD | NEW |