summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-27 13:20:14 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-27 13:20:14 +0000
commit595765cf3c42fda899d308e6f875dd5627837989 (patch)
treeca06cb28f9a65f472011b0dc5f94d9b0ee9f653c /chrome
parent216f6923c677b509de56a4735f91eafdd21d6fc2 (diff)
downloadchromium_src-595765cf3c42fda899d308e6f875dd5627837989.zip
chromium_src-595765cf3c42fda899d308e6f875dd5627837989.tar.gz
chromium_src-595765cf3c42fda899d308e6f875dd5627837989.tar.bz2
Add 1st cut of QuotaManager code
No persistent storage support yet. Some notes: - There are a lot of TODOs especially for persistent type storage handling. - QuotaTask base class is for now only subclassed by QuotaInitializeTask, but it is planned to add more subclasses. BUG=61676,79639 TEST=QuotaManagerTest.* Review URL: http://codereview.chromium.org/6826052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/profiles/profile.cc14
-rw-r--r--chrome/browser/profiles/profile.h6
-rw-r--r--chrome/browser/profiles/profile_impl.cc12
-rw-r--r--chrome/browser/profiles/profile_impl.h2
-rw-r--r--chrome/test/testing_profile.cc4
-rw-r--r--chrome/test/testing_profile.h1
6 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index 0e135bf..0b0f2e1 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -53,6 +53,7 @@
#include "net/base/transport_security_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/database/database_tracker.h"
+#include "webkit/quota/quota_manager.h"
#if defined(TOOLKIT_USES_GTK)
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
@@ -407,6 +408,17 @@ class OffTheRecordProfileImpl : public Profile,
return io_data_.GetMainRequestContextGetter();
}
+ virtual quota::QuotaManager* GetQuotaManager() {
+ if (!quota_manager_.get()) {
+ quota_manager_ = new quota::QuotaManager(
+ IsOffTheRecord(),
+ GetPath(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB));
+ }
+ return quota_manager_.get();
+ }
+
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
int renderer_child_id) {
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -733,6 +745,8 @@ class OffTheRecordProfileImpl : public Profile,
scoped_ptr<ChromeURLDataManager> chrome_url_data_manager_;
+ scoped_refptr<quota::QuotaManager> quota_manager_;
+
// Used read-only.
scoped_refptr<TransportSecurityPersister> transport_security_loader_;
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index cb082da..bbc6658 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -38,6 +38,10 @@ namespace prerender {
class PrerenderManager;
}
+namespace quota {
+class QuotaManager;
+}
+
namespace webkit_database {
class DatabaseTracker;
}
@@ -322,6 +326,8 @@ class Profile {
// by the profile.
virtual fileapi::FileSystemContext* GetFileSystemContext() = 0;
+ virtual quota::QuotaManager* GetQuotaManager() = 0;
+
// Returns the BrowserSignin object assigned to this profile.
virtual BrowserSignin* GetBrowserSignin() = 0;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 5a7e2ef..96c1487 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -99,6 +99,7 @@
#include "net/base/transport_security_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/database/database_tracker.h"
+#include "webkit/quota/quota_manager.h"
#if defined(OS_WIN)
#include "chrome/browser/instant/promo_counter.h"
@@ -1161,6 +1162,17 @@ fileapi::FileSystemContext* ProfileImpl::GetFileSystemContext() {
return file_system_context_.get();
}
+quota::QuotaManager* ProfileImpl::GetQuotaManager() {
+ if (!quota_manager_.get()) {
+ quota_manager_ = new quota::QuotaManager(
+ IsOffTheRecord(),
+ GetPath(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB));
+ }
+ return quota_manager_.get();
+}
+
SessionService* ProfileImpl::GetSessionService() {
if (!session_service_.get() && !shutdown_session_service_) {
session_service_.reset(new SessionService(this));
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 0a5758e..0119610 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -79,6 +79,7 @@ class ProfileImpl : public Profile,
virtual DownloadManager* GetDownloadManager();
virtual PersonalDataManager* GetPersonalDataManager();
virtual fileapi::FileSystemContext* GetFileSystemContext();
+ virtual quota::QuotaManager* GetQuotaManager();
virtual bool HasCreatedDownloadManager() const;
virtual net::URLRequestContextGetter* GetRequestContext();
virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess(
@@ -250,6 +251,7 @@ class ProfileImpl : public Profile,
scoped_refptr<PersonalDataManager> personal_data_manager_;
scoped_refptr<fileapi::FileSystemContext> file_system_context_;
scoped_ptr<BrowserSignin> browser_signin_;
+ scoped_refptr<quota::QuotaManager> quota_manager_;
bool history_service_created_;
bool favicon_service_created_;
bool created_web_data_service_;
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index a1565c1..560c603 100644
--- a/chrome/test/testing_profile.cc
+++ b/chrome/test/testing_profile.cc
@@ -541,6 +541,10 @@ fileapi::FileSystemContext* TestingProfile::GetFileSystemContext() {
return NULL;
}
+quota::QuotaManager* TestingProfile::GetQuotaManager() {
+ return NULL;
+}
+
BrowserSignin* TestingProfile::GetBrowserSignin() {
return NULL;
}
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index 2558043..1543b35 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -188,6 +188,7 @@ class TestingProfile : public Profile {
virtual DownloadManager* GetDownloadManager();
virtual PersonalDataManager* GetPersonalDataManager();
virtual fileapi::FileSystemContext* GetFileSystemContext();
+ virtual quota::QuotaManager* GetQuotaManager();
virtual BrowserSignin* GetBrowserSignin();
virtual bool HasCreatedDownloadManager() const;