OLD | NEW |
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.impl; | 5 package org.chromium.net.impl; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.os.Build; | 8 import android.os.Build; |
9 import android.os.ConditionVariable; | 9 import android.os.ConditionVariable; |
10 import android.os.Handler; | 10 import android.os.Handler; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 return urlRequestContextConfig; | 187 return urlRequestContextConfig; |
188 } | 188 } |
189 | 189 |
190 @Override | 190 @Override |
191 public UrlRequest createRequest(String url, UrlRequest.Callback callback, Ex
ecutor executor, | 191 public UrlRequest createRequest(String url, UrlRequest.Callback callback, Ex
ecutor executor, |
192 int priority, Collection<Object> requestAnnotations, boolean disable
Cache, | 192 int priority, Collection<Object> requestAnnotations, boolean disable
Cache, |
193 boolean disableConnectionMigration, boolean allowDirectExecutor) { | 193 boolean disableConnectionMigration, boolean allowDirectExecutor) { |
194 synchronized (mLock) { | 194 synchronized (mLock) { |
195 checkHaveAdapter(); | 195 checkHaveAdapter(); |
196 boolean metricsCollectionEnabled = false; | |
197 synchronized (mFinishedListenerLock) { | |
198 metricsCollectionEnabled = !mFinishedListenerList.isEmpty(); | |
199 } | |
200 return new CronetUrlRequest(this, url, priority, callback, executor,
requestAnnotations, | 196 return new CronetUrlRequest(this, url, priority, callback, executor,
requestAnnotations, |
201 metricsCollectionEnabled, disableCache, disableConnectionMig
ration, | 197 disableCache, disableConnectionMigration, allowDirectExecuto
r); |
202 allowDirectExecutor); | |
203 } | 198 } |
204 } | 199 } |
205 | 200 |
206 @Override | 201 @Override |
207 public BidirectionalStream createBidirectionalStream(String url, | 202 public BidirectionalStream createBidirectionalStream(String url, |
208 BidirectionalStream.Callback callback, Executor executor, String htt
pMethod, | 203 BidirectionalStream.Callback callback, Executor executor, String htt
pMethod, |
209 List<Map.Entry<String, String>> requestHeaders, | 204 List<Map.Entry<String, String>> requestHeaders, |
210 @BidirectionalStream.Builder.StreamPriority int priority, | 205 @BidirectionalStream.Builder.StreamPriority int priority, |
211 boolean delayRequestHeadersUntilFirstFlush, Collection<Object> reque
stAnnotations) { | 206 boolean delayRequestHeadersUntilFirstFlush, Collection<Object> reque
stAnnotations) { |
212 synchronized (mLock) { | 207 synchronized (mLock) { |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 638 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
644 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); | 639 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); |
645 | 640 |
646 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 641 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
647 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); | 642 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); |
648 | 643 |
649 public boolean isNetworkThread(Thread thread) { | 644 public boolean isNetworkThread(Thread thread) { |
650 return thread == mNetworkThread; | 645 return thread == mNetworkThread; |
651 } | 646 } |
652 } | 647 } |
OLD | NEW |