Commit 9fdda94f authored by szym@chromium.org's avatar szym@chromium.org

Replace ProfileIOData::http_server_properties_manager_ with http_server_properties_.

ProfileImplIOData::http_server_properties_manager_ is kept in sync and used to access the implementation.

This change moves ownership of HttpServerPropertiesImpl from OffTheRecordProfileIOData to ProfileIOData and
ensures http_server_properties_ outlives ChromeURLRequestContexts owned by ProfileIOData.

BUG=161832


Review URL: https://chromiumcodereview.appspot.com/11316320

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171012 0039d316-1c4b-4281-b951-d872f2087c98
parent 095d5ef2
......@@ -182,8 +182,8 @@ void OffTheRecordProfileIOData::LazyInitializeInternal(
io_thread_globals->throttler_manager.get());
// For incognito, we use the default non-persistent HttpServerPropertiesImpl.
http_server_properties_.reset(new net::HttpServerPropertiesImpl);
main_context->set_http_server_properties(http_server_properties_.get());
set_http_server_properties(new net::HttpServerPropertiesImpl);
main_context->set_http_server_properties(http_server_properties());
// For incognito, we use a non-persistent server bound cert store.
net::ServerBoundCertService* server_bound_cert_service =
......
......@@ -17,9 +17,6 @@
class ChromeURLRequestContext;
class ChromeURLRequestContextGetter;
class Profile;
namespace net {
class HttpServerPropertiesImpl;
} // namespace net
// OffTheRecordProfile owns a OffTheRecordProfileIOData::Handle, which holds a
// reference to the OffTheRecordProfileIOData. OffTheRecordProfileIOData is
......@@ -127,8 +124,6 @@ class OffTheRecordProfileIOData : public ProfileIOData {
virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats(
IOThread::Globals* io_thread_globals) const OVERRIDE;
mutable scoped_ptr<net::HttpServerPropertiesImpl> http_server_properties_;
mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_;
mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_;
......
......@@ -60,8 +60,8 @@ ProfileImplIOData::Handle::~Handle() {
io_data_->predictor_->ShutdownOnUIThread(user_prefs);
}
if (io_data_->http_server_properties_manager())
io_data_->http_server_properties_manager()->ShutdownOnUIThread();
if (io_data_->http_server_properties_manager_)
io_data_->http_server_properties_manager_->ShutdownOnUIThread();
io_data_->ShutdownOnUIThread();
}
......@@ -267,8 +267,10 @@ void ProfileImplIOData::Handle::LazyInitialize() const {
// below try to get the ResourceContext pointer.
initialized_ = true;
PrefService* pref_service = profile_->GetPrefs();
io_data_->set_http_server_properties_manager(
new chrome_browser_net::HttpServerPropertiesManager(pref_service));
io_data_->http_server_properties_manager_ =
new chrome_browser_net::HttpServerPropertiesManager(pref_service);
io_data_->set_http_server_properties(
io_data_->http_server_properties_manager_);
io_data_->session_startup_pref()->Init(
prefs::kRestoreOnStartup, pref_service);
io_data_->session_startup_pref()->MoveToThread(
......@@ -316,8 +318,8 @@ void ProfileImplIOData::LazyInitializeInternal(
ApplyProfileParamsToContext(main_context);
if (http_server_properties_manager())
http_server_properties_manager()->InitializeOnIOThread();
if (http_server_properties_manager_)
http_server_properties_manager_->InitializeOnIOThread();
main_context->set_transport_security_state(transport_security_state());
......@@ -325,7 +327,7 @@ void ProfileImplIOData::LazyInitializeInternal(
main_context->set_network_delegate(network_delegate());
main_context->set_http_server_properties(http_server_properties_manager());
main_context->set_http_server_properties(http_server_properties());
main_context->set_host_resolver(
io_thread_globals->host_resolver.get());
......@@ -680,6 +682,6 @@ void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread(
DCHECK(transport_security_state());
transport_security_state()->DeleteSince(time); // Completes synchronously.
DCHECK(http_server_properties_manager());
http_server_properties_manager()->Clear(completion);
DCHECK(http_server_properties_manager_);
http_server_properties_manager_->Clear(completion);
}
......@@ -12,6 +12,7 @@
#include "chrome/browser/profiles/profile_io_data.h"
namespace chrome_browser_net {
class HttpServerPropertiesManager;
class Predictor;
} // namespace chrome_browser_net
......@@ -191,6 +192,11 @@ class ProfileImplIOData : public ProfileIOData {
mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_;
mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_;
// Same as |ProfileIOData::http_server_properties_|, owned there to maintain
// destruction ordering.
mutable chrome_browser_net::HttpServerPropertiesManager*
http_server_properties_manager_;
mutable scoped_ptr<chrome_browser_net::Predictor> predictor_;
mutable scoped_ptr<ChromeURLRequestContext> media_request_context_;
......
......@@ -34,7 +34,6 @@
#include "chrome/browser/net/chrome_http_user_agent_settings.h"
#include "chrome/browser/net/chrome_net_log.h"
#include "chrome/browser/net/chrome_network_delegate.h"
#include "chrome/browser/net/http_server_properties_manager.h"
#include "chrome/browser/net/load_time_stats.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/net/resource_prefetch_predictor_observer.h"
......@@ -471,14 +470,13 @@ bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const {
#endif // defined(OS_CHROMEOS)
}
chrome_browser_net::HttpServerPropertiesManager*
ProfileIOData::http_server_properties_manager() const {
return http_server_properties_manager_.get();
net::HttpServerProperties* ProfileIOData::http_server_properties() const {
return http_server_properties_.get();
}
void ProfileIOData::set_http_server_properties_manager(
chrome_browser_net::HttpServerPropertiesManager* manager) const {
http_server_properties_manager_.reset(manager);
void ProfileIOData::set_http_server_properties(
net::HttpServerProperties* http_server_properties) const {
http_server_properties_.reset(http_server_properties);
}
ProfileIOData::ResourceContext::ResourceContext(ProfileIOData* io_data)
......
......@@ -35,13 +35,13 @@ class TransportSecurityPersister;
namespace chrome_browser_net {
class LoadTimeStats;
class HttpServerPropertiesManager;
class ResourcePrefetchPredictorObserver;
}
namespace net {
class CookieStore;
class FraudulentCertificateReporter;
class HttpServerProperties;
class HttpTransactionFactory;
class ServerBoundCertService;
class ProxyConfigService;
......@@ -143,9 +143,6 @@ class ProfileIOData {
return transport_security_state_.get();
}
chrome_browser_net::HttpServerPropertiesManager*
http_server_properties_manager() const;
bool is_incognito() const {
return is_incognito_;
}
......@@ -284,8 +281,10 @@ class ProfileIOData {
return proxy_service_.get();
}
void set_http_server_properties_manager(
chrome_browser_net::HttpServerPropertiesManager* manager) const;
net::HttpServerProperties* http_server_properties() const;
void set_http_server_properties(
net::HttpServerProperties* http_server_properties) const;
ChromeURLRequestContext* main_request_context() const {
return main_request_context_.get();
......@@ -439,8 +438,8 @@ class ProfileIOData {
fraudulent_certificate_reporter_;
mutable scoped_ptr<net::ProxyService> proxy_service_;
mutable scoped_ptr<net::TransportSecurityState> transport_security_state_;
mutable scoped_ptr<chrome_browser_net::HttpServerPropertiesManager>
http_server_properties_manager_;
mutable scoped_ptr<net::HttpServerProperties>
http_server_properties_;
#if defined(ENABLE_NOTIFICATIONS)
mutable DesktopNotificationService* notification_service_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment