summaryrefslogtreecommitdiffstats
path: root/webkit/database
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 00:34:32 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 00:34:32 +0000
commitdb4d4981a0089230ac88060d7c817e054de3f2e2 (patch)
tree2cfd032c1fdb6aece674d7a83d8a39ffeb410578 /webkit/database
parent80c2915f7a7e3857b52fceb22fd7ce30a4e3ec20 (diff)
downloadchromium_src-db4d4981a0089230ac88060d7c817e054de3f2e2.zip
chromium_src-db4d4981a0089230ac88060d7c817e054de3f2e2.tar.gz
chromium_src-db4d4981a0089230ac88060d7c817e054de3f2e2.tar.bz2
Use the QuotaManager to determine the space available to WebSQLDatabases. Since activity outside of the database system now affect how much space is available, our strategy for informing the client side of the new limit needed to change. It's not enough to just send the new limit when a change within the DB system has occurred.
This change depends on a webkit/webcore change. https://bugs.webkit.org/show_bug.cgi?id=60985 In this CL the renderer will ask the browser for the limit when needed. But also in this CL are ipc plumbing additions to support notifying the renderer as changes occur. That plumbing will be utilized in a later CL. * [Chrome] DatabaseMessageFilter uses the QuotaManager respond to the SpaceAvailable query. * [DRT] SimpleDatabaseSystem uses quota_per_origin_ data member to respond to the SpaceAvailable query. * Mostly mind numbing plumbing for WebKit API additions. // Sync getter for use on webcore's background db threads to // call out to chrome to get the value. long long WebKitClient::databaseGetSpaceAvailableForOrigin(origin_identifier); // Split the existing updateDatabaseSize method into three methods. Chrome calls into these. static void WebDatabase::updateDatabaseSize(originIdentifier, dbname, spaceAvailable); static void WebDatabase::updateSpaceAvailable(originIdentifier, spaceAvailable); static void WebDatabase::resetSpaceAvailable(originIdentifier); Review URL: http://codereview.chromium.org/7037018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database')
-rw-r--r--webkit/database/database_tracker.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/webkit/database/database_tracker.h b/webkit/database/database_tracker.h
index 2246a13..9894ea8 100644
--- a/webkit/database/database_tracker.h
+++ b/webkit/database/database_tracker.h
@@ -70,9 +70,8 @@ class OriginInfo {
// This class manages the main database, and keeps track of per origin quotas.
//
// The data in this class is not thread-safe, so all methods of this class
-// should be called on the same thread. The only exception is
-// database_directory() which returns a constant that is initialized when
-// the DatabaseTracker instance is created.
+// should be called on the same thread. The only exceptions are the ctor(),
+// the dtor() and the database_directory() and quota_manager_proxy() getters.
//
// Furthermore, some methods of this class have to read/write data from/to
// the disk. Therefore, in a multi-threaded application, all methods of this
@@ -124,10 +123,16 @@ class DatabaseTracker
virtual bool GetAllOriginIdentifiers(std::vector<string16>* origin_ids);
virtual bool GetAllOriginsInfo(std::vector<OriginInfo>* origins_info);
+ // TODO(michaeln): remove quota related stuff when quota manager
+ // integration is complete
void SetOriginQuota(const string16& origin_identifier, int64 new_quota);
int64 GetDefaultQuota() { return default_quota_; }
- // Sets the default quota for all origins. Should be used in tests only.
- void SetDefaultQuota(int64 quota);
+ void SetDefaultQuota(int64 quota); // for testing
+
+ // Safe to call on any thread.
+ quota::QuotaManagerProxy* quota_manager_proxy() const {
+ return quota_manager_proxy_.get();
+ }
bool IsDatabaseScheduledForDeletion(const string16& origin_identifier,
const string16& database_name);
@@ -151,8 +156,9 @@ class DatabaseTracker
// Delete all databases that belong to the given origin. Returns net::OK on
// success, net::FAILED if not all databases could be deleted, and
// net::ERR_IO_PENDING and |callback| is invoked upon completion, if non-NULL.
- int DeleteDataForOrigin(const string16& origin_identifier,
- net::CompletionCallback* callback);
+ // virtual for unit testing only
+ virtual int DeleteDataForOrigin(const string16& origin_identifier,
+ net::CompletionCallback* callback);
bool IsIncognitoProfile() const { return is_incognito_; }