From 18590f24c69ded8500cf6970b4071654cdb22db4 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Fri, 29 Jul 2011 16:41:28 +0000 Subject: Reland r94047 - Make Profile own ProfileIOData. Unfortunately some URLFetchers were still alive. We have to kill them all before we kill the Profiles. BUG=64339 TEST=none Review URL: http://codereview.chromium.org/7533014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94687 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/profiles/profile_io_data.cc | 38 ++++++++---------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'chrome/browser/profiles/profile_io_data.cc') diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 969560b..31a9e1a 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -249,15 +249,8 @@ void ProfileIOData::InitializeProfileParams(Profile* profile) { profile_params_.reset(params.release()); } -ProfileIOData::RequestContext::RequestContext() {} -ProfileIOData::RequestContext::~RequestContext() {} - -ProfileIOData::AppRequestContext::AppRequestContext(const std::string& app_id) - : app_id_(app_id) {} -ProfileIOData::AppRequestContext::~AppRequestContext() { - DCHECK(ContainsKey(profile_io_data()->app_request_context_map_, app_id_)); - profile_io_data()->app_request_context_map_.erase(app_id_); -} +ProfileIOData::AppRequestContext::AppRequestContext() {} +ProfileIOData::AppRequestContext::~AppRequestContext() {} void ProfileIOData::AppRequestContext::SetCookieStore( net::CookieStore* cookie_store) { @@ -332,10 +325,7 @@ ProfileIOData::GetChromeURLDataManagerBackend() const { scoped_refptr ProfileIOData::GetMainRequestContext() const { LazyInitialize(); - scoped_refptr context = main_request_context_; - context->set_profile_io_data(const_cast(this)); - main_request_context_ = NULL; - return context; + return main_request_context_; } scoped_refptr @@ -350,11 +340,7 @@ ProfileIOData::GetMediaRequestContext() const { scoped_refptr ProfileIOData::GetExtensionsRequestContext() const { LazyInitialize(); - scoped_refptr context = - extensions_request_context_; - context->set_profile_io_data(const_cast(this)); - extensions_request_context_ = NULL; - return context; + return extensions_request_context_; } scoped_refptr @@ -366,11 +352,8 @@ ProfileIOData::GetIsolatedAppRequestContext( if (ContainsKey(app_request_context_map_, app_id)) { context = app_request_context_map_[app_id]; } else { - scoped_refptr request_context = - AcquireIsolatedAppRequestContext(main_context, app_id); - request_context->set_profile_io_data(const_cast(this)); - app_request_context_map_[app_id] = request_context; - context = request_context; + context = AcquireIsolatedAppRequestContext(main_context, app_id); + app_request_context_map_[app_id] = context; } DCHECK(context); return context; @@ -410,9 +393,8 @@ void ProfileIOData::LazyInitialize() const { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); // Create the common request contexts. - main_request_context_ = new RequestContext; - extensions_request_context_ = new RequestContext; - weak_extensions_request_context_ = extensions_request_context_->GetWeakPtr(); + main_request_context_ = new ChromeURLRequestContext; + extensions_request_context_ = new ChromeURLRequestContext; profile_params_->appcache_service->set_request_context(main_request_context_); @@ -533,7 +515,7 @@ void ProfileIOData::ShutdownOnUIThread() { base::Unretained(g_browser_process->resource_dispatcher_host()), &resource_context_)); bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - new ReleaseTask(this)); + new DeleteTask(this)); if (!posted) - Release(); + delete this; } -- cgit v1.1