| 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.brotliEnabled(), builder.dataReductionProxyKey(), | 190 builder.brotliEnabled(), builder.cacheDisabled(), builder.httpCa
cheMode(), |
| 191 builder.dataReductionProxyPrimaryProxy(), builder.dataReductionP
roxyFallbackProxy(), | 191 builder.httpCacheMaxSize(), builder.experimentalOptions(), |
| 192 builder.dataReductionProxySecureProxyCheckUrl(), builder.cacheDi
sabled(), | |
| 193 builder.httpCacheMode(), builder.httpCacheMaxSize(), builder.exp
erimentalOptions(), | |
| 194 builder.mockCertVerifier(), builder.networkQualityEstimatorEnabl
ed(), | 192 builder.mockCertVerifier(), builder.networkQualityEstimatorEnabl
ed(), |
| 195 builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled(), | 193 builder.publicKeyPinningBypassForLocalTrustAnchorsEnabled(), |
| 196 builder.certVerifierData()); | 194 builder.certVerifierData()); |
| 197 for (CronetEngineBuilderImpl.QuicHint quicHint : builder.quicHints()) { | 195 for (CronetEngineBuilderImpl.QuicHint quicHint : builder.quicHints()) { |
| 198 nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.
mPort, | 196 nativeAddQuicHint(urlRequestContextConfig, quicHint.mHost, quicHint.
mPort, |
| 199 quicHint.mAlternatePort); | 197 quicHint.mAlternatePort); |
| 200 } | 198 } |
| 201 for (CronetEngineBuilderImpl.Pkp pkp : builder.publicKeyPins()) { | 199 for (CronetEngineBuilderImpl.Pkp pkp : builder.publicKeyPins()) { |
| 202 nativeAddPkp(urlRequestContextConfig, pkp.mHost, pkp.mHashes, pkp.mI
ncludeSubdomains, | 200 nativeAddPkp(urlRequestContextConfig, pkp.mHost, pkp.mHashes, pkp.mI
ncludeSubdomains, |
| 203 pkp.mExpirationDate.getTime()); | 201 pkp.mExpirationDate.getTime()); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 executor.execute(task); | 670 executor.execute(task); |
| 673 } catch (RejectedExecutionException failException) { | 671 } catch (RejectedExecutionException failException) { |
| 674 Log.e(CronetUrlRequestContext.LOG_TAG, "Exception posting task to ex
ecutor", | 672 Log.e(CronetUrlRequestContext.LOG_TAG, "Exception posting task to ex
ecutor", |
| 675 failException); | 673 failException); |
| 676 } | 674 } |
| 677 } | 675 } |
| 678 | 676 |
| 679 // Native methods are implemented in cronet_url_request_context_adapter.cc. | 677 // Native methods are implemented in cronet_url_request_context_adapter.cc. |
| 680 private static native long nativeCreateRequestContextConfig(String userAgent
, | 678 private static native long nativeCreateRequestContextConfig(String userAgent
, |
| 681 String storagePath, boolean quicEnabled, String quicUserAgentId, boo
lean http2Enabled, | 679 String storagePath, boolean quicEnabled, String quicUserAgentId, boo
lean http2Enabled, |
| 682 boolean sdchEnabled, boolean brotliEnabled, String dataReductionProx
yKey, | 680 boolean sdchEnabled, boolean brotliEnabled, boolean disableCache, in
t httpCacheMode, |
| 683 String dataReductionProxyPrimaryProxy, String dataReductionProxyFall
backProxy, | |
| 684 String dataReductionProxySecureProxyCheckUrl, boolean disableCache,
int httpCacheMode, | |
| 685 long httpCacheMaxSize, String experimentalOptions, long mockCertVeri
fier, | 681 long httpCacheMaxSize, String experimentalOptions, long mockCertVeri
fier, |
| 686 boolean enableNetworkQualityEstimator, | 682 boolean enableNetworkQualityEstimator, |
| 687 boolean bypassPublicKeyPinningForLocalTrustAnchors, String certVerif
ierData); | 683 boolean bypassPublicKeyPinningForLocalTrustAnchors, String certVerif
ierData); |
| 688 | 684 |
| 689 private static native void nativeAddQuicHint( | 685 private static native void nativeAddQuicHint( |
| 690 long urlRequestContextConfig, String host, int port, int alternatePo
rt); | 686 long urlRequestContextConfig, String host, int port, int alternatePo
rt); |
| 691 | 687 |
| 692 private static native void nativeAddPkp(long urlRequestContextConfig, String
host, | 688 private static native void nativeAddPkp(long urlRequestContextConfig, String
host, |
| 693 byte[][] hashes, boolean includeSubdomains, long expirationTime); | 689 byte[][] hashes, boolean includeSubdomains, long expirationTime); |
| 694 | 690 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 724 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 720 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 725 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); | 721 private native void nativeProvideRTTObservations(long nativePtr, boolean sho
uld); |
| 726 | 722 |
| 727 @NativeClassQualifiedName("CronetURLRequestContextAdapter") | 723 @NativeClassQualifiedName("CronetURLRequestContextAdapter") |
| 728 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); | 724 private native void nativeProvideThroughputObservations(long nativePtr, bool
ean should); |
| 729 | 725 |
| 730 public boolean isNetworkThread(Thread thread) { | 726 public boolean isNetworkThread(Thread thread) { |
| 731 return thread == mNetworkThread; | 727 return thread == mNetworkThread; |
| 732 } | 728 } |
| 733 } | 729 } |
| OLD | NEW |