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

Unified Diff: webkit/quota/mock_quota_manager.cc

Issue 7839029: QuotaManager::DeleteOriginData now allows deletion of specific QuotaClients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kinuko's feedback (modulo kMockStart) Created 8 years, 10 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_quota_manager.h ('k') | webkit/quota/mock_quota_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/quota/mock_quota_manager.cc
diff --git a/webkit/quota/mock_quota_manager.cc b/webkit/quota/mock_quota_manager.cc
index 52d27351e60015b0483889370e9e2827c657a1c3..bac3fcc02a56b034b44c0f7d39707d1dc5a6fe54 100644
--- a/webkit/quota/mock_quota_manager.cc
+++ b/webkit/quota/mock_quota_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -75,16 +75,20 @@ class MockQuotaManager::DeleteOriginDataTask : public QuotaThreadTask {
MockQuotaManager::OriginInfo::OriginInfo(
const GURL& origin,
StorageType type,
+ int quota_client_mask,
base::Time modified)
: origin(origin),
type(type),
+ quota_client_mask(quota_client_mask),
modified(modified) {
}
MockQuotaManager::OriginInfo::~OriginInfo() {}
-MockQuotaManager::MockQuotaManager(bool is_incognito,
- const FilePath& profile_path, base::MessageLoopProxy* io_thread,
+MockQuotaManager::MockQuotaManager(
+ bool is_incognito,
+ const FilePath& profile_path,
+ base::MessageLoopProxy* io_thread,
base::MessageLoopProxy* db_thread,
SpecialStoragePolicy* special_storage_policy)
: QuotaManager(is_incognito, profile_path, io_thread, db_thread,
@@ -93,18 +97,25 @@ MockQuotaManager::MockQuotaManager(bool is_incognito,
MockQuotaManager::~MockQuotaManager() {}
-bool MockQuotaManager::AddOrigin(const GURL& origin, StorageType type,
+bool MockQuotaManager::AddOrigin(
+ const GURL& origin,
+ StorageType type,
+ int quota_client_mask,
base::Time modified) {
- origins_.push_back(OriginInfo(origin, type, modified));
+ origins_.push_back(OriginInfo(origin, type, quota_client_mask, modified));
return true;
}
-bool MockQuotaManager::OriginHasData(const GURL& origin,
- StorageType type) const {
+bool MockQuotaManager::OriginHasData(
+ const GURL& origin,
+ StorageType type,
+ QuotaClient::ID quota_client) const {
for (std::vector<OriginInfo>::const_iterator current = origins_.begin();
current != origins_.end();
++current) {
- if (current->origin == origin && current->type == type)
+ if (current->origin == origin &&
+ current->type == type &&
+ current->quota_client_mask & quota_client)
return true;
}
return false;
@@ -125,13 +136,19 @@ void MockQuotaManager::GetOriginsModifiedSince(
callback))->Start();
}
-void MockQuotaManager::DeleteOriginData(const GURL& origin, StorageType type,
- const StatusCallback& callback) {
+void MockQuotaManager::DeleteOriginData(
+ const GURL& origin,
+ StorageType type,
+ int quota_client_mask,
+ const StatusCallback& callback) {
for (std::vector<OriginInfo>::iterator current = origins_.begin();
current != origins_.end();
++current) {
if (current->origin == origin && current->type == type) {
- origins_.erase(current);
+ // Modify the mask: if it's 0 after "deletion", remove the origin.
+ current->quota_client_mask &= ~quota_client_mask;
+ if (current->quota_client_mask == 0)
+ origins_.erase(current);
break;
}
}
« no previous file with comments | « webkit/quota/mock_quota_manager.h ('k') | webkit/quota/mock_quota_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698