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

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

Issue 586143002: Initial implementation of Cronet Async API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 8
9 import org.apache.http.conn.ConnectTimeoutException; 9 import org.apache.http.conn.ConnectTimeoutException;
10 import org.chromium.base.CalledByNative; 10 import org.chromium.base.CalledByNative;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 470
471 // Private methods called by native library. 471 // Private methods called by native library.
472 472
473 /** 473 /**
474 * If @CalledByNative method throws an exception, request gets cancelled 474 * If @CalledByNative method throws an exception, request gets cancelled
475 * and exception could be retrieved from request using getException(). 475 * and exception could be retrieved from request using getException().
476 */ 476 */
477 private void onCalledByNativeException(Exception e) { 477 private void onCalledByNativeException(Exception e) {
478 mSinkException = new IOException( 478 mSinkException = new IOException(
479 "CalledByNative method has thrown an exception", e); 479 "CalledByNative method has thrown an exception", e);
480 Log.e(ChromiumUrlRequestContext.LOG_TAG, 480 Log.e(CronetUrlRequestContext.LOG_TAG,
481 "Exception in CalledByNative method", e); 481 "Exception in CalledByNative method", e);
482 try { 482 try {
483 cancel(); 483 cancel();
484 } catch (Exception cancel_exception) { 484 } catch (Exception cancel_exception) {
485 Log.e(ChromiumUrlRequestContext.LOG_TAG, 485 Log.e(CronetUrlRequestContext.LOG_TAG,
486 "Exception trying to cancel request", cancel_exception); 486 "Exception trying to cancel request", cancel_exception);
487 } 487 }
488 } 488 }
489 489
490 /** 490 /**
491 * A callback invoked when the first chunk of the response has arrived. 491 * A callback invoked when the first chunk of the response has arrived.
492 */ 492 */
493 @CalledByNative 493 @CalledByNative
494 private void onResponseStarted() { 494 private void onResponseStarted() {
495 try { 495 try {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 690
691 private native void nativeGetAllHeaders(long urlRequestAdapter, 691 private native void nativeGetAllHeaders(long urlRequestAdapter,
692 ResponseHeadersMap headers); 692 ResponseHeadersMap headers);
693 693
694 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); 694 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter);
695 695
696 // Explicit class to work around JNI-generator generics confusion. 696 // Explicit class to work around JNI-generator generics confusion.
697 private class ResponseHeadersMap extends HashMap<String, List<String>> { 697 private class ResponseHeadersMap extends HashMap<String, List<String>> {
698 } 698 }
699 } 699 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698