| 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.os.ConditionVariable; | 7 import android.os.ConditionVariable; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.os.Looper; | 9 import android.os.Looper; |
| 10 import android.os.Process; | 10 import android.os.Process; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } else { | 180 } else { |
| 181 new Handler(Looper.getMainLooper()).post(task); | 181 new Handler(Looper.getMainLooper()).post(task); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 @VisibleForTesting | 185 @VisibleForTesting |
| 186 public static long createNativeUrlRequestContextConfig(CronetEngineBuilderIm
pl builder) { | 186 public static long createNativeUrlRequestContextConfig(CronetEngineBuilderIm
pl builder) { |
| 187 final long urlRequestContextConfig = nativeCreateRequestContextConfig( | 187 final long urlRequestContextConfig = nativeCreateRequestContextConfig( |
| 188 builder.getUserAgent(), builder.storagePath(), builder.quicEnabl
ed(), | 188 builder.getUserAgent(), builder.storagePath(), builder.quicEnabl
ed(), |
| 189 builder.getDefaultQuicUserAgentId(), builder.http2Enabled(), bui
lder.sdchEnabled(), | 189 builder.getDefaultQuicUserAgentId(), builder.http2Enabled(), bui
lder.sdchEnabled(), |
| 190 builder.dataReductionProxyKey(), builder.dataReductionProxyPrima
ryProxy(), | 190 builder.brotliEnabled(), builder.dataReductionProxyKey(), |
| 191 builder.dataReductionProxyFallbackProxy(), | 191 builder.dataReductionProxyPrimaryProxy(), builder.dataReductionP
roxyFallbackProxy(), |
| 192 builder.dataReductionProxySecureProxyCheckUrl(), builder.cacheDi
sabled(), | 192 builder.dataReductionProxySecureProxyCheckUrl(), builder.cacheDi
sabled(), |
| 193 builder.httpCacheMode(), builder.httpCacheMaxSize(), builder.exp
erimentalOptions(), | 193 builder.httpCacheMode(), builder.httpCacheMaxSize(), builder.exp
erimentalOptions(), |
| 194 builder.mockCertVerifier(), builder.networkQualityEstimatorEnabl
ed(), | 194 builder.mockCertVerifier(), builder.networkQualityEstimatorEnabl
ed(), |
| 195 builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled(), | 195 builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled(), |
| 196 builder.certVerifierData()); | 196 builder.certVerifierData()); |
| 197 for (CronetEngineBuilderImpl.QuicHint quicHint : builder.quicHints()) { | 197 for (CronetEngineBuilderImpl.QuicHint quicHint : builder.quicHints()) { |
| 198 nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.
mPort, | 198 nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.
mPort, |
| 199 quicHint.mAlternatePort); | 199 quicHint.mAlternatePort); |
| 200 } | 200 } |
| 201 for (CronetEngineBuilderImpl.Pkp pkp : builder.publicKeyPins()) { | 201 for (CronetEngineBuilderImpl.Pkp pkp : builder.publicKeyPins()) { |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 executor.execute(task); | 672 executor.execute(task); |
| 673 } catch (RejectedExecutionException failException) { | 673 } catch (RejectedExecutionException failException) { |
| 674 Log.e(CronetUrlRequestContext.LOG_TAG, "Exception posting task to ex
ecutor", | 674 Log.e(CronetUrlRequestContext.LOG_TAG, "Exception posting task to ex
ecutor", |
| 675 failException); | 675 failException); |
| 676 } | 676 } |
| 677 } | 677 } |
| 678 | 678 |
| 679 // Native methods are implemented in cronet_url_request_context_adapter.cc. | 679 // Native methods are implemented in cronet_url_request_context_adapter.cc. |
| 680 private static native long nativeCreateRequestContextConfig(String userAgent
, | 680 private static native long nativeCreateRequestContextConfig(String userAgent
, |
| 681 String storagePath, boolean quicEnabled, String quicUserAgentId, boo
lean http2Enabled, | 681 String storagePath, boolean quicEnabled, String quicUserAgentId, boo
lean http2Enabled, |
| 682 boolean sdchEnabled, String dataReductionProxyKey, | 682 boolean sdchEnabled, boolean brotliEnabled, String dataReductionProx
yKey, |
| 683 String dataReductionProxyPrimaryProxy, String dataReductionProxyFall
backProxy, | 683 String dataReductionProxyPrimaryProxy, String dataReductionProxyFall
backProxy, |
| 684 String dataReductionProxySecureProxyCheckUrl, boolean disableCache,
int httpCacheMode, | 684 String dataReductionProxySecureProxyCheckUrl, boolean disableCache,
int httpCacheMode, |
| 685 long httpCacheMaxSize, String experimentalOptions, long mockCertVeri
fier, | 685 long httpCacheMaxSize, String experimentalOptions, long mockCertVeri
fier, |
| 686 boolean enableNetworkQualityEstimator, | 686 boolean enableNetworkQualityEstimator, |
| 687 boolean bypassPublicKeyPinningForLocalTrustAnchors, String certVerif
ierData); | 687 boolean bypassPublicKeyPinningForLocalTrustAnchors, String certVerif
ierData); |
| 688 | 688 |
| 689 private static native void nativeAddQuicHint( | 689 private static native void nativeAddQuicHint( |
| 690 long urlRequestContextConfig, String host, int port, int alternatePo
rt); | 690 long urlRequestContextConfig, String host, int port, int alternatePo
rt); |
| 691 | 691 |
| 692 private static native void nativeAddPkp(long urlRequestContextConfig, String
host, | 692 private static native void nativeAddPkp(long urlRequestContextConfig, String
host, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 724 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 725 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); | 725 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); |
| 726 | 726 |
| 727 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 727 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 728 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); | 728 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); |
| 729 | 729 |
| 730 public boolean isNetworkThread(Thread thread) { | 730 public boolean isNetworkThread(Thread thread) { |
| 731 return thread == mNetworkThread; | 731 return thread == mNetworkThread; |
| 732 } | 732 } |
| 733 } | 733 } |
| OLD | NEW |