diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 06:33:31 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-23 06:33:31 +0000 |
commit | be180c8044f145310f9eb13fd2cab5fd20e88220 (patch) | |
tree | 707ac9f3f95f5191664dbdac2ff3f34ab08ad8e7 /chrome/browser/automation/automation_profile_impl.h | |
parent | 4cb1d3be9986c105608991f3dde12c6346335060 (diff) | |
download | chromium_src-be180c8044f145310f9eb13fd2cab5fd20e88220.zip chromium_src-be180c8044f145310f9eb13fd2cab5fd20e88220.tar.gz chromium_src-be180c8044f145310f9eb13fd2cab5fd20e88220.tar.bz2 |
Move initialization of ChromeURLRequestContexts to the IO thread.
Before, these URLRequestContexts were lazily created from the UI thread. Unfortunately that model made it easy for consumers on the UI thread to poke at stuff which was being used from the IO thread, and introduce races.
So instead of providing a URLRequestContext*, the Profile now vends a URLRequestContextGetter*.
The consequence of this is:
* Consumers on the UI thread can no longer get access to a URLRequestContext.
* Consumers on the IO thread need to call URLRequestContextGetter::GetURLRequestContext() to get at the context. This uses the same style lazy-creation of URLRequestContexts, albeit from the IO thread.
OK, so now the smelly part:
There were a couple of consumers of URLRequestContext on the UI thread that can't easily be moved to the IO thread -- these are the consumers of the cookie store. Before they could happily mess with the cookie store from the UI thread, and this was fine since CookieStore is threadsafe. However under the new model, they have no way to get at the URLRequestContext from the UI thread, hence can't get a pointer to the cookie store.
To support that use-cases, I bastardized the API some by adding a URLRequestContextGetter::GetCookieStore() method that lets UI thread consumers get a pointer to the cookie store, since we know this particular cross-thread usage is safe.
BUG=http://crbug.com/22294
Review URL: http://codereview.chromium.org/258008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_profile_impl.h')
-rw-r--r-- | chrome/browser/automation/automation_profile_impl.h | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.h b/chrome/browser/automation/automation_profile_impl.h index e4d9ac6..c893aa1 100644 --- a/chrome/browser/automation/automation_profile_impl.h +++ b/chrome/browser/automation/automation_profile_impl.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROFILE_IMPL_H_ #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROFILE_IMPL_H_ +#include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/profile.h" #include "net/url_request/url_request_context.h" @@ -19,6 +20,8 @@ class AutomationProfileImpl : public Profile { tab_handle_(0) { } + virtual ~AutomationProfileImpl(); + void Initialize(Profile* original_profile, IPC::Message::Sender* automation_client); @@ -48,9 +51,6 @@ class AutomationProfileImpl : public Profile { virtual Profile* GetOriginalProfile() { return original_profile_->GetOriginalProfile(); } - virtual ChromeAppCacheService* GetAppCacheService() { - return original_profile_->GetAppCacheService(); - } virtual VisitedLinkMaster* GetVisitedLinkMaster() { return original_profile_->GetVisitedLinkMaster(); } @@ -126,13 +126,13 @@ class AutomationProfileImpl : public Profile { virtual ThumbnailStore* GetThumbnailStore() { return original_profile_->GetThumbnailStore(); } - virtual URLRequestContext* GetRequestContext() { - return alternate_reqeust_context_; + virtual URLRequestContextGetter* GetRequestContext() { + return alternate_request_context_; } - virtual URLRequestContext* GetRequestContextForMedia() { + virtual URLRequestContextGetter* GetRequestContextForMedia() { return original_profile_->GetRequestContextForMedia(); } - virtual URLRequestContext* GetRequestContextForExtensions() { + virtual URLRequestContextGetter* GetRequestContextForExtensions() { return original_profile_->GetRequestContextForExtensions(); } virtual net::SSLConfigService* GetSSLConfigService() { @@ -214,8 +214,7 @@ class AutomationProfileImpl : public Profile { protected: Profile* original_profile_; - scoped_refptr<net::CookieStore> alternate_cookie_store_; - scoped_refptr<URLRequestContext> alternate_reqeust_context_; + ChromeURLRequestContextGetter* alternate_request_context_; int tab_handle_; private: |