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 #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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
656 registry->RegisterDictionaryPref(kHttpServerPropertiesPref, | 656 registry->RegisterDictionaryPref(kHttpServerPropertiesPref, |
657 base::MakeUnique<base::DictionaryValue>()); | 657 base::MakeUnique<base::DictionaryValue>()); |
658 if (config->enable_network_quality_estimator) { | 658 if (config->enable_network_quality_estimator) { |
659 // Use lossy prefs to limit the overhead of reading/writing the prefs. | 659 // Use lossy prefs to limit the overhead of reading/writing the prefs. |
660 registry->RegisterDictionaryPref(kNetworkQualitiesPref, | 660 registry->RegisterDictionaryPref(kNetworkQualitiesPref, |
661 PrefRegistry::LOSSY_PREF); | 661 PrefRegistry::LOSSY_PREF); |
662 } | 662 } |
663 if (config->enable_host_cache_persistence) { | 663 if (config->enable_host_cache_persistence) { |
664 registry->RegisterListPref(kHostCachePref); | 664 registry->RegisterListPref(kHostCachePref); |
665 } | 665 } |
666 base::TimeTicks prefs_init_start = base::TimeTicks::Now(); | |
666 pref_service_ = factory.Create(registry.get()); | 667 pref_service_ = factory.Create(registry.get()); |
668 base::TimeTicks prefs_init_end = base::TimeTicks::Now(); | |
669 UMA_HISTOGRAM_TIMES("Net.Cronet.PrefsInitTime", | |
670 prefs_init_end - prefs_init_start); | |
pauljensen
2017/06/28 14:12:01
{
SCOPED_UMA_HISTOGRAM_TIMER("Net.Cronet.Prefs
mgersh
2017/06/28 14:21:08
Done.
| |
667 | 671 |
668 // Set up the HttpServerPropertiesManager. | 672 // Set up the HttpServerPropertiesManager. |
669 std::unique_ptr<net::HttpServerPropertiesManager> | 673 std::unique_ptr<net::HttpServerPropertiesManager> |
670 http_server_properties_manager(new net::HttpServerPropertiesManager( | 674 http_server_properties_manager(new net::HttpServerPropertiesManager( |
671 new PrefServiceAdapter(pref_service_.get()), | 675 new PrefServiceAdapter(pref_service_.get()), |
672 base::ThreadTaskRunnerHandle::Get(), GetNetworkTaskRunner(), | 676 base::ThreadTaskRunnerHandle::Get(), GetNetworkTaskRunner(), |
673 g_net_log.Get().net_log())); | 677 g_net_log.Get().net_log())); |
674 http_server_properties_manager->InitializeOnNetworkSequence(); | 678 http_server_properties_manager->InitializeOnNetworkSequence(); |
675 http_server_properties_manager_ = http_server_properties_manager.get(); | 679 http_server_properties_manager_ = http_server_properties_manager.get(); |
676 context_builder.SetHttpServerProperties( | 680 context_builder.SetHttpServerProperties( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 context_ = context_builder.Build(); | 724 context_ = context_builder.Build(); |
721 | 725 |
722 // Set up host cache persistence if it's enabled. Happens after building the | 726 // Set up host cache persistence if it's enabled. Happens after building the |
723 // URLRequestContext to get access to the HostCache. | 727 // URLRequestContext to get access to the HostCache. |
724 if (pref_service_ && config->enable_host_cache_persistence) { | 728 if (pref_service_ && config->enable_host_cache_persistence) { |
725 net::HostCache* host_cache = context_->host_resolver()->GetHostCache(); | 729 net::HostCache* host_cache = context_->host_resolver()->GetHostCache(); |
726 host_cache_persistence_manager_ = | 730 host_cache_persistence_manager_ = |
727 base::MakeUnique<HostCachePersistenceManager>( | 731 base::MakeUnique<HostCachePersistenceManager>( |
728 host_cache, pref_service_.get(), kHostCachePref, | 732 host_cache, pref_service_.get(), kHostCachePref, |
729 base::TimeDelta::FromMilliseconds( | 733 base::TimeDelta::FromMilliseconds( |
730 config->host_cache_persistence_delay_ms)); | 734 config->host_cache_persistence_delay_ms), |
735 g_net_log.Get().net_log()); | |
731 } | 736 } |
732 | 737 |
733 context_->set_check_cleartext_permitted(true); | 738 context_->set_check_cleartext_permitted(true); |
734 context_->set_enable_brotli(config->enable_brotli); | 739 context_->set_enable_brotli(config->enable_brotli); |
735 | 740 |
736 if (config->load_disable_cache) | 741 if (config->load_disable_cache) |
737 default_load_flags_ |= net::LOAD_DISABLE_CACHE; | 742 default_load_flags_ |= net::LOAD_DISABLE_CACHE; |
738 | 743 |
739 if (config->enable_sdch) { | 744 if (config->enable_sdch) { |
740 DCHECK(context_->sdch_manager()); | 745 DCHECK(context_->sdch_manager()); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1192 JNIEnv* env, | 1197 JNIEnv* env, |
1193 const JavaParamRef<jclass>& jcaller) { | 1198 const JavaParamRef<jclass>& jcaller) { |
1194 DCHECK(base::StatisticsRecorder::IsActive()); | 1199 DCHECK(base::StatisticsRecorder::IsActive()); |
1195 std::vector<uint8_t> data; | 1200 std::vector<uint8_t> data; |
1196 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1201 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
1197 return ScopedJavaLocalRef<jbyteArray>(); | 1202 return ScopedJavaLocalRef<jbyteArray>(); |
1198 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1203 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
1199 } | 1204 } |
1200 | 1205 |
1201 } // namespace cronet | 1206 } // namespace cronet |
OLD | NEW |