Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2805053005: [Cronet] Enable Brotli (Closed)
Patch Set: add test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/cronet/android/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 base::MakeUnique<NetworkQualitiesPrefDelegateImpl>( 724 base::MakeUnique<NetworkQualitiesPrefDelegateImpl>(
725 pref_service_.get())); 725 pref_service_.get()));
726 network_qualities_prefs_manager_->InitializeOnNetworkThread( 726 network_qualities_prefs_manager_->InitializeOnNetworkThread(
727 network_quality_estimator_.get()); 727 network_quality_estimator_.get());
728 } 728 }
729 } 729 }
730 730
731 context_ = context_builder.Build(); 731 context_ = context_builder.Build();
732 732
733 context_->set_check_cleartext_permitted(true); 733 context_->set_check_cleartext_permitted(true);
734 context_->set_enable_brotli(config->enable_brotli);
734 735
735 if (network_quality_estimator_) 736 if (network_quality_estimator_)
736 context_->set_network_quality_estimator(network_quality_estimator_.get()); 737 context_->set_network_quality_estimator(network_quality_estimator_.get());
737 738
738 if (config->load_disable_cache) 739 if (config->load_disable_cache)
739 default_load_flags_ |= net::LOAD_DISABLE_CACHE; 740 default_load_flags_ |= net::LOAD_DISABLE_CACHE;
740 741
741 if (config->enable_sdch) { 742 if (config->enable_sdch) {
742 DCHECK(context_->sdch_manager()); 743 DCHECK(context_->sdch_manager());
743 sdch_owner_.reset( 744 sdch_owner_.reset(
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 // Create a URLRequestContextConfig from the given parameters. 1084 // Create a URLRequestContextConfig from the given parameters.
1084 static jlong CreateRequestContextConfig( 1085 static jlong CreateRequestContextConfig(
1085 JNIEnv* env, 1086 JNIEnv* env,
1086 const JavaParamRef<jclass>& jcaller, 1087 const JavaParamRef<jclass>& jcaller,
1087 const JavaParamRef<jstring>& juser_agent, 1088 const JavaParamRef<jstring>& juser_agent,
1088 const JavaParamRef<jstring>& jstorage_path, 1089 const JavaParamRef<jstring>& jstorage_path,
1089 jboolean jquic_enabled, 1090 jboolean jquic_enabled,
1090 const JavaParamRef<jstring>& jquic_default_user_agent_id, 1091 const JavaParamRef<jstring>& jquic_default_user_agent_id,
1091 jboolean jhttp2_enabled, 1092 jboolean jhttp2_enabled,
1092 jboolean jsdch_enabled, 1093 jboolean jsdch_enabled,
1094 jboolean jbrotli_enabled,
1093 const JavaParamRef<jstring>& jdata_reduction_proxy_key, 1095 const JavaParamRef<jstring>& jdata_reduction_proxy_key,
1094 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy, 1096 const JavaParamRef<jstring>& jdata_reduction_proxy_primary_proxy,
1095 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy, 1097 const JavaParamRef<jstring>& jdata_reduction_proxy_fallback_proxy,
1096 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url, 1098 const JavaParamRef<jstring>& jdata_reduction_proxy_secure_proxy_check_url,
1097 jboolean jdisable_cache, 1099 jboolean jdisable_cache,
1098 jint jhttp_cache_mode, 1100 jint jhttp_cache_mode,
1099 jlong jhttp_cache_max_size, 1101 jlong jhttp_cache_max_size,
1100 const JavaParamRef<jstring>& jexperimental_quic_connection_options, 1102 const JavaParamRef<jstring>& jexperimental_quic_connection_options,
1101 jlong jmock_cert_verifier, 1103 jlong jmock_cert_verifier,
1102 jboolean jenable_network_quality_estimator, 1104 jboolean jenable_network_quality_estimator,
1103 jboolean jbypass_public_key_pinning_for_local_trust_anchors, 1105 jboolean jbypass_public_key_pinning_for_local_trust_anchors,
1104 const JavaParamRef<jstring>& jcert_verifier_data) { 1106 const JavaParamRef<jstring>& jcert_verifier_data) {
1105 return reinterpret_cast<jlong>(new URLRequestContextConfig( 1107 return reinterpret_cast<jlong>(new URLRequestContextConfig(
1106 jquic_enabled, 1108 jquic_enabled,
1107 ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id), 1109 ConvertNullableJavaStringToUTF8(env, jquic_default_user_agent_id),
1108 jhttp2_enabled, jsdch_enabled, 1110 jhttp2_enabled, jsdch_enabled, jbrotli_enabled,
1109 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode), 1111 static_cast<URLRequestContextConfig::HttpCacheType>(jhttp_cache_mode),
1110 jhttp_cache_max_size, jdisable_cache, 1112 jhttp_cache_max_size, jdisable_cache,
1111 ConvertNullableJavaStringToUTF8(env, jstorage_path), 1113 ConvertNullableJavaStringToUTF8(env, jstorage_path),
1112 ConvertNullableJavaStringToUTF8(env, juser_agent), 1114 ConvertNullableJavaStringToUTF8(env, juser_agent),
1113 ConvertNullableJavaStringToUTF8(env, 1115 ConvertNullableJavaStringToUTF8(env,
1114 jexperimental_quic_connection_options), 1116 jexperimental_quic_connection_options),
1115 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_key), 1117 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_key),
1116 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_primary_proxy), 1118 ConvertNullableJavaStringToUTF8(env, jdata_reduction_proxy_primary_proxy),
1117 ConvertNullableJavaStringToUTF8(env, 1119 ConvertNullableJavaStringToUTF8(env,
1118 jdata_reduction_proxy_fallback_proxy), 1120 jdata_reduction_proxy_fallback_proxy),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 JNIEnv* env, 1210 JNIEnv* env,
1209 const JavaParamRef<jclass>& jcaller) { 1211 const JavaParamRef<jclass>& jcaller) {
1210 DCHECK(base::StatisticsRecorder::IsActive()); 1212 DCHECK(base::StatisticsRecorder::IsActive());
1211 std::vector<uint8_t> data; 1213 std::vector<uint8_t> data;
1212 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 1214 if (!HistogramManager::GetInstance()->GetDeltas(&data))
1213 return ScopedJavaLocalRef<jbyteArray>(); 1215 return ScopedJavaLocalRef<jbyteArray>();
1214 return base::android::ToJavaByteArray(env, &data[0], data.size()); 1216 return base::android::ToJavaByteArray(env, &data[0], data.size());
1215 } 1217 }
1216 1218
1217 } // namespace cronet 1219 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698