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

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

Issue 2069303002: Add new Cronet exception class for QUIC errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch to using NetError Created 4 years, 5 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; 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
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 UrlRequestException requestError;
651 "Exception in CronetUrlRequest: " + errorString, errorCode, nati veError); 651 if (nativeError == NetError.ERR_QUIC_PROTOCOL_ERROR) {
652 requestError = new QuicException(
pauljensen 2016/06/30 17:35:12 I don't think we need the requestError variable he
mgersh 2016/06/30 22:55:53 Done.
653 "Exception in CronetUrlRequest: " + errorString, nativeError , nativeQuicError);
654 } else {
655 requestError = new UrlRequestException(
656 "Exception in CronetUrlRequest: " + errorString, errorCode, nativeError);
657 }
652 failWithException(requestError); 658 failWithException(requestError);
653 } 659 }
654 660
655 /** 661 /**
656 * Called when request is canceled, no callbacks will be called afterwards. 662 * Called when request is canceled, no callbacks will be called afterwards.
657 */ 663 */
658 @SuppressWarnings("unused") 664 @SuppressWarnings("unused")
659 @CalledByNative 665 @CalledByNative
660 private void onCanceled() { 666 private void onCanceled() {
661 Runnable task = new Runnable() { 667 Runnable task = new Runnable() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 @NativeClassQualifiedName("CronetURLRequestAdapter") 751 @NativeClassQualifiedName("CronetURLRequestAdapter")
746 private native boolean nativeReadData(long nativePtr, ByteBuffer byteBuffer, 752 private native boolean nativeReadData(long nativePtr, ByteBuffer byteBuffer,
747 int position, int capacity); 753 int position, int capacity);
748 754
749 @NativeClassQualifiedName("CronetURLRequestAdapter") 755 @NativeClassQualifiedName("CronetURLRequestAdapter")
750 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); 756 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled);
751 757
752 @NativeClassQualifiedName("CronetURLRequestAdapter") 758 @NativeClassQualifiedName("CronetURLRequestAdapter")
753 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener); 759 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener);
754 } 760 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698