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

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

Issue 2084093002: Use lossy prefs in the net predictor, and update them more frequently (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@predictor_lru
Patch Set: kill waitable event references Created 4 years, 4 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
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 25 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
27 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 26 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
28 #include "chrome/browser/io_thread.h" 27 #include "chrome/browser/io_thread.h"
29 #include "chrome/browser/net/chrome_network_delegate.h" 28 #include "chrome/browser/net/chrome_network_delegate.h"
30 #include "chrome/browser/net/http_server_properties_manager_factory.h" 29 #include "chrome/browser/net/http_server_properties_manager_factory.h"
31 #include "chrome/browser/net/predictor.h" 30 #include "chrome/browser/net/predictor.h"
32 #include "chrome/browser/net/quota_policy_channel_id_store.h" 31 #include "chrome/browser/net/quota_policy_channel_id_store.h"
33 #include "chrome/browser/net/sdch_owner_pref_storage.h" 32 #include "chrome/browser/net/sdch_owner_pref_storage.h"
34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" 33 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h"
35 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" 34 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 initialized_(false) { 111 initialized_(false) {
113 DCHECK_CURRENTLY_ON(BrowserThread::UI); 112 DCHECK_CURRENTLY_ON(BrowserThread::UI);
114 DCHECK(profile); 113 DCHECK(profile);
115 } 114 }
116 115
117 ProfileImplIOData::Handle::~Handle() { 116 ProfileImplIOData::Handle::~Handle() {
118 DCHECK_CURRENTLY_ON(BrowserThread::UI); 117 DCHECK_CURRENTLY_ON(BrowserThread::UI);
119 if (io_data_->predictor_ != NULL) { 118 if (io_data_->predictor_ != NULL) {
120 // io_data_->predictor_ might be NULL if Init() was never called 119 // io_data_->predictor_ might be NULL if Init() was never called
121 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). 120 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called).
122 bool save_prefs = true;
123 #if defined(OS_CHROMEOS)
124 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_);
125 #endif
126 if (save_prefs)
127 io_data_->predictor_->SaveStateForNextStartup();
128 io_data_->predictor_->ShutdownOnUIThread(); 121 io_data_->predictor_->ShutdownOnUIThread();
129 } 122 }
130 123
131 if (io_data_->http_server_properties_manager_) 124 if (io_data_->http_server_properties_manager_)
132 io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); 125 io_data_->http_server_properties_manager_->ShutdownOnPrefThread();
133 126
134 // io_data_->data_reduction_proxy_io_data() might be NULL if Init() was 127 // io_data_->data_reduction_proxy_io_data() might be NULL if Init() was
135 // never called. 128 // never called.
136 if (io_data_->data_reduction_proxy_io_data()) 129 if (io_data_->data_reduction_proxy_io_data())
137 io_data_->data_reduction_proxy_io_data()->ShutdownOnUIThread(); 130 io_data_->data_reduction_proxy_io_data()->ShutdownOnUIThread();
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 const base::Closure& completion) { 785 const base::Closure& completion) {
793 DCHECK_CURRENTLY_ON(BrowserThread::IO); 786 DCHECK_CURRENTLY_ON(BrowserThread::IO);
794 DCHECK(initialized()); 787 DCHECK(initialized());
795 788
796 DCHECK(transport_security_state()); 789 DCHECK(transport_security_state());
797 // Completes synchronously. 790 // Completes synchronously.
798 transport_security_state()->DeleteAllDynamicDataSince(time); 791 transport_security_state()->DeleteAllDynamicDataSince(time);
799 DCHECK(http_server_properties_manager_); 792 DCHECK(http_server_properties_manager_);
800 http_server_properties_manager_->Clear(completion); 793 http_server_properties_manager_->Clear(completion);
801 } 794 }
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698