| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (errorCode == UrlRequestException.ERROR_QUIC_PROTOCOL_FAILED) { |
| 564 "Exception in BidirectionalStream: " + errorString, errorCode, n
ativeError)); | 564 failWithException(new QuicException("Exception in BidirectionalStrea
m: " + errorString, |
| 565 nativeError, nativeQuicError)); |
| 566 } else { |
| 567 failWithException(new CronetException( |
| 568 "Exception in BidirectionalStream: " + errorString, errorCod
e, nativeError)); |
| 569 } |
| 565 } | 570 } |
| 566 | 571 |
| 567 /** | 572 /** |
| 568 * Called when request is canceled, no callbacks will be called afterwards. | 573 * Called when request is canceled, no callbacks will be called afterwards. |
| 569 */ | 574 */ |
| 570 @SuppressWarnings("unused") | 575 @SuppressWarnings("unused") |
| 571 @CalledByNative | 576 @CalledByNative |
| 572 private void onCanceled() { | 577 private void onCanceled() { |
| 573 postTaskToExecutor(new Runnable() { | 578 postTaskToExecutor(new Runnable() { |
| 574 public void run() { | 579 public void run() { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 private native boolean nativeReadData( | 731 private native boolean nativeReadData( |
| 727 long nativePtr, ByteBuffer byteBuffer, int position, int limit); | 732 long nativePtr, ByteBuffer byteBuffer, int position, int limit); |
| 728 | 733 |
| 729 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 734 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 730 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers
, int[] positions, | 735 private native boolean nativeWritevData(long nativePtr, ByteBuffer[] buffers
, int[] positions, |
| 731 int[] limits, boolean endOfStream); | 736 int[] limits, boolean endOfStream); |
| 732 | 737 |
| 733 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") | 738 @NativeClassQualifiedName("CronetBidirectionalStreamAdapter") |
| 734 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); | 739 private native void nativeDestroy(long nativePtr, boolean sendOnCanceled); |
| 735 } | 740 } |
| OLD | NEW |