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

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

Issue 2030933002: Make CronetHttpURLConnection#setConnectTimeout silently fail (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.urlconnection; 5 package org.chromium.net.urlconnection;
6 6
7 import android.util.Pair; 7 import android.util.Pair;
8 8
9 import org.chromium.base.Log; 9 import org.chromium.base.Log;
10 import org.chromium.net.CronetEngine; 10 import org.chromium.net.CronetEngine;
(...skipping 16 matching lines...) Expand all
27 import java.util.List; 27 import java.util.List;
28 import java.util.Map; 28 import java.util.Map;
29 import java.util.TreeMap; 29 import java.util.TreeMap;
30 30
31 /** 31 /**
32 * An implementation of {@link HttpURLConnection} that uses Cronet to send 32 * An implementation of {@link HttpURLConnection} that uses Cronet to send
33 * requests and receive responses. 33 * requests and receive responses.
34 * {@hide} 34 * {@hide}
35 */ 35 */
36 public class CronetHttpURLConnection extends HttpURLConnection { 36 public class CronetHttpURLConnection extends HttpURLConnection {
37 private static final String TAG = "cr.CronetHttpURLConn"; 37 private static final String TAG = "cr_CronetHttpURLConn";
xunjieli 2016/06/02 13:27:36 The linter says do not use dot in the log tag. src
38 private static final String CONTENT_LENGTH = "Content-Length"; 38 private static final String CONTENT_LENGTH = "Content-Length";
39 private final CronetEngine mCronetEngine; 39 private final CronetEngine mCronetEngine;
40 private final MessageLoop mMessageLoop; 40 private final MessageLoop mMessageLoop;
41 private UrlRequest mRequest; 41 private UrlRequest mRequest;
42 private final List<Pair<String, String>> mRequestHeaders; 42 private final List<Pair<String, String>> mRequestHeaders;
43 43
44 private CronetInputStream mInputStream; 44 private CronetInputStream mInputStream;
45 private CronetOutputStream mOutputStream; 45 private CronetOutputStream mOutputStream;
46 private UrlResponseInfo mResponseInfo; 46 private UrlResponseInfo mResponseInfo;
47 private UrlRequestException mException; 47 private UrlRequestException mException;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // TODO(xunjieli): implement this. 395 // TODO(xunjieli): implement this.
396 return false; 396 return false;
397 } 397 }
398 398
399 @Override 399 @Override
400 public void setConnectTimeout(int timeout) { 400 public void setConnectTimeout(int timeout) {
401 // Per-request connect timeout is not supported because of late binding. 401 // Per-request connect timeout is not supported because of late binding.
402 // Sockets are assigned to requests according to request priorities 402 // Sockets are assigned to requests according to request priorities
403 // when sockets are connected. This requires requests with the same host , 403 // when sockets are connected. This requires requests with the same host ,
404 // domain and port to have same timeout. 404 // domain and port to have same timeout.
405 throw new UnsupportedOperationException("Not supported"); 405 Log.d(TAG, "setConnectTimeout is not supported by CronetHttpURLConnectio n");
pauljensen 2016/06/02 14:12:56 It might be worth upgrading this to Log.e()
xunjieli 2016/06/02 14:24:17 I considered using Log.e() but I decided to use th
pauljensen 2016/06/02 14:56:54 I think log spamming is an equal punishment to cal
xunjieli 2016/06/02 16:20:09 Done.
406 } 406 }
407 407
408 /** 408 /**
409 * Used by {@link CronetInputStream} to get more data from the network 409 * Used by {@link CronetInputStream} to get more data from the network
410 * stack. This should only be called after the request has started. Note 410 * stack. This should only be called after the request has started. Note
411 * that this call might block if there isn't any more data to be read. 411 * that this call might block if there isn't any more data to be read.
412 * Since byteBuffer is passed to the UrlRequest, it must be a direct 412 * Since byteBuffer is passed to the UrlRequest, it must be a direct
413 * ByteBuffer. 413 * ByteBuffer.
414 */ 414 */
415 void getMoreData(ByteBuffer byteBuffer) throws IOException { 415 void getMoreData(ByteBuffer byteBuffer) throws IOException {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // Strips Content-Encoding response header. See crbug.com/592700. 597 // Strips Content-Encoding response header. See crbug.com/592700.
598 if (!entry.getKey().equalsIgnoreCase("Content-Encoding")) { 598 if (!entry.getKey().equalsIgnoreCase("Content-Encoding")) {
599 mResponseHeadersList.add( 599 mResponseHeadersList.add(
600 new AbstractMap.SimpleImmutableEntry<String, String>(ent ry)); 600 new AbstractMap.SimpleImmutableEntry<String, String>(ent ry));
601 } 601 }
602 } 602 }
603 mResponseHeadersList = Collections.unmodifiableList(mResponseHeadersList ); 603 mResponseHeadersList = Collections.unmodifiableList(mResponseHeadersList );
604 return mResponseHeadersList; 604 return mResponseHeadersList;
605 } 605 }
606 } 606 }
OLDNEW
« no previous file with comments | « no previous file | components/cronet/android/test/javatests/src/org/chromium/net/urlconnection/CronetHttpURLConnectionTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698