diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/automation_profile_impl.cc | 8 | ||||
-rw-r--r-- | chrome/browser/automation/automation_profile_impl.h | 5 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.cc | 10 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 15 | ||||
-rw-r--r-- | chrome/browser/profile.h | 12 | ||||
-rw-r--r-- | chrome/browser/sync/glue/http_bridge.cc | 12 | ||||
-rw-r--r-- | chrome/browser/sync/glue/http_bridge.h | 5 |
7 files changed, 10 insertions, 57 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc index 37caf33..ca208f6 100644 --- a/chrome/browser/automation/automation_profile_impl.cc +++ b/chrome/browser/automation/automation_profile_impl.cc @@ -158,14 +158,6 @@ class Factory : public ChromeURLRequestContextFactory { int tab_handle_; }; -// TODO(eroman): This duplicates CleanupRequestContext() from profile.cc. -void CleanupRequestContext(ChromeURLRequestContextGetter* context) { - context->CleanupOnUIThread(); - - // Clean up request context on IO thread. - ChromeThread::ReleaseSoon(ChromeThread::IO, FROM_HERE, context); -} - ChromeURLRequestContextGetter* CreateAutomationURLRequestContextForTab( int tab_handle, Profile* profile, diff --git a/chrome/browser/automation/automation_profile_impl.h b/chrome/browser/automation/automation_profile_impl.h index 040c278..f2bc6c2 100644 --- a/chrome/browser/automation/automation_profile_impl.h +++ b/chrome/browser/automation/automation_profile_impl.h @@ -19,9 +19,6 @@ ChromeURLRequestContextGetter* CreateAutomationURLRequestContextForTab( Profile* profile, IPC::Message::Sender* automation_client); -// Cleans up the request context on the IO thread. -void CleanupRequestContext(ChromeURLRequestContextGetter* context); - -}; +} #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROFILE_IMPL_H_ diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 9689ade..3d9251a 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -172,10 +172,7 @@ void ExternalTabContainer::Uninitialize() { tab_contents_ = NULL; } - if (request_context_.get()) { - AutomationRequestContext::CleanupRequestContext( - request_context_.release()); - } + request_context_ = NULL; } bool ExternalTabContainer::Reinitialize( @@ -699,11 +696,6 @@ bool ExternalTabContainer::OnGoToEntryOffset(int offset) { void ExternalTabContainer::InitializeAutomationRequestContext( int tab_handle) { - if (request_context_.get()) { - AutomationRequestContext::CleanupRequestContext( - request_context_.release()); - } - request_context_ = AutomationRequestContext::CreateAutomationURLRequestContextForTab( tab_handle, tab_contents_->profile(), diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 32e3306..c1cd54d 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -129,12 +129,8 @@ bool HasACacheSubdir(const FilePath &dir) { URLRequestContextGetter* Profile::default_request_context_; static void CleanupRequestContext(ChromeURLRequestContextGetter* context) { - if (context) { + if (context) context->CleanupOnUIThread(); - - // Clean up request context on IO thread. - ChromeThread::ReleaseSoon(ChromeThread::IO, FROM_HERE, context); - } } // static @@ -200,7 +196,6 @@ class OffTheRecordProfileImpl : public Profile, extensions_request_context_(NULL), start_time_(Time::Now()) { request_context_ = ChromeURLRequestContextGetter::CreateOffTheRecord(this); - request_context_->AddRef(); // Register for browser close notifications so we can detect when the last // off-the-record window is closed, in which case we can clean our states @@ -400,7 +395,6 @@ class OffTheRecordProfileImpl : public Profile, if (!extensions_request_context_) { extensions_request_context_ = ChromeURLRequestContextGetter::CreateOffTheRecordForExtensions(this); - extensions_request_context_->AddRef(); } return extensions_request_context_; @@ -549,9 +543,9 @@ class OffTheRecordProfileImpl : public Profile, Profile* profile_; // The context to use for requests made from this OTR session. - ChromeURLRequestContextGetter* request_context_; + scoped_refptr<ChromeURLRequestContextGetter> request_context_; - ChromeURLRequestContextGetter* extensions_request_context_; + scoped_refptr<ChromeURLRequestContextGetter> extensions_request_context_; // The download manager that only stores downloaded items in memory. scoped_refptr<DownloadManager> download_manager_; @@ -938,7 +932,6 @@ URLRequestContextGetter* ProfileImpl::GetRequestContext() { cache_path = GetCachePath(cache_path); request_context_ = ChromeURLRequestContextGetter::CreateOriginal( this, cookie_path, cache_path, max_size); - request_context_->AddRef(); // The first request context is always a normal (non-OTR) request context. // Even when Chromium is started in OTR mode, a normal profile is always @@ -966,7 +959,6 @@ URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { media_request_context_ = ChromeURLRequestContextGetter::CreateOriginalForMedia( this, cache_path, max_size); - media_request_context_->AddRef(); } return media_request_context_; @@ -989,7 +981,6 @@ URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { extensions_request_context_ = ChromeURLRequestContextGetter::CreateOriginalForExtensions( this, cookie_path); - extensions_request_context_->AddRef(); } return extensions_request_context_; diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index 7497e6d..98e7aab 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -116,9 +116,6 @@ class Profile { // from any thread. This CAN return NULL if a first request context has not // yet been created. If necessary, listen on the UI thread for // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. - // - // The returned object is ref'd by the profile. Callers who AddRef() it (to - // keep it alive longer than the profile) must Release() it on the I/O thread. static URLRequestContextGetter* GetDefaultRequestContext(); // Returns a unique Id that can be used to identify this profile at runtime. @@ -278,9 +275,6 @@ class Profile { // Returns the request context information associated with this profile. Call // this only on the UI thread, since it can send notifications that should // happen on the UI thread. - // - // The returned object is ref'd by the profile. Callers who AddRef() it (to - // keep it alive longer than the profile) must Release() it on the I/O thread. virtual URLRequestContextGetter* GetRequestContext() = 0; // Returns the request context for media resources asociated with this @@ -548,11 +542,11 @@ class ProfileImpl : public Profile, scoped_ptr<ProfileSyncService> sync_service_; - ChromeURLRequestContextGetter* request_context_; + scoped_refptr<ChromeURLRequestContextGetter> request_context_; - ChromeURLRequestContextGetter* media_request_context_; + scoped_refptr<ChromeURLRequestContextGetter> media_request_context_; - ChromeURLRequestContextGetter* extensions_request_context_; + scoped_refptr<ChromeURLRequestContextGetter> extensions_request_context_; scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc index 56d3ebf9..95d95ac 100644 --- a/chrome/browser/sync/glue/http_bridge.cc +++ b/chrome/browser/sync/glue/http_bridge.cc @@ -46,17 +46,9 @@ HttpBridgeFactory::HttpBridgeFactory( DCHECK(baseline_context_getter != NULL); request_context_getter_ = new HttpBridge::RequestContextGetter(baseline_context_getter); - request_context_getter_->AddRef(); } HttpBridgeFactory::~HttpBridgeFactory() { - if (request_context_getter_) { - // Clean up request context getter on IO thread. - bool posted = ChromeThread::ReleaseSoon( - ChromeThread::IO, FROM_HERE, request_context_getter_); - DCHECK(posted); - request_context_getter_ = NULL; - } } sync_api::HttpPostProviderInterface* HttpBridgeFactory::Create() { @@ -116,13 +108,9 @@ HttpBridge::HttpBridge(HttpBridge::RequestContextGetter* context_getter) request_succeeded_(false), http_response_code_(-1), http_post_completed_(false, false) { - context_getter_for_request_->AddRef(); } HttpBridge::~HttpBridge() { - bool posted = ChromeThread::ReleaseSoon( - ChromeThread::IO, FROM_HERE, context_getter_for_request_); - DCHECK(posted); } void HttpBridge::SetUserAgent(const char* user_agent) { diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h index 9ac5af8..5287344 100644 --- a/chrome/browser/sync/glue/http_bridge.h +++ b/chrome/browser/sync/glue/http_bridge.h @@ -146,7 +146,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, // Gets a customized URLRequestContext for bridged requests. See // RequestContext definition for details. - RequestContextGetter* context_getter_for_request_; + scoped_refptr<RequestContextGetter> context_getter_for_request_; // Our hook into the network layer is a URLFetcher. USED ONLY ON THE IO LOOP, // so we can block created_on_loop_ while the fetch is in progress. @@ -196,8 +196,7 @@ class HttpBridgeFactory // This request context is built on top of the baseline context and shares // common components. HttpBridge::RequestContextGetter* GetRequestContextGetter(); - // We must Release() this from the IO thread. - HttpBridge::RequestContextGetter* request_context_getter_; + scoped_refptr<HttpBridge::RequestContextGetter> request_context_getter_; DISALLOW_COPY_AND_ASSIGN(HttpBridgeFactory); }; |