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 11 matching lines...) Expand all Loading... |
22 #include "base/files/scoped_file.h" | 22 #include "base/files/scoped_file.h" |
23 #include "base/lazy_instance.h" | 23 #include "base/lazy_instance.h" |
24 #include "base/logging.h" | 24 #include "base/logging.h" |
25 #include "base/macros.h" | 25 #include "base/macros.h" |
26 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
27 #include "base/memory/scoped_vector.h" | 27 #include "base/memory/scoped_vector.h" |
28 #include "base/message_loop/message_loop.h" | 28 #include "base/message_loop/message_loop.h" |
29 #include "base/metrics/histogram_macros.h" | 29 #include "base/metrics/histogram_macros.h" |
30 #include "base/metrics/statistics_recorder.h" | 30 #include "base/metrics/statistics_recorder.h" |
31 #include "base/single_thread_task_runner.h" | 31 #include "base/single_thread_task_runner.h" |
| 32 #include "base/threading/thread_task_runner_handle.h" |
32 #include "base/time/time.h" | 33 #include "base/time/time.h" |
33 #include "base/values.h" | 34 #include "base/values.h" |
34 #include "components/cronet/android/cert/cert_verifier_cache_serializer.h" | 35 #include "components/cronet/android/cert/cert_verifier_cache_serializer.h" |
35 #include "components/cronet/android/cert/proto/cert_verification.pb.h" | 36 #include "components/cronet/android/cert/proto/cert_verification.pb.h" |
36 #include "components/cronet/histogram_manager.h" | 37 #include "components/cronet/histogram_manager.h" |
37 #include "components/cronet/url_request_context_config.h" | 38 #include "components/cronet/url_request_context_config.h" |
38 #include "components/prefs/pref_change_registrar.h" | 39 #include "components/prefs/pref_change_registrar.h" |
39 #include "components/prefs/pref_filter.h" | 40 #include "components/prefs/pref_filter.h" |
40 #include "components/prefs/pref_registry_simple.h" | 41 #include "components/prefs/pref_registry_simple.h" |
41 #include "components/prefs/pref_service.h" | 42 #include "components/prefs/pref_service.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 PrefServiceFactory factory; | 587 PrefServiceFactory factory; |
587 factory.set_user_prefs(json_pref_store_); | 588 factory.set_user_prefs(json_pref_store_); |
588 scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple()); | 589 scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple()); |
589 registry->RegisterDictionaryPref(kHttpServerProperties, | 590 registry->RegisterDictionaryPref(kHttpServerProperties, |
590 new base::DictionaryValue()); | 591 new base::DictionaryValue()); |
591 pref_service_ = factory.Create(registry.get()); | 592 pref_service_ = factory.Create(registry.get()); |
592 | 593 |
593 std::unique_ptr<net::HttpServerPropertiesManager> | 594 std::unique_ptr<net::HttpServerPropertiesManager> |
594 http_server_properties_manager(new net::HttpServerPropertiesManager( | 595 http_server_properties_manager(new net::HttpServerPropertiesManager( |
595 new PrefServiceAdapter(pref_service_.get()), | 596 new PrefServiceAdapter(pref_service_.get()), |
596 GetNetworkTaskRunner())); | 597 base::ThreadTaskRunnerHandle::Get(), GetNetworkTaskRunner())); |
597 http_server_properties_manager->InitializeOnNetworkThread(); | 598 http_server_properties_manager->InitializeOnNetworkThread(); |
598 http_server_properties_manager_ = http_server_properties_manager.get(); | 599 http_server_properties_manager_ = http_server_properties_manager.get(); |
599 context_builder.SetHttpServerProperties( | 600 context_builder.SetHttpServerProperties( |
600 std::move(http_server_properties_manager)); | 601 std::move(http_server_properties_manager)); |
601 } | 602 } |
602 | 603 |
603 // Explicitly disable the persister for Cronet to avoid persistence of dynamic | 604 // Explicitly disable the persister for Cronet to avoid persistence of dynamic |
604 // HPKP. This is a safety measure ensuring that nobody enables the persistence | 605 // HPKP. This is a safety measure ensuring that nobody enables the persistence |
605 // of HPKP by specifying transport_security_persister_path in the future. | 606 // of HPKP by specifying transport_security_persister_path in the future. |
606 context_builder.set_transport_security_persister_path(base::FilePath()); | 607 context_builder.set_transport_security_persister_path(base::FilePath()); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 JNIEnv* env, | 1094 JNIEnv* env, |
1094 const JavaParamRef<jclass>& jcaller) { | 1095 const JavaParamRef<jclass>& jcaller) { |
1095 base::StatisticsRecorder::Initialize(); | 1096 base::StatisticsRecorder::Initialize(); |
1096 std::vector<uint8_t> data; | 1097 std::vector<uint8_t> data; |
1097 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1098 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
1098 return ScopedJavaLocalRef<jbyteArray>(); | 1099 return ScopedJavaLocalRef<jbyteArray>(); |
1099 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1100 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
1100 } | 1101 } |
1101 | 1102 |
1102 } // namespace cronet | 1103 } // namespace cronet |
OLD | NEW |