| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |