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.impl; | 5 package org.chromium.net.impl; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.annotation.TargetApi; | 8 import android.annotation.TargetApi; |
9 import android.net.TrafficStats; | 9 import android.net.TrafficStats; |
10 import android.os.Build; | 10 import android.os.Build; |
(...skipping 27 matching lines...) Expand all Loading... |
38 import java.util.concurrent.atomic.AtomicBoolean; | 38 import java.util.concurrent.atomic.AtomicBoolean; |
39 import java.util.concurrent.atomic.AtomicReference; | 39 import java.util.concurrent.atomic.AtomicReference; |
40 | 40 |
41 /** | 41 /** |
42 * Pure java UrlRequest, backed by {@link HttpURLConnection}. | 42 * Pure java UrlRequest, backed by {@link HttpURLConnection}. |
43 */ | 43 */ |
44 @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) // TrafficStats only availabl
e on ICS | 44 @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) // TrafficStats only availabl
e on ICS |
45 final class JavaUrlRequest extends UrlRequestBase { | 45 final class JavaUrlRequest extends UrlRequestBase { |
46 private static final String X_ANDROID = "X-Android"; | 46 private static final String X_ANDROID = "X-Android"; |
47 private static final String X_ANDROID_SELECTED_TRANSPORT = "X-Android-Select
ed-Transport"; | 47 private static final String X_ANDROID_SELECTED_TRANSPORT = "X-Android-Select
ed-Transport"; |
48 private static final String TAG = "JavaUrlConnection"; | 48 private static final String TAG = JavaUrlRequest.class.getSimpleName(); |
49 private static final int DEFAULT_UPLOAD_BUFFER_SIZE = 8192; | 49 private static final int DEFAULT_UPLOAD_BUFFER_SIZE = 8192; |
50 private static final int DEFAULT_CHUNK_LENGTH = DEFAULT_UPLOAD_BUFFER_SIZE; | 50 private static final int DEFAULT_CHUNK_LENGTH = DEFAULT_UPLOAD_BUFFER_SIZE; |
51 private static final String USER_AGENT = "User-Agent"; | 51 private static final String USER_AGENT = "User-Agent"; |
52 private final AsyncUrlRequestCallback mCallbackAsync; | 52 private final AsyncUrlRequestCallback mCallbackAsync; |
53 private final Executor mExecutor; | 53 private final Executor mExecutor; |
54 private final String mUserAgent; | 54 private final String mUserAgent; |
55 private final Map<String, String> mRequestHeaders = | 55 private final Map<String, String> mRequestHeaders = |
56 new TreeMap<>(String.CASE_INSENSITIVE_ORDER); | 56 new TreeMap<>(String.CASE_INSENSITIVE_ORDER); |
57 private final List<String> mUrlChain = new ArrayList<>(); | 57 private final List<String> mUrlChain = new ArrayList<>(); |
58 /** | 58 /** |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 // Can't throw directly from here, since the delegate execut
or could catch this | 972 // Can't throw directly from here, since the delegate execut
or could catch this |
973 // exception. | 973 // exception. |
974 mExecutedInline = new InlineExecutionProhibitedException(); | 974 mExecutedInline = new InlineExecutionProhibitedException(); |
975 return; | 975 return; |
976 } | 976 } |
977 mCommand.run(); | 977 mCommand.run(); |
978 } | 978 } |
979 } | 979 } |
980 } | 980 } |
981 } | 981 } |
OLD | NEW |