summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-10 20:30:12 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-10 20:30:12 +0000
commit93ea1882c8b7e60e6325d67be11aecc61cdd4e9b (patch)
treee2136cd9c31c40ee0034d15aacd87eff6e2da14b
parent19e89d483c8c93eaa7e7038bfef8c626d1572bc3 (diff)
downloadchromium_src-93ea1882c8b7e60e6325d67be11aecc61cdd4e9b.zip
chromium_src-93ea1882c8b7e60e6325d67be11aecc61cdd4e9b.tar.gz
chromium_src-93ea1882c8b7e60e6325d67be11aecc61cdd4e9b.tar.bz2
Fixes for re-enabling more MSVC level 4 warnings: misc edition #1
This contains fixes for the following sorts of issues: * Signedness mismatch The problem here is that using enums to declare bitmasks results in the enum values being signed, when all consumers want to use the values in an unsigned context. Declaring them as consts allows using the more appropriate uint32 type. In C++11 we could use "enum class" for this, but C++11 isn't legal yet. BUG=81439 TEST=none Review URL: https://codereview.chromium.org/385443002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282419 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover_unittest.cc127
-rw-r--r--chrome/browser/extensions/data_deleter.cc6
-rw-r--r--content/browser/storage_partition_impl.cc15
-rw-r--r--content/browser/storage_partition_impl_map.cc3
-rw-r--r--content/browser/storage_partition_impl_unittest.cc31
-rw-r--r--content/public/browser/storage_partition.h50
6 files changed, 100 insertions, 132 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 860b909..909be18 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -827,11 +827,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookieForever) {
// Verify that storage partition was instructed to remove the cookies.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_COOKIES));
+ StoragePartition::REMOVE_DATA_MASK_COOKIES);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
}
@@ -847,14 +845,11 @@ TEST_F(BrowsingDataRemoverTest, RemoveCookieLastHour) {
// Verify that storage partition was instructed to remove the cookies.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_COOKIES));
+ StoragePartition::REMOVE_DATA_MASK_COOKIES);
// Removing with time period other than EVERYTHING should not clear
// persistent storage data.
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
- ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT));
+ ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
}
@@ -948,11 +943,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveUnprotectedLocalStorageForever) {
// Verify that storage partition was instructed to remove the data correctly.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE));
+ StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
@@ -981,11 +974,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveProtectedLocalStorageForever) {
// Verify that storage partition was instructed to remove the data correctly.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE));
+ StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
@@ -1012,13 +1003,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveLocalStorageForLastWeek) {
// Verify that storage partition was instructed to remove the data correctly.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE));
+ StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE);
// Persistent storage won't be deleted.
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
- ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT));
+ ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
EXPECT_EQ(removal_data.remove_begin, GetBeginTime());
@@ -1112,11 +1100,9 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypes) {
// partition was requested to remove cookie.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_COOKIES));
+ StoragePartition::REMOVE_DATA_MASK_COOKIES);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
}
// This should crash (DCHECK) in Debug, but death tests don't work properly
@@ -1147,13 +1133,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveMultipleTypesHistoryProhibited) {
// the partition was requested to remove cookie.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_COOKIES));
+ StoragePartition::REMOVE_DATA_MASK_COOKIES);
// Persistent storage won't be deleted, since EVERYTHING was not specified.
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
- ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT));
+ ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT);
}
#endif
@@ -1174,14 +1157,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverBoth) {
// Verify storage partition related stuffs.
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
}
@@ -1207,14 +1188,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyTemporary) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
// Check that all related origin data would be removed, that is, origin
@@ -1246,14 +1225,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverOnlyPersistent) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
// Check that all related origin data would be removed, that is, origin
@@ -1286,14 +1263,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverNeither) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
// Check that all related origin data would be removed, that is, origin
@@ -1322,14 +1297,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForeverSpecificOrigin) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_EQ(removal_data.remove_origin, kOrigin1);
}
@@ -1351,11 +1324,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastHour) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
// Persistent data would be left out since we are not removing from
// beginning of time.
@@ -1385,11 +1357,10 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedDataForLastWeek) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
// Persistent data would be left out since we are not removing from
// beginning of time.
@@ -1425,14 +1396,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedUnprotectedOrigins) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
// Check OriginMatcherFunction, |kOrigin1| would not match mask since it
@@ -1467,14 +1436,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedSpecificOrigin) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_EQ(removal_data.remove_origin, kOrigin1);
// Check OriginMatcherFunction, |kOrigin1| would not match mask since it
@@ -1510,14 +1477,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedProtectedOrigins) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
// Check OriginMatcherFunction, |kOrigin1| would match mask since we
@@ -1549,14 +1514,12 @@ TEST_F(BrowsingDataRemoverTest, RemoveQuotaManagedIgnoreExtensionsAndDevTools) {
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData();
EXPECT_EQ(removal_data.remove_mask,
- static_cast<uint32>(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
+ StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
StoragePartition::REMOVE_DATA_MASK_WEBSQL |
StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB);
EXPECT_EQ(removal_data.quota_storage_remove_mask,
- static_cast<uint32>(
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL));
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL);
EXPECT_TRUE(removal_data.remove_origin.is_empty());
// Check that extension and devtools data wouldn't be removed, that is,
diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc
index 9d8ffb7..b28e7b2 100644
--- a/chrome/browser/extensions/data_deleter.cc
+++ b/chrome/browser/extensions/data_deleter.cc
@@ -53,8 +53,7 @@ void DeleteOrigin(Profile* profile,
// simpler than special casing. This code should go away once we merge
// the various URLRequestContexts (http://crbug.com/159193).
partition->ClearDataForOrigin(
- StoragePartition::REMOVE_DATA_MASK_ALL &
- (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE),
+ ~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
origin,
profile->GetRequestContextForExtensions());
@@ -62,8 +61,7 @@ void DeleteOrigin(Profile* profile,
// We don't need to worry about the media request context because that
// shares the same cookie store as the main request context.
partition->ClearDataForOrigin(
- StoragePartition::REMOVE_DATA_MASK_ALL &
- (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE),
+ ~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
origin,
partition->GetURLRequestContext());
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 9a876b5..13b36f5 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -191,6 +191,21 @@ void ClearSessionStorageOnUIThread(
} // namespace
+// static
+const uint32 StoragePartition::REMOVE_DATA_MASK_APPCACHE = 1 << 0;
+const uint32 StoragePartition::REMOVE_DATA_MASK_COOKIES = 1 << 1;
+const uint32 StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2;
+const uint32 StoragePartition::REMOVE_DATA_MASK_INDEXEDDB = 1 << 3;
+const uint32 StoragePartition::REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4;
+const uint32 StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5;
+const uint32 StoragePartition::REMOVE_DATA_MASK_WEBSQL = 1 << 6;
+const uint32 StoragePartition::REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7;
+const uint32 StoragePartition::REMOVE_DATA_MASK_ALL = 0xFFFFFFFF;
+const uint32 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_TEMPORARY = 1 << 0;
+const uint32 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1;
+const uint32 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2;
+const uint32 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL = 0xFFFFFFFF;
+
// Static.
int StoragePartitionImpl::GenerateQuotaClientMask(uint32 remove_mask) {
int quota_client_mask = 0;
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
index d1d2a55..1c5175d 100644
--- a/content/browser/storage_partition_impl_map.cc
+++ b/content/browser/storage_partition_impl_map.cc
@@ -494,8 +494,7 @@ void StoragePartitionImplMap::AsyncObliterate(
if (config.partition_domain == partition_domain) {
it->second->ClearData(
// All except shader cache.
- StoragePartition::REMOVE_DATA_MASK_ALL &
- (~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE),
+ ~StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE,
StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
GURL(),
StoragePartition::OriginMatcherFunction(),
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc
index 5fbdfbb..436817c 100644
--- a/content/browser/storage_partition_impl_unittest.cc
+++ b/content/browser/storage_partition_impl_unittest.cc
@@ -55,10 +55,10 @@ const quota::StorageType kPersistent = quota::kStorageTypePersistent;
const quota::QuotaClient::ID kClientFile = quota::QuotaClient::kFileSystem;
const uint32 kAllQuotaRemoveMask =
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB |
- StoragePartition::REMOVE_DATA_MASK_WEBSQL |
+ StoragePartition::REMOVE_DATA_MASK_APPCACHE |
StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
- StoragePartition::REMOVE_DATA_MASK_APPCACHE;
+ StoragePartition::REMOVE_DATA_MASK_INDEXEDDB |
+ StoragePartition::REMOVE_DATA_MASK_WEBSQL;
class AwaitCompletionHelper {
public:
@@ -246,11 +246,10 @@ bool DoesOriginMatchUnprotected(
void ClearQuotaData(content::StoragePartition* partition,
base::RunLoop* loop_to_quit) {
- partition->ClearData(
- kAllQuotaRemoveMask,
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
- GURL(), StoragePartition::OriginMatcherFunction(),
- base::Time(), base::Time::Max(), loop_to_quit->QuitClosure());
+ partition->ClearData(kAllQuotaRemoveMask,
+ StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(),
+ StoragePartition::OriginMatcherFunction(), base::Time(),
+ base::Time::Max(), loop_to_quit->QuitClosure());
}
void ClearQuotaDataWithOriginMatcher(
@@ -280,13 +279,11 @@ void ClearQuotaDataForNonPersistent(
content::StoragePartition* partition,
const base::Time delete_begin,
base::RunLoop* loop_to_quit) {
- uint32 quota_storage_remove_mask_no_persistent =
- StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL &
- ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT;
partition->ClearData(
- kAllQuotaRemoveMask, quota_storage_remove_mask_no_persistent,
- GURL(), StoragePartition::OriginMatcherFunction(),
- delete_begin, base::Time::Max(), loop_to_quit->QuitClosure());
+ kAllQuotaRemoveMask,
+ ~StoragePartition::QUOTA_MANAGED_STORAGE_MASK_PERSISTENT,
+ GURL(), StoragePartition::OriginMatcherFunction(), delete_begin,
+ base::Time::Max(), loop_to_quit->QuitClosure());
}
void ClearCookies(content::StoragePartition* partition,
@@ -432,11 +429,7 @@ TEST_F(StoragePartitionImplTest, QuotaClientMaskGeneration) {
quota::QuotaClient::kDatabase |
quota::QuotaClient::kAppcache |
quota::QuotaClient::kIndexedDatabase,
- StoragePartitionImpl::GenerateQuotaClientMask(
- StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS |
- StoragePartition::REMOVE_DATA_MASK_WEBSQL |
- StoragePartition::REMOVE_DATA_MASK_APPCACHE |
- StoragePartition::REMOVE_DATA_MASK_INDEXEDDB));
+ StoragePartitionImpl::GenerateQuotaClientMask(kAllQuotaRemoveMask));
}
void PopulateTestQuotaManagedPersistentData(MockQuotaManager* manager) {
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h
index f7800b9..2b26e16 100644
--- a/content/public/browser/storage_partition.h
+++ b/content/public/browser/storage_partition.h
@@ -8,10 +8,17 @@
#include <string>
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "base/files/file_path.h"
+#include "base/time/time.h"
+#include "content/common/content_export.h"
class GURL;
+namespace base {
+class Time;
+}
+
namespace fileapi {
class FileSystemContext;
}
@@ -43,7 +50,7 @@ class ServiceWorkerContext;
// persistent state inside the BrowserContext. This is used to implement
// isolated storage where a renderer with isolated storage cannot see
// the cookies, localStorage, etc., that normal web renderers have access to.
-class StoragePartition {
+class CONTENT_EXPORT StoragePartition {
public:
virtual base::FilePath GetPath() = 0;
virtual net::URLRequestContextGetter* GetURLRequestContext() = 0;
@@ -56,30 +63,23 @@ class StoragePartition {
virtual IndexedDBContext* GetIndexedDBContext() = 0;
virtual ServiceWorkerContext* GetServiceWorkerContext() = 0;
- enum RemoveDataMask {
- REMOVE_DATA_MASK_APPCACHE = 1 << 0,
- REMOVE_DATA_MASK_COOKIES = 1 << 1,
- REMOVE_DATA_MASK_FILE_SYSTEMS = 1 << 2,
- REMOVE_DATA_MASK_INDEXEDDB = 1 << 3,
- REMOVE_DATA_MASK_LOCAL_STORAGE = 1 << 4,
- REMOVE_DATA_MASK_SHADER_CACHE = 1 << 5,
- REMOVE_DATA_MASK_WEBSQL = 1 << 6,
- REMOVE_DATA_MASK_WEBRTC_IDENTITY = 1 << 7,
- REMOVE_DATA_MASK_ALL = -1
- };
-
- enum QuotaManagedStorageMask {
- // Corresponds to quota::kStorageTypeTemporary.
- QUOTA_MANAGED_STORAGE_MASK_TEMPORARY = 1 << 0,
-
- // Corresponds to quota::kStorageTypePersistent.
- QUOTA_MANAGED_STORAGE_MASK_PERSISTENT = 1 << 1,
-
- // Corresponds to quota::kStorageTypeSyncable.
- QUOTA_MANAGED_STORAGE_MASK_SYNCABLE = 1 << 2,
-
- QUOTA_MANAGED_STORAGE_MASK_ALL = -1
- };
+ static const uint32 REMOVE_DATA_MASK_APPCACHE;
+ static const uint32 REMOVE_DATA_MASK_COOKIES;
+ static const uint32 REMOVE_DATA_MASK_FILE_SYSTEMS;
+ static const uint32 REMOVE_DATA_MASK_INDEXEDDB;
+ static const uint32 REMOVE_DATA_MASK_LOCAL_STORAGE;
+ static const uint32 REMOVE_DATA_MASK_SHADER_CACHE;
+ static const uint32 REMOVE_DATA_MASK_WEBSQL;
+ static const uint32 REMOVE_DATA_MASK_WEBRTC_IDENTITY;
+ static const uint32 REMOVE_DATA_MASK_ALL;
+
+ // Corresponds to quota::kStorageTypeTemporary.
+ static const uint32 QUOTA_MANAGED_STORAGE_MASK_TEMPORARY;
+ // Corresponds to quota::kStorageTypePersistent.
+ static const uint32 QUOTA_MANAGED_STORAGE_MASK_PERSISTENT;
+ // Corresponds to quota::kStorageTypeSyncable.
+ static const uint32 QUOTA_MANAGED_STORAGE_MASK_SYNCABLE;
+ static const uint32 QUOTA_MANAGED_STORAGE_MASK_ALL;
// Starts an asynchronous task that does a best-effort clear the data
// corresponding to the given |remove_mask| and |quota_storage_remove_mask|