summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.h
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 06:33:31 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 06:33:31 +0000
commitbe180c8044f145310f9eb13fd2cab5fd20e88220 (patch)
tree707ac9f3f95f5191664dbdac2ff3f34ab08ad8e7 /chrome/browser/profile.h
parent4cb1d3be9986c105608991f3dde12c6346335060 (diff)
downloadchromium_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/profile.h')
-rw-r--r--chrome/browser/profile.h38
1 files changed, 15 insertions, 23 deletions
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h
index a9ac35a..d190989 100644
--- a/chrome/browser/profile.h
+++ b/chrome/browser/profile.h
@@ -25,11 +25,11 @@ namespace net {
class StrictTransportSecurityState;
class SSLConfigService;
}
+
class Blacklist;
class BookmarkModel;
class BrowserThemeProvider;
-class ChromeAppCacheService;
-class ChromeURLRequestContext;
+class ChromeURLRequestContextGetter;
class DesktopNotificationService;
class DownloadManager;
class Extension;
@@ -54,7 +54,7 @@ class TemplateURLFetcher;
class TemplateURLModel;
class ThemeProvider;
class ThumbnailStore;
-class URLRequestContext;
+class URLRequestContextGetter;
class UserScriptMaster;
class VisitedLinkMaster;
class VisitedLinkEventListener;
@@ -110,7 +110,7 @@ class Profile {
//
// 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 URLRequestContext* GetDefaultRequestContext();
+ static URLRequestContextGetter* GetDefaultRequestContext();
// Returns a unique Id that can be used to identify this profile at runtime.
// This Id is not persistent and will not survive a restart of the browser.
@@ -134,11 +134,6 @@ class Profile {
// profile is not off the record.
virtual Profile* GetOriginalProfile() = 0;
- // Retrieves a pointer to the AppCacheService for this profile.
- // Chrome request contexts associated with this profile also have
- // a reference to this instance.
- virtual ChromeAppCacheService* GetAppCacheService() = 0;
-
// Retrieves a pointer to the VisitedLinkMaster associated with this
// profile. The VisitedLinkMaster is lazily created the first time
// that this method is called.
@@ -261,15 +256,15 @@ class Profile {
//
// 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 URLRequestContext* GetRequestContext() = 0;
+ virtual URLRequestContextGetter* GetRequestContext() = 0;
// Returns the request context for media resources asociated with this
// profile.
- virtual URLRequestContext* GetRequestContextForMedia() = 0;
+ virtual URLRequestContextGetter* GetRequestContextForMedia() = 0;
// Returns the request context used for extension-related requests. This
// is only used for a separate cookie store currently.
- virtual URLRequestContext* GetRequestContextForExtensions() = 0;
+ virtual URLRequestContextGetter* GetRequestContextForExtensions() = 0;
// Returns the SSLConfigService for this profile.
virtual net::SSLConfigService* GetSSLConfigService() = 0;
@@ -360,7 +355,7 @@ class Profile {
#ifdef UNIT_TEST
// Use with caution. GetDefaultRequestContext may be called on any thread!
- static void set_default_request_context(URLRequestContext* c) {
+ static void set_default_request_context(URLRequestContextGetter* c) {
default_request_context_ = c;
}
#endif
@@ -374,7 +369,7 @@ class Profile {
}
protected:
- static URLRequestContext* default_request_context_;
+ static URLRequestContextGetter* default_request_context_;
private:
bool restored_last_session_;
@@ -395,7 +390,6 @@ class ProfileImpl : public Profile,
virtual Profile* GetOffTheRecordProfile();
virtual void DestroyOffTheRecordProfile();
virtual Profile* GetOriginalProfile();
- virtual ChromeAppCacheService* GetAppCacheService();
virtual VisitedLinkMaster* GetVisitedLinkMaster();
virtual UserScriptMaster* GetUserScriptMaster();
virtual SSLHostState* GetSSLHostState();
@@ -421,9 +415,9 @@ class ProfileImpl : public Profile,
virtual ThemeProvider* GetThemeProvider();
virtual ThumbnailStore* GetThumbnailStore();
virtual bool HasCreatedDownloadManager() const;
- virtual URLRequestContext* GetRequestContext();
- virtual URLRequestContext* GetRequestContextForMedia();
- virtual URLRequestContext* GetRequestContextForExtensions();
+ virtual URLRequestContextGetter* GetRequestContext();
+ virtual URLRequestContextGetter* GetRequestContextForMedia();
+ virtual URLRequestContextGetter* GetRequestContextForExtensions();
virtual net::SSLConfigService* GetSSLConfigService();
virtual Blacklist* GetBlacklist();
virtual SessionService* GetSessionService();
@@ -505,13 +499,11 @@ class ProfileImpl : public Profile,
scoped_ptr<ProfileSyncService> sync_service_;
#endif
- ChromeAppCacheService* appcache_service_;
-
- ChromeURLRequestContext* request_context_;
+ ChromeURLRequestContextGetter* request_context_;
- ChromeURLRequestContext* media_request_context_;
+ ChromeURLRequestContextGetter* media_request_context_;
- ChromeURLRequestContext* extensions_request_context_;
+ ChromeURLRequestContextGetter* extensions_request_context_;
scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;