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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 203 } |
204 | 204 |
205 @Override | 205 @Override |
206 public BidirectionalStream createBidirectionalStream(String url, | 206 public BidirectionalStream createBidirectionalStream(String url, |
207 BidirectionalStream.Callback callback, Executor executor, String htt
pMethod, | 207 BidirectionalStream.Callback callback, Executor executor, String htt
pMethod, |
208 List<Map.Entry<String, String>> requestHeaders, | 208 List<Map.Entry<String, String>> requestHeaders, |
209 @BidirectionalStream.Builder.StreamPriority int priority, | 209 @BidirectionalStream.Builder.StreamPriority int priority, |
210 boolean delayRequestHeadersUntilFirstFlush, Collection<Object> reque
stAnnotations) { | 210 boolean delayRequestHeadersUntilFirstFlush, Collection<Object> reque
stAnnotations) { |
211 synchronized (mLock) { | 211 synchronized (mLock) { |
212 checkHaveAdapter(); | 212 checkHaveAdapter(); |
| 213 boolean metricsCollectionEnabled = false; |
| 214 synchronized (mFinishedListenerLock) { |
| 215 metricsCollectionEnabled = !mFinishedListenerList.isEmpty(); |
| 216 } |
213 return new CronetBidirectionalStream(this, url, priority, callback,
executor, | 217 return new CronetBidirectionalStream(this, url, priority, callback,
executor, |
214 httpMethod, requestHeaders, delayRequestHeadersUntilFirstFlu
sh, | 218 httpMethod, requestHeaders, delayRequestHeadersUntilFirstFlu
sh, |
215 requestAnnotations); | 219 requestAnnotations, metricsCollectionEnabled); |
216 } | 220 } |
217 } | 221 } |
218 | 222 |
219 @Override | 223 @Override |
220 public boolean isEnabled() { | 224 public boolean isEnabled() { |
221 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; | 225 return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH; |
222 } | 226 } |
223 | 227 |
224 @Override | 228 @Override |
225 public String getVersionString() { | 229 public String getVersionString() { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 638 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
635 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); | 639 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); |
636 | 640 |
637 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 641 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
638 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); | 642 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); |
639 | 643 |
640 public boolean isNetworkThread(Thread thread) { | 644 public boolean isNetworkThread(Thread thread) { |
641 return thread == mNetworkThread; | 645 return thread == mNetworkThread; |
642 } | 646 } |
643 } | 647 } |
OLD | NEW |