Chromium Code Reviews| 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 CronetException exception; |
| 564 "Exception in BidirectionalStream: " + errorString, errorCode, n ativeError)); | 564 if (nativeError == UrlRequestException.QUIC_PROTOCOL_ERROR) { |
|
xunjieli
2016/06/30 14:13:43
Can reuse NetError.ERR_QUIC_PROTOCOL_ERROR.
mgersh
2016/06/30 16:50:53
Done.
| |
| 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 | |
| 568 exception = new QuicException( | |
| 569 "Exception in BidirectionalStream: " + errorString, nativeQu icError); | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |