| 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 default_load_flags_(net::LOAD_NORMAL) { | 482 default_load_flags_(net::LOAD_NORMAL) { |
| 483 base::Thread::Options options; | 483 base::Thread::Options options; |
| 484 options.message_loop_type = base::MessageLoop::TYPE_IO; | 484 options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 485 network_thread_->StartWithOptions(options); | 485 network_thread_->StartWithOptions(options); |
| 486 } | 486 } |
| 487 | 487 |
| 488 CronetURLRequestContextAdapter::~CronetURLRequestContextAdapter() { | 488 CronetURLRequestContextAdapter::~CronetURLRequestContextAdapter() { |
| 489 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); | 489 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); |
| 490 | 490 |
| 491 if (http_server_properties_manager_) | 491 if (http_server_properties_manager_) |
| 492 http_server_properties_manager_->ShutdownOnPrefThread(); | 492 http_server_properties_manager_->ShutdownOnPrefSequence(); |
| 493 if (network_qualities_prefs_manager_) | 493 if (network_qualities_prefs_manager_) |
| 494 network_qualities_prefs_manager_->ShutdownOnPrefThread(); | 494 network_qualities_prefs_manager_->ShutdownOnPrefSequence(); |
| 495 if (pref_service_) | 495 if (pref_service_) |
| 496 pref_service_->CommitPendingWrite(); | 496 pref_service_->CommitPendingWrite(); |
| 497 if (network_quality_estimator_) { | 497 if (network_quality_estimator_) { |
| 498 network_quality_estimator_->RemoveRTTObserver(this); | 498 network_quality_estimator_->RemoveRTTObserver(this); |
| 499 network_quality_estimator_->RemoveThroughputObserver(this); | 499 network_quality_estimator_->RemoveThroughputObserver(this); |
| 500 network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this); | 500 network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this); |
| 501 network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this); | 501 network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this); |
| 502 } | 502 } |
| 503 | 503 |
| 504 // Stop NetLog observer if there is one. | 504 // Stop NetLog observer if there is one. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // Use lossy prefs to limit the overhead of reading/writing the prefs. | 652 // Use lossy prefs to limit the overhead of reading/writing the prefs. |
| 653 registry->RegisterDictionaryPref(kNetworkQualities, | 653 registry->RegisterDictionaryPref(kNetworkQualities, |
| 654 PrefRegistry::LOSSY_PREF); | 654 PrefRegistry::LOSSY_PREF); |
| 655 } | 655 } |
| 656 pref_service_ = factory.Create(registry.get()); | 656 pref_service_ = factory.Create(registry.get()); |
| 657 | 657 |
| 658 std::unique_ptr<net::HttpServerPropertiesManager> | 658 std::unique_ptr<net::HttpServerPropertiesManager> |
| 659 http_server_properties_manager(new net::HttpServerPropertiesManager( | 659 http_server_properties_manager(new net::HttpServerPropertiesManager( |
| 660 new PrefServiceAdapter(pref_service_.get()), | 660 new PrefServiceAdapter(pref_service_.get()), |
| 661 base::ThreadTaskRunnerHandle::Get(), GetNetworkTaskRunner())); | 661 base::ThreadTaskRunnerHandle::Get(), GetNetworkTaskRunner())); |
| 662 http_server_properties_manager->InitializeOnNetworkThread(); | 662 http_server_properties_manager->InitializeOnNetworkSequence(); |
| 663 http_server_properties_manager_ = http_server_properties_manager.get(); | 663 http_server_properties_manager_ = http_server_properties_manager.get(); |
| 664 context_builder.SetHttpServerProperties( | 664 context_builder.SetHttpServerProperties( |
| 665 std::move(http_server_properties_manager)); | 665 std::move(http_server_properties_manager)); |
| 666 } | 666 } |
| 667 | 667 |
| 668 // Explicitly disable the persister for Cronet to avoid persistence of dynamic | 668 // Explicitly disable the persister for Cronet to avoid persistence of dynamic |
| 669 // HPKP. This is a safety measure ensuring that nobody enables the persistence | 669 // HPKP. This is a safety measure ensuring that nobody enables the persistence |
| 670 // of HPKP by specifying transport_security_persister_path in the future. | 670 // of HPKP by specifying transport_security_persister_path in the future. |
| 671 context_builder.set_transport_security_persister_path(base::FilePath()); | 671 context_builder.set_transport_security_persister_path(base::FilePath()); |
| 672 | 672 |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 JNIEnv* env, | 1174 JNIEnv* env, |
| 1175 const JavaParamRef<jclass>& jcaller) { | 1175 const JavaParamRef<jclass>& jcaller) { |
| 1176 DCHECK(base::StatisticsRecorder::IsActive()); | 1176 DCHECK(base::StatisticsRecorder::IsActive()); |
| 1177 std::vector<uint8_t> data; | 1177 std::vector<uint8_t> data; |
| 1178 if (!HistogramManager::GetInstance()->GetDeltas(&data)) | 1178 if (!HistogramManager::GetInstance()->GetDeltas(&data)) |
| 1179 return ScopedJavaLocalRef<jbyteArray>(); | 1179 return ScopedJavaLocalRef<jbyteArray>(); |
| 1180 return base::android::ToJavaByteArray(env, &data[0], data.size()); | 1180 return base::android::ToJavaByteArray(env, &data[0], data.size()); |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 } // namespace cronet | 1183 } // namespace cronet |
| OLD | NEW |