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

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

Issue 360733005: Poll CanPredictNetworkActions in Predictor class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 5 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 ProfileImplIOData::Handle::~Handle() { 89 ProfileImplIOData::Handle::~Handle() {
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
91 if (io_data_->predictor_ != NULL) { 91 if (io_data_->predictor_ != NULL) {
92 // io_data_->predictor_ might be NULL if Init() was never called 92 // io_data_->predictor_ might be NULL if Init() was never called
93 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called). 93 // (i.e. we shut down before ProfileImpl::DoFinalInit() got called).
94 bool save_prefs = true; 94 bool save_prefs = true;
95 #if defined(OS_CHROMEOS) 95 #if defined(OS_CHROMEOS)
96 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_); 96 save_prefs = !chromeos::ProfileHelper::IsSigninProfile(profile_);
97 #endif 97 #endif
98 if (save_prefs) { 98 if (save_prefs)
99 io_data_->predictor_->SaveStateForNextStartupAndTrim( 99 io_data_->predictor_->SaveStateForNextStartupAndTrim();
100 profile_->GetPrefs());
101 }
102 io_data_->predictor_->ShutdownOnUIThread(); 100 io_data_->predictor_->ShutdownOnUIThread();
103 } 101 }
104 102
105 if (io_data_->http_server_properties_manager_) 103 if (io_data_->http_server_properties_manager_)
106 io_data_->http_server_properties_manager_->ShutdownOnUIThread(); 104 io_data_->http_server_properties_manager_->ShutdownOnUIThread();
107 io_data_->ShutdownOnUIThread(); 105 io_data_->ShutdownOnUIThread();
108 } 106 }
109 107
110 void ProfileImplIOData::Handle::Init( 108 void ProfileImplIOData::Handle::Init(
111 const base::FilePath& cookie_path, 109 const base::FilePath& cookie_path,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
179 LazyInitialize(); 177 LazyInitialize();
180 DCHECK(!main_request_context_getter_.get()); 178 DCHECK(!main_request_context_getter_.get());
181 main_request_context_getter_ = ChromeURLRequestContextGetter::Create( 179 main_request_context_getter_ = ChromeURLRequestContextGetter::Create(
182 profile_, io_data_, protocol_handlers, request_interceptors.Pass()); 180 profile_, io_data_, protocol_handlers, request_interceptors.Pass());
183 181
184 io_data_->predictor_ 182 io_data_->predictor_
185 ->InitNetworkPredictor(profile_->GetPrefs(), 183 ->InitNetworkPredictor(profile_->GetPrefs(),
186 local_state, 184 local_state,
187 io_thread, 185 io_thread,
188 main_request_context_getter_.get()); 186 main_request_context_getter_.get(),
187 io_data_);
189 188
190 content::NotificationService::current()->Notify( 189 content::NotificationService::current()->Notify(
191 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED, 190 chrome::NOTIFICATION_PROFILE_URL_REQUEST_CONTEXT_GETTER_INITIALIZED,
192 content::Source<Profile>(profile_), 191 content::Source<Profile>(profile_),
193 content::NotificationService::NoDetails()); 192 content::NotificationService::NoDetails());
194 return main_request_context_getter_; 193 return main_request_context_getter_;
195 } 194 }
196 195
197 scoped_refptr<ChromeURLRequestContextGetter> 196 scoped_refptr<ChromeURLRequestContextGetter>
198 ProfileImplIOData::Handle::GetMediaRequestContextGetter() const { 197 ProfileImplIOData::Handle::GetMediaRequestContextGetter() const {
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 const base::Closure& completion) { 749 const base::Closure& completion) {
751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 750 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
752 DCHECK(initialized()); 751 DCHECK(initialized());
753 752
754 DCHECK(transport_security_state()); 753 DCHECK(transport_security_state());
755 // Completes synchronously. 754 // Completes synchronously.
756 transport_security_state()->DeleteAllDynamicDataSince(time); 755 transport_security_state()->DeleteAllDynamicDataSince(time);
757 DCHECK(http_server_properties_manager_); 756 DCHECK(http_server_properties_manager_);
758 http_server_properties_manager_->Clear(completion); 757 http_server_properties_manager_->Clear(completion);
759 } 758 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698