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

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 1857383002: Refactor net predictor to use ResourceThrottles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on #396550 Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_impl_io_data.h" 5 #include "chrome/browser/profiles/profile_impl_io_data.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
17 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/threading/worker_pool.h" 21 #include "base/threading/worker_pool.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/chromeos/profiles/profile_helper.h" 25 #include "chrome/browser/chromeos/profiles/profile_helper.h"
26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
27 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 27 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
28 #include "chrome/browser/io_thread.h" 28 #include "chrome/browser/io_thread.h"
29 #include "chrome/browser/net/chrome_network_delegate.h" 29 #include "chrome/browser/net/chrome_network_delegate.h"
30 #include "chrome/browser/net/connect_interceptor.h"
31 #include "chrome/browser/net/http_server_properties_manager_factory.h" 30 #include "chrome/browser/net/http_server_properties_manager_factory.h"
32 #include "chrome/browser/net/predictor.h" 31 #include "chrome/browser/net/predictor.h"
33 #include "chrome/browser/net/quota_policy_channel_id_store.h" 32 #include "chrome/browser/net/quota_policy_channel_id_store.h"
34 #include "chrome/browser/net/sdch_owner_pref_storage.h" 33 #include "chrome/browser/net/sdch_owner_pref_storage.h"
35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
37 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" 36 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h"
38 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/common/chrome_constants.h" 38 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath, 439 JsonPrefStore::GetTaskRunnerForFile(network_json_store_filepath,
441 BrowserThread::GetBlockingPool()), 440 BrowserThread::GetBlockingPool()),
442 std::unique_ptr<PrefFilter>()); 441 std::unique_ptr<PrefFilter>());
443 network_json_store_->ReadPrefsAsync(nullptr); 442 network_json_store_->ReadPrefsAsync(nullptr);
444 443
445 net::URLRequestContext* main_context = main_request_context(); 444 net::URLRequestContext* main_context = main_request_context();
446 445
447 IOThread* const io_thread = profile_params->io_thread; 446 IOThread* const io_thread = profile_params->io_thread;
448 IOThread::Globals* const io_thread_globals = io_thread->globals(); 447 IOThread::Globals* const io_thread_globals = io_thread->globals();
449 448
450 chrome_network_delegate->set_predictor(predictor_.get());
451
452 if (domain_reliability_monitor_) { 449 if (domain_reliability_monitor_) {
453 domain_reliability::DomainReliabilityMonitor* monitor = 450 domain_reliability::DomainReliabilityMonitor* monitor =
454 domain_reliability_monitor_.get(); 451 domain_reliability_monitor_.get();
455 monitor->InitURLRequestContext(main_context); 452 monitor->InitURLRequestContext(main_context);
456 monitor->AddBakedInConfigs(); 453 monitor->AddBakedInConfigs();
457 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); 454 monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread());
458 chrome_network_delegate->set_domain_reliability_monitor(monitor); 455 chrome_network_delegate->set_domain_reliability_monitor(monitor);
459 } 456 }
460 457
461 ApplyProfileParamsToContext(main_context); 458 ApplyProfileParamsToContext(main_context);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 ProfileImplIOData::AcquireIsolatedMediaRequestContext( 774 ProfileImplIOData::AcquireIsolatedMediaRequestContext(
778 net::URLRequestContext* app_context, 775 net::URLRequestContext* app_context,
779 const StoragePartitionDescriptor& partition_descriptor) const { 776 const StoragePartitionDescriptor& partition_descriptor) const {
780 // We create per-app media contexts on demand, unlike the others above. 777 // We create per-app media contexts on demand, unlike the others above.
781 net::URLRequestContext* media_request_context = 778 net::URLRequestContext* media_request_context =
782 InitializeMediaRequestContext(app_context, partition_descriptor); 779 InitializeMediaRequestContext(app_context, partition_descriptor);
783 DCHECK(media_request_context); 780 DCHECK(media_request_context);
784 return media_request_context; 781 return media_request_context;
785 } 782 }
786 783
784 chrome_browser_net::Predictor* ProfileImplIOData::GetPredictor() {
785 return predictor_.get();
786 }
787
787 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( 788 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
788 base::Time time, 789 base::Time time,
789 const base::Closure& completion) { 790 const base::Closure& completion) {
790 DCHECK_CURRENTLY_ON(BrowserThread::IO); 791 DCHECK_CURRENTLY_ON(BrowserThread::IO);
791 DCHECK(initialized()); 792 DCHECK(initialized());
792 793
793 DCHECK(transport_security_state()); 794 DCHECK(transport_security_state());
794 // Completes synchronously. 795 // Completes synchronously.
795 transport_security_state()->DeleteAllDynamicDataSince(time); 796 transport_security_state()->DeleteAllDynamicDataSince(time);
796 DCHECK(http_server_properties_manager_); 797 DCHECK(http_server_properties_manager_);
797 http_server_properties_manager_->Clear(completion); 798 http_server_properties_manager_->Clear(completion);
798 } 799 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698