diff options
author | mkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-05 08:39:54 +0000 |
---|---|---|
committer | mkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-05 08:39:54 +0000 |
commit | 4ac23ad25a6467cc360cc10bd05946a0936cac5c (patch) | |
tree | 6a9fd5641ce5143ddb891a3ca16bf558afb4736f /webkit/database | |
parent | 90a47480a17322e3c095b9cc7eefd5498224f1a4 (diff) | |
download | chromium_src-4ac23ad25a6467cc360cc10bd05946a0936cac5c.zip chromium_src-4ac23ad25a6467cc360cc10bd05946a0936cac5c.tar.gz chromium_src-4ac23ad25a6467cc360cc10bd05946a0936cac5c.tar.bz2 |
Quota: Add quota::StorageType to the GetOriginsCallback definition.
BUG=90996
TEST=test_shell_tests
Review URL: http://codereview.chromium.org/7533013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95591 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database')
-rw-r--r-- | webkit/database/database_quota_client.cc | 38 | ||||
-rw-r--r-- | webkit/database/database_quota_client.h | 17 | ||||
-rw-r--r-- | webkit/database/database_quota_client_unittest.cc | 5 |
3 files changed, 38 insertions, 22 deletions
diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc index 4ebfaf8..52f1fd5 100644 --- a/webkit/database/database_quota_client.cc +++ b/webkit/database/database_quota_client.cc @@ -89,8 +89,10 @@ class DatabaseQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase { public: GetAllOriginsTask( DatabaseQuotaClient* client, - base::MessageLoopProxy* db_tracker_thread) - : GetOriginsTaskBase(client, db_tracker_thread) { + base::MessageLoopProxy* db_tracker_thread, + quota::StorageType type) + : GetOriginsTaskBase(client, db_tracker_thread), + type_(type) { } protected: @@ -98,8 +100,11 @@ class DatabaseQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase { return true; } virtual void Completed() OVERRIDE { - client_->DidGetAllOrigins(origins_); + client_->DidGetAllOrigins(origins_, type_); } + + private: + quota::StorageType type_; }; class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { @@ -107,9 +112,11 @@ class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { GetOriginsForHostTask( DatabaseQuotaClient* client, base::MessageLoopProxy* db_tracker_thread, - const std::string& host) + const std::string& host, + quota::StorageType type) : GetOriginsTaskBase(client, db_tracker_thread), - host_(host) { + host_(host), + type_(type) { } private: @@ -117,9 +124,10 @@ class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { return host_ == net::GetHostOrSpecFromURL(origin); } virtual void Completed() OVERRIDE { - client_->DidGetOriginsForHost(host_, origins_); + client_->DidGetOriginsForHost(host_, origins_, type_); } std::string host_; + quota::StorageType type_; }; class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { @@ -222,13 +230,13 @@ void DatabaseQuotaClient::GetOriginsForType( // All databases are in the temp namespace for now. if (type != quota::kStorageTypeTemporary) { - callback->Run(std::set<GURL>()); + callback->Run(std::set<GURL>(), type); return; } if (origins_for_type_callbacks_.Add(callback.release())) { scoped_refptr<GetAllOriginsTask> task( - new GetAllOriginsTask(this, db_tracker_thread_)); + new GetAllOriginsTask(this, db_tracker_thread_, type)); task->Start(); } } @@ -243,13 +251,13 @@ void DatabaseQuotaClient::GetOriginsForHost( // All databases are in the temp namespace for now. if (type != quota::kStorageTypeTemporary) { - callback->Run(std::set<GURL>()); + callback->Run(std::set<GURL>(), type); return; } if (origins_for_host_callbacks_.Add(host, callback.release())) { scoped_refptr<GetOriginsForHostTask> task( - new GetOriginsForHostTask(this, db_tracker_thread_, host)); + new GetOriginsForHostTask(this, db_tracker_thread_, host, type)); task->Start(); } } @@ -279,15 +287,17 @@ void DatabaseQuotaClient::DidGetOriginUsage( usage_for_origin_callbacks_.Run(origin_url, usage); } -void DatabaseQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins) { +void DatabaseQuotaClient::DidGetAllOrigins(const std::set<GURL>& origins, + quota::StorageType type) { DCHECK(origins_for_type_callbacks_.HasCallbacks()); - origins_for_type_callbacks_.Run(origins); + origins_for_type_callbacks_.Run(origins, type); } void DatabaseQuotaClient::DidGetOriginsForHost( - const std::string& host, const std::set<GURL>& origins) { + const std::string& host, const std::set<GURL>& origins, + quota::StorageType type) { DCHECK(origins_for_host_callbacks_.HasCallbacks(host)); - origins_for_host_callbacks_.Run(host, origins); + origins_for_host_callbacks_.Run(host, origins, type); } } // namespace webkit_database diff --git a/webkit/database/database_quota_client.h b/webkit/database/database_quota_client.h index acc839e..fb37ff61 100644 --- a/webkit/database/database_quota_client.h +++ b/webkit/database/database_quota_client.h @@ -56,20 +56,23 @@ class DatabaseQuotaClient : public quota::QuotaClient, GURL, // origin int64 > UsageForOriginCallbackMap; - typedef quota::CallbackQueue1 + typedef quota::CallbackQueue2 <GetOriginsCallback*, - const std::set<GURL>& + const std::set<GURL>&, + quota::StorageType > OriginsForTypeCallbackQueue; - typedef quota::CallbackQueueMap1 + typedef quota::CallbackQueueMap2 <GetOriginsCallback*, std::string, // host - const std::set<GURL>& + const std::set<GURL>&, + quota::StorageType > OriginsForHostCallbackMap; void DidGetOriginUsage(const GURL& origin_url, int64 usage); - void DidGetAllOrigins(const std::set<GURL>& origins); - void DidGetOriginsForHost( - const std::string& host, const std::set<GURL>& origins); + void DidGetAllOrigins(const std::set<GURL>& origins, quota::StorageType type); + void DidGetOriginsForHost(const std::string& host, + const std::set<GURL>& origins, + quota::StorageType type); scoped_refptr<base::MessageLoopProxy> db_tracker_thread_; scoped_refptr<DatabaseTracker> db_tracker_; // only used on its thread diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc index 9bbae9e..cc2762a 100644 --- a/webkit/database/database_quota_client_unittest.cc +++ b/webkit/database/database_quota_client_unittest.cc @@ -184,8 +184,10 @@ class DatabaseQuotaClientTest : public testing::Test { usage_ = usage; } - void OnGetOriginsComplete(const std::set<GURL>& origins) { + void OnGetOriginsComplete(const std::set<GURL>& origins, + quota::StorageType type) { origins_ = origins; + type_ = type; } void OnDeleteOriginDataComplete(quota::QuotaStatusCode status) { @@ -194,6 +196,7 @@ class DatabaseQuotaClientTest : public testing::Test { int64 usage_; std::set<GURL> origins_; + quota::StorageType type_; quota::QuotaStatusCode delete_status_; scoped_refptr<MockDatabaseTracker> mock_tracker_; base::ScopedCallbackFactory<DatabaseQuotaClientTest> callback_factory_; |