| 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 nativeQuicError, St
ring 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 if (errorCode == UrlRequestException.ERROR_QUIC_PROTOCOL_FAILED) { |
| 651 "Exception in CronetUrlRequest: " + errorString, errorCode, nati
veError); | 651 failWithException(new QuicException( |
| 652 failWithException(requestError); | 652 "Exception in CronetUrlRequest: " + errorString, nativeError
, nativeQuicError)); |
| 653 } else { |
| 654 failWithException(new UrlRequestException( |
| 655 "Exception in CronetUrlRequest: " + errorString, errorCode,
nativeError)); |
| 656 } |
| 653 } | 657 } |
| 654 | 658 |
| 655 /** | 659 /** |
| 656 * Called when request is canceled, no callbacks will be called afterwards. | 660 * Called when request is canceled, no callbacks will be called afterwards. |
| 657 */ | 661 */ |
| 658 @SuppressWarnings("unused") | 662 @SuppressWarnings("unused") |
| 659 @CalledByNative | 663 @CalledByNative |
| 660 private void onCanceled() { | 664 private void onCanceled() { |
| 661 Runnable task = new Runnable() { | 665 Runnable task = new Runnable() { |
| 662 @Override | 666 @Override |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 @NativeClassQualifiedName("CronetURLRequestAdapter") | 749 @NativeClassQualifiedName("CronetURLRequestAdapter") |
| 746 private native boolean nativeReadData(long nativePtr, ByteBuffer byteBuffer, | 750 private native boolean nativeReadData(long nativePtr, ByteBuffer byteBuffer, |
| 747 int position, int capacity); | 751 int position, int capacity); |
| 748 | 752 |
| 749 @NativeClassQualifiedName("CronetURLRequestAdapter") | 753 @NativeClassQualifiedName("CronetURLRequestAdapter") |
| 750 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 754 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
| 751 | 755 |
| 752 @NativeClassQualifiedName("CronetURLRequestAdapter") | 756 @NativeClassQualifiedName("CronetURLRequestAdapter") |
| 753 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene
r listener); | 757 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene
r listener); |
| 754 } | 758 } |
| OLD | NEW |