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

Side by Side Diff: components/cronet/android/java/src/org/chromium/net/CronetBidirectionalStream.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 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 CronetBidirectionalStream.this, mResponseInfo, trail ersBlock); 548 CronetBidirectionalStream.this, mResponseInfo, trail ersBlock);
549 } catch (Exception e) { 549 } catch (Exception e) {
550 onCallbackException(e); 550 onCallbackException(e);
551 } 551 }
552 } 552 }
553 }); 553 });
554 } 554 }
555 555
556 @SuppressWarnings("unused") 556 @SuppressWarnings("unused")
557 @CalledByNative 557 @CalledByNative
558 private void onError( 558 private void onError(int errorCode, int nativeError, int nativeQuicError, St ring errorString,
559 int errorCode, int nativeError, String errorString, long receivedByt esCount) { 559 long receivedBytesCount) {
560 if (mResponseInfo != null) { 560 if (mResponseInfo != null) {
561 mResponseInfo.setReceivedBytesCount(receivedBytesCount); 561 mResponseInfo.setReceivedBytesCount(receivedBytesCount);
562 } 562 }
563 failWithException(new CronetException( 563 CronetException exception;
564 "Exception in BidirectionalStream: " + errorString, errorCode, n ativeError)); 564 if (nativeError == NetError.ERR_QUIC_PROTOCOL_ERROR) {
565 // nativeQuicError here will always be 0 (QUIC_NO_ERROR), so this is n't useful yet.
566 // Adding it now anyway for uniformity with CronetUrlRequest.
567 // TODO(mgersh): plumb through the real QUIC error code
pauljensen 2016/06/30 17:35:12 I'm not a fan of having a comment in one place tal
mgersh 2016/06/30 22:55:53 Done.
568 exception = new QuicException("Exception in BidirectionalStream: " + errorString,
569 nativeError, nativeQuicError);
570 } else {
571 exception = new CronetException(
572 "Exception in BidirectionalStream: " + errorString, errorCod e, nativeError);
573 }
574 failWithException(exception);
565 } 575 }
566 576
567 /** 577 /**
568 * Called when request is canceled, no callbacks will be called afterwards. 578 * Called when request is canceled, no callbacks will be called afterwards.
569 */ 579 */
570 @SuppressWarnings("unused") 580 @SuppressWarnings("unused")
571 @CalledByNative 581 @CalledByNative
572 private void onCanceled() { 582 private void onCanceled() {
573 postTaskToExecutor(new Runnable() { 583 postTaskToExecutor(new Runnable() {
574 public void run() { 584 public void run() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 private native boolean nativeReadData( 736 private native boolean nativeReadData(
727 long nativePtr, ByteBuffer byteBuffer, int position, int limit); 737 long nativePtr, ByteBuffer byteBuffer, int position, int limit);
728 738
729 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") 739 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter")
730 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers , int[] positions, 740 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers , int[] positions,
731 int[] limits, boolean endOfStream); 741 int[] limits, boolean endOfStream);
732 742
733 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") 743 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter")
734 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); 744 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled);
735 } 745 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698