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

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

Issue 2137133002: Add new Cronet exception class for QUIC errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: 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 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 org.chromium.base.Log; 7 import org.chromium.base.Log;
8 import org.chromium.base.VisibleForTesting; 8 import org.chromium.base.VisibleForTesting;
9 import org.chromium.base.annotations.CalledByNative; 9 import org.chromium.base.annotations.CalledByNative;
10 import org.chromium.base.annotations.JNINamespace; 10 import org.chromium.base.annotations.JNINamespace;
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 CronetBidirectionalStream.this, mResponseInfo, trail ersBlock); 575 CronetBidirectionalStream.this, mResponseInfo, trail ersBlock);
576 } catch (Exception e) { 576 } catch (Exception e) {
577 onCallbackException(e); 577 onCallbackException(e);
578 } 578 }
579 } 579 }
580 }); 580 });
581 } 581 }
582 582
583 @SuppressWarnings("unused") 583 @SuppressWarnings("unused")
584 @CalledByNative 584 @CalledByNative
585 private void onError( 585 private void onError(int errorCode, int nativeError, int nativeQuicError, St ring errorString,
586 int errorCode, int nativeError, String errorString, long receivedByt esCount) { 586 long receivedBytesCount) {
587 if (mResponseInfo != null) { 587 if (mResponseInfo != null) {
588 mResponseInfo.setReceivedBytesCount(receivedBytesCount); 588 mResponseInfo.setReceivedBytesCount(receivedBytesCount);
589 } 589 }
590 failWithException(new CronetException( 590 if (errorCode == UrlRequestException.ERROR_QUIC_PROTOCOL_FAILED) {
591 "Exception in BidirectionalStream: " + errorString, errorCode, n ativeError)); 591 failWithException(new QuicException("Exception in BidirectionalStrea m: " + errorString,
592 nativeError, nativeQuicError));
593 } else {
594 failWithException(new CronetException(
595 "Exception in BidirectionalStream: " + errorString, errorCod e, nativeError));
596 }
592 } 597 }
593 598
594 /** 599 /**
595 * Called when request is canceled, no callbacks will be called afterwards. 600 * Called when request is canceled, no callbacks will be called afterwards.
596 */ 601 */
597 @SuppressWarnings("unused") 602 @SuppressWarnings("unused")
598 @CalledByNative 603 @CalledByNative
599 private void onCanceled() { 604 private void onCanceled() {
600 postTaskToExecutor(new Runnable() { 605 postTaskToExecutor(new Runnable() {
601 public void run() { 606 public void run() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 private native boolean nativeReadData( 758 private native boolean nativeReadData(
754 long nativePtr, ByteBuffer byteBuffer, int position, int limit); 759 long nativePtr, ByteBuffer byteBuffer, int position, int limit);
755 760
756 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") 761 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter")
757 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers , int[] positions, 762 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers , int[] positions,
758 int[] limits, boolean endOfStream); 763 int[] limits, boolean endOfStream);
759 764
760 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") 765 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter")
761 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); 766 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled);
762 } 767 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698