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

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

Issue 1393713005: [Cronet] Add error code and immediatelyRetryable() to UrlRequestException (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 android.util.Log; 7 import android.util.Log;
8 import android.util.Pair; 8 import android.util.Pair;
9 9
10 import org.chromium.base.VisibleForTesting; 10 import org.chromium.base.VisibleForTesting;
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 } 527 }
528 } 528 }
529 } 529 }
530 530
531 /** 531 /**
532 * If listener method throws an exception, request gets canceled 532 * If listener method throws an exception, request gets canceled
533 * and exception is reported via onFailed listener callback. 533 * and exception is reported via onFailed listener callback.
534 * Only called on the Executor. 534 * Only called on the Executor.
535 */ 535 */
536 private void onListenerException(Exception e) { 536 private void onListenerException(Exception e) {
537 UrlRequestException requestError = new UrlRequestException( 537 UrlRequestException requestError =
538 "CalledByNative method has thrown an exception", e); 538 new UrlRequestException("UrlRequestListener method has thrown an exception", e);
539 Log.e(CronetUrlRequestContext.LOG_TAG, 539 Log.e(CronetUrlRequestContext.LOG_TAG,
540 "Exception in CalledByNative method", e); 540 "Exception in CalledByNative method", e);
541 // Do not call into listener if request is complete. 541 // Do not call into listener if request is complete.
542 synchronized (mUrlRequestAdapterLock) { 542 synchronized (mUrlRequestAdapterLock) {
543 if (isDone()) { 543 if (isDone()) {
544 return; 544 return;
545 } 545 }
546 destroyRequestAdapter(); 546 destroyRequestAdapter();
547 } 547 }
548 try { 548 try {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 "Exception in onComplete method", e); 722 "Exception in onComplete method", e);
723 } 723 }
724 } 724 }
725 }; 725 };
726 postTaskToExecutor(task); 726 postTaskToExecutor(task);
727 } 727 }
728 728
729 /** 729 /**
730 * Called when error has occured, no callbacks will be called afterwards. 730 * Called when error has occured, no callbacks will be called afterwards.
731 * 731 *
732 * @param nativeError native net error code. 732 * @param nativeError native net error code.
xunjieli 2015/10/13 23:07:10 nit: need to add "@param errorCode" to be consiste
pauljensen 2015/11/05 18:35:28 Done.
733 * @param errorString textual representation of the error code. 733 * @param errorString textual representation of the error code.
734 */ 734 */
735 @SuppressWarnings("unused") 735 @SuppressWarnings("unused")
736 @CalledByNative 736 @CalledByNative
737 private void onError(final int nativeError, final String errorString) { 737 private void onError(int errorCode, int nativeError, String errorString) {
738 UrlRequestException requestError = new UrlRequestException( 738 UrlRequestException requestError = new UrlRequestException(
739 "Exception in CronetUrlRequest: " + errorString, 739 "Exception in CronetUrlRequest: " + errorString, errorCode, nati veError);
740 nativeError);
741 failWithException(requestError); 740 failWithException(requestError);
742 } 741 }
743 742
744 /** 743 /**
745 * Appends header |name| with value |value| to |headersList|. 744 * Appends header |name| with value |value| to |headersList|.
746 */ 745 */
747 @SuppressWarnings("unused") 746 @SuppressWarnings("unused")
748 @CalledByNative 747 @CalledByNative
749 private void onAppendResponseHeader(HeadersList headersList, 748 private void onAppendResponseHeader(HeadersList headersList,
750 String name, String value) { 749 String name, String value) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 804
806 @NativeClassQualifiedName("CronetURLRequestAdapter") 805 @NativeClassQualifiedName("CronetURLRequestAdapter")
807 private native String nativeGetProxyServer(long nativePtr); 806 private native String nativeGetProxyServer(long nativePtr);
808 807
809 @NativeClassQualifiedName("CronetURLRequestAdapter") 808 @NativeClassQualifiedName("CronetURLRequestAdapter")
810 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener); 809 private native void nativeGetStatus(long nativePtr, UrlRequest.StatusListene r listener);
811 810
812 @NativeClassQualifiedName("CronetURLRequestAdapter") 811 @NativeClassQualifiedName("CronetURLRequestAdapter")
813 private native boolean nativeGetWasCached(long nativePtr); 812 private native boolean nativeGetWasCached(long nativePtr);
814 } 813 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698