diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-19 00:08:28 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-19 00:08:28 +0000 |
commit | c0e55036275c4b8bffb82439bd19a8562c870251 (patch) | |
tree | 1bda34b24bffd68db940f27146476671480b5fe6 /content/shell/shell_browser_context.cc | |
parent | e2ccb522ea5a3971629af09dc5b0b24bbc35fbf6 (diff) | |
download | chromium_src-c0e55036275c4b8bffb82439bd19a8562c870251.zip chromium_src-c0e55036275c4b8bffb82439bd19a8562c870251.tar.gz chromium_src-c0e55036275c4b8bffb82439bd19a8562c870251.tar.bz2 |
Reverting to green up the memory waterfall.
BUG=114787
Revert 122521 - Move creation of BrowserContext objects that live in content to content, instead of depending on the embedder. Apart from allowing us to hide more of content from embedders, it simplifies the work that every embedder has to do (see the change the shell_browser_context.cc as an example).
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9419033
TBR=jam@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9421023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/shell_browser_context.cc')
-rw-r--r-- | content/shell/shell_browser_context.cc | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index b118413..cd47383 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -10,7 +10,10 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/threading/thread.h" +#include "content/browser/appcache/chrome_appcache_service.h" +#include "content/browser/chrome_blob_storage_context.h" #include "content/browser/download/download_manager_impl.h" +#include "content/browser/file_system/browser_file_system_helper.h" #include "content/browser/host_zoom_map_impl.h" #include "content/browser/in_process_webkit/webkit_context.h" #include "content/public/browser/browser_thread.h" @@ -20,6 +23,8 @@ #include "content/shell/shell_download_manager_delegate.h" #include "content/shell/shell_resource_context.h" #include "content/shell/shell_url_request_context_getter.h" +#include "webkit/database/database_tracker.h" +#include "webkit/quota/quota_manager.h" #if defined(OS_WIN) #include "base/base_paths_win.h" @@ -159,7 +164,7 @@ ResourceContext* ShellBrowserContext::GetResourceContext() { if (!resource_context_.get()) { resource_context_.reset(new ShellResourceContext( static_cast<ShellURLRequestContextGetter*>(GetRequestContext()), - BrowserContext::GetBlobStorageContext(this))); + GetBlobStorageContext())); } return resource_context_.get(); } @@ -189,8 +194,73 @@ bool ShellBrowserContext::DidLastSessionExitCleanly() { return true; } -quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { - return NULL; +quota::QuotaManager* ShellBrowserContext::GetQuotaManager() { + CreateQuotaManagerAndClients(); + return quota_manager_.get(); +} + +WebKitContext* ShellBrowserContext::GetWebKitContext() { + CreateQuotaManagerAndClients(); + return webkit_context_.get(); +} + +webkit_database::DatabaseTracker* ShellBrowserContext::GetDatabaseTracker() { + CreateQuotaManagerAndClients(); + return db_tracker_; +} + +ChromeBlobStorageContext* ShellBrowserContext::GetBlobStorageContext() { + if (!blob_storage_context_) { + blob_storage_context_ = new ChromeBlobStorageContext(); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind( + &ChromeBlobStorageContext::InitializeOnIOThread, + blob_storage_context_.get())); + } + return blob_storage_context_; +} + +ChromeAppCacheService* ShellBrowserContext::GetAppCacheService() { + CreateQuotaManagerAndClients(); + return appcache_service_; +} + +fileapi::FileSystemContext* ShellBrowserContext::GetFileSystemContext() { + CreateQuotaManagerAndClients(); + return file_system_context_.get(); +} + +void ShellBrowserContext::CreateQuotaManagerAndClients() { + if (quota_manager_.get()) + return; + quota_manager_ = new quota::QuotaManager( + IsOffTheRecord(), + GetPath(), + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), + NULL); + + file_system_context_ = CreateFileSystemContext( + GetPath(), IsOffTheRecord(), NULL, quota_manager_->proxy()); + db_tracker_ = new webkit_database::DatabaseTracker( + GetPath(), IsOffTheRecord(), false, NULL, quota_manager_->proxy(), + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); + webkit_context_ = new WebKitContext( + IsOffTheRecord(), GetPath(), NULL, false, quota_manager_->proxy(), + BrowserThread::GetMessageLoopProxyForThread( + BrowserThread::WEBKIT_DEPRECATED)); + appcache_service_ = new ChromeAppCacheService(quota_manager_->proxy()); + scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy; + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind( + &ChromeAppCacheService::InitializeOnIOThread, + appcache_service_.get(), + IsOffTheRecord() + ? FilePath() : GetPath().Append(FILE_PATH_LITERAL("AppCache")), + GetResourceContext(), + special_storage_policy)); } } // namespace content |