Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: webkit/quota/mock_storage_client.cc

Issue 7003021: Added DeleteOriginData to QuotaClient (Closed)
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/quota/mock_storage_client.h ('k') | webkit/quota/quota_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/quota/mock_storage_client.cc
diff --git a/webkit/quota/mock_storage_client.cc b/webkit/quota/mock_storage_client.cc
index e2e8a69e4f94119cc7996230cae4643d85ec4451..39958d1f86bdc9a27ebce06d99909de1ffd0e21c 100644
--- a/webkit/quota/mock_storage_client.cc
+++ b/webkit/quota/mock_storage_client.cc
@@ -52,6 +52,8 @@ MockStorageClient::~MockStorageClient() {
STLDeleteContainerPointers(usage_callbacks_.begin(), usage_callbacks_.end());
STLDeleteContainerPointers(
origins_callbacks_.begin(), origins_callbacks_.end());
+ STLDeleteContainerPointers(
+ deletion_callbacks_.begin(), deletion_callbacks_.end());
}
void MockStorageClient::AddMockOriginData(
@@ -111,6 +113,16 @@ void MockStorageClient::GetOriginsForHost(
type, host, callback));
}
+void MockStorageClient::DeleteOriginData(
+ const GURL& origin, StorageType type,
+ DeletionCallback* callback) {
+ deletion_callbacks_.insert(callback);
+ base::MessageLoopProxy::CreateForCurrentThread()->PostTask(
+ FROM_HERE, runnable_factory_.NewRunnableMethod(
+ &MockStorageClient::RunDeleteOriginData,
+ origin, type, callback));
+}
+
void MockStorageClient::RunGetOriginUsage(
const GURL& origin_url, StorageType type, GetUsageCallback* callback_ptr) {
usage_callbacks_.erase(callback_ptr);
@@ -151,4 +163,22 @@ void MockStorageClient::RunGetOriginsForHost(
callback->Run(origins);
}
+void MockStorageClient::RunDeleteOriginData(
+ const GURL& origin_url,
+ StorageType type,
+ DeletionCallback* callback_ptr) {
+ OriginDataMap::iterator itr
+ = origin_data_.find(make_pair(origin_url, type));
+ if (itr != origin_data_.end()) {
+ int64 delta = itr->second;
+ quota_manager_proxy_->
+ NotifyStorageModified(id(), origin_url, type, -delta);
+ origin_data_.erase(itr);
+ }
+
+ scoped_ptr<DeletionCallback> callback(callback_ptr);
+ deletion_callbacks_.erase(callback_ptr);
+ callback->Run(kQuotaStatusOk);
+}
+
} // namespace quota
« no previous file with comments | « webkit/quota/mock_storage_client.h ('k') | webkit/quota/quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698