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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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 | « content/browser/storage_partition_impl.h ('k') | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/storage_partition_impl.cc
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 134c1617768d662b63465ce7f0ff6ecc6568b20c..36af20223f30f2fcc7ad58663541c231fd30c0c8 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -72,13 +72,13 @@ void CheckQuotaManagedDataDeletionStatus(size_t* deletion_task_count,
}
void OnQuotaManagedOriginDeleted(const GURL& origin,
- quota::StorageType type,
+ storage::StorageType type,
size_t* deletion_task_count,
const base::Closure& callback,
- quota::QuotaStatusCode status) {
+ storage::QuotaStatusCode status) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_GT(*deletion_task_count, 0u);
- if (status != quota::kQuotaStatusOk) {
+ if (status != storage::kQuotaStatusOk) {
DLOG(ERROR) << "Couldn't remove data of type " << type << " for origin "
<< origin << ". Status: " << status;
}
@@ -108,7 +108,7 @@ void ClearShaderCacheOnIOThread(const base::FilePath& path,
void OnLocalStorageUsageInfo(
const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const base::Time delete_begin,
const base::Time delete_end,
@@ -132,7 +132,7 @@ void OnLocalStorageUsageInfo(
void OnSessionStorageUsageInfo(
const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const base::Closure& callback,
const std::vector<SessionStorageUsageInfo>& infos) {
@@ -151,7 +151,7 @@ void OnSessionStorageUsageInfo(
void ClearLocalStorageOnUIThread(
const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const GURL& storage_origin,
const base::Time begin,
@@ -178,7 +178,7 @@ void ClearLocalStorageOnUIThread(
void ClearSessionStorageOnUIThread(
const scoped_refptr<DOMStorageContextWrapper>& dom_storage_context,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const base::Closure& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -226,13 +226,13 @@ int StoragePartitionImpl::GenerateQuotaClientMask(uint32 remove_mask) {
int quota_client_mask = 0;
if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS)
- quota_client_mask |= quota::QuotaClient::kFileSystem;
+ quota_client_mask |= storage::QuotaClient::kFileSystem;
if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL)
- quota_client_mask |= quota::QuotaClient::kDatabase;
+ quota_client_mask |= storage::QuotaClient::kDatabase;
if (remove_mask & StoragePartition::REMOVE_DATA_MASK_APPCACHE)
- quota_client_mask |= quota::QuotaClient::kAppcache;
+ quota_client_mask |= storage::QuotaClient::kAppcache;
if (remove_mask & StoragePartition::REMOVE_DATA_MASK_INDEXEDDB)
- quota_client_mask |= quota::QuotaClient::kIndexedDatabase;
+ quota_client_mask |= storage::QuotaClient::kIndexedDatabase;
// TODO(jsbell): StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS)
return quota_client_mask;
@@ -257,18 +257,20 @@ struct StoragePartitionImpl::QuotaManagedDataDeletionHelper {
void DecrementTaskCountOnIO();
void ClearDataOnIOThread(
- const scoped_refptr<quota::QuotaManager>& quota_manager,
+ const scoped_refptr<storage::QuotaManager>& quota_manager,
const base::Time begin,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>&
+ special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher);
void ClearOriginsOnIOThread(
- quota::QuotaManager* quota_manager,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ storage::QuotaManager* quota_manager,
+ const scoped_refptr<storage::SpecialStoragePolicy>&
+ special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const base::Closure& callback,
const std::set<GURL>& origins,
- quota::StorageType quota_storage_type);
+ storage::StorageType quota_storage_type);
// All of these data are accessed on IO thread.
uint32 remove_mask;
@@ -301,22 +303,24 @@ struct StoragePartitionImpl::DataDeletionHelper {
void IncrementTaskCountOnUI();
void DecrementTaskCountOnUI();
- void ClearDataOnUIThread(const GURL& storage_origin,
- const OriginMatcherFunction& origin_matcher,
- const base::FilePath& path,
- net::URLRequestContextGetter* rq_context,
- DOMStorageContextWrapper* dom_storage_context,
- quota::QuotaManager* quota_manager,
- quota::SpecialStoragePolicy* special_storage_policy,
- WebRTCIdentityStore* webrtc_identity_store,
- const base::Time begin,
- const base::Time end);
+ void ClearDataOnUIThread(
+ const GURL& storage_origin,
+ const OriginMatcherFunction& origin_matcher,
+ const base::FilePath& path,
+ net::URLRequestContextGetter* rq_context,
+ DOMStorageContextWrapper* dom_storage_context,
+ storage::QuotaManager* quota_manager,
+ storage::SpecialStoragePolicy* special_storage_policy,
+ WebRTCIdentityStore* webrtc_identity_store,
+ const base::Time begin,
+ const base::Time end);
void ClearQuotaManagedDataOnIOThread(
- const scoped_refptr<quota::QuotaManager>& quota_manager,
+ const scoped_refptr<storage::QuotaManager>& quota_manager,
const base::Time begin,
const GURL& storage_origin,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>&
+ special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const base::Closure& callback);
@@ -330,10 +334,10 @@ struct StoragePartitionImpl::DataDeletionHelper {
};
void StoragePartitionImpl::DataDeletionHelper::ClearQuotaManagedDataOnIOThread(
- const scoped_refptr<quota::QuotaManager>& quota_manager,
+ const scoped_refptr<storage::QuotaManager>& quota_manager,
const base::Time begin,
const GURL& storage_origin,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher,
const base::Closure& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -350,15 +354,15 @@ void StoragePartitionImpl::DataDeletionHelper::ClearQuotaManagedDataOnIOThread(
StoragePartitionImpl::StoragePartitionImpl(
const base::FilePath& partition_path,
- quota::QuotaManager* quota_manager,
+ storage::QuotaManager* quota_manager,
ChromeAppCacheService* appcache_service,
- fileapi::FileSystemContext* filesystem_context,
- webkit_database::DatabaseTracker* database_tracker,
+ storage::FileSystemContext* filesystem_context,
+ storage::DatabaseTracker* database_tracker,
DOMStorageContextWrapper* dom_storage_context,
IndexedDBContextImpl* indexed_db_context,
ServiceWorkerContextWrapper* service_worker_context,
WebRTCIdentityStore* webrtc_identity_store,
- quota::SpecialStoragePolicy* special_storage_policy)
+ storage::SpecialStoragePolicy* special_storage_policy)
: partition_path_(partition_path),
quota_manager_(quota_manager),
appcache_service_(appcache_service),
@@ -368,16 +372,17 @@ StoragePartitionImpl::StoragePartitionImpl(
indexed_db_context_(indexed_db_context),
service_worker_context_(service_worker_context),
webrtc_identity_store_(webrtc_identity_store),
- special_storage_policy_(special_storage_policy) {}
+ special_storage_policy_(special_storage_policy) {
+}
StoragePartitionImpl::~StoragePartitionImpl() {
// These message loop checks are just to avoid leaks in unittests.
if (GetDatabaseTracker() &&
BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) {
BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&webkit_database::DatabaseTracker::Shutdown,
- GetDatabaseTracker()));
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(&storage::DatabaseTracker::Shutdown, GetDatabaseTracker()));
}
if (GetFileSystemContext())
@@ -405,28 +410,27 @@ StoragePartitionImpl* StoragePartitionImpl::Create(
// QuotaManager prior to the QuotaManger being used. We do them
// all together here prior to handing out a reference to anything
// that utilizes the QuotaManager.
- scoped_refptr<quota::QuotaManager> quota_manager = new quota::QuotaManager(
- in_memory,
- partition_path,
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(),
- context->GetSpecialStoragePolicy());
+ scoped_refptr<storage::QuotaManager> quota_manager =
+ new storage::QuotaManager(
+ in_memory,
+ partition_path,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(),
+ context->GetSpecialStoragePolicy());
// Each consumer is responsible for registering its QuotaClient during
// its construction.
- scoped_refptr<fileapi::FileSystemContext> filesystem_context =
- CreateFileSystemContext(context,
- partition_path, in_memory,
- quota_manager->proxy());
-
- scoped_refptr<webkit_database::DatabaseTracker> database_tracker =
- new webkit_database::DatabaseTracker(
- partition_path,
- in_memory,
- context->GetSpecialStoragePolicy(),
- quota_manager->proxy(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
- .get());
+ scoped_refptr<storage::FileSystemContext> filesystem_context =
+ CreateFileSystemContext(
+ context, partition_path, in_memory, quota_manager->proxy());
+
+ scoped_refptr<storage::DatabaseTracker> database_tracker =
+ new storage::DatabaseTracker(partition_path,
+ in_memory,
+ context->GetSpecialStoragePolicy(),
+ quota_manager->proxy(),
+ BrowserThread::GetMessageLoopProxyForThread(
+ BrowserThread::FILE).get());
base::FilePath path = in_memory ? base::FilePath() : partition_path;
scoped_refptr<DOMStorageContextWrapper> dom_storage_context =
@@ -456,7 +460,7 @@ StoragePartitionImpl* StoragePartitionImpl::Create(
scoped_refptr<WebRTCIdentityStore> webrtc_identity_store(
new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy()));
- scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy(
+ scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy(
context->GetSpecialStoragePolicy());
return new StoragePartitionImpl(partition_path,
@@ -484,7 +488,7 @@ StoragePartitionImpl::GetMediaURLRequestContext() {
return media_url_request_context_.get();
}
-quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() {
+storage::QuotaManager* StoragePartitionImpl::GetQuotaManager() {
return quota_manager_.get();
}
@@ -492,11 +496,11 @@ ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() {
return appcache_service_.get();
}
-fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() {
+storage::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() {
return filesystem_context_.get();
}
-webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() {
+storage::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() {
return database_tracker_.get();
}
@@ -552,9 +556,9 @@ void StoragePartitionImpl::
}
void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread(
- const scoped_refptr<quota::QuotaManager>& quota_manager,
+ const scoped_refptr<storage::QuotaManager>& quota_manager,
const base::Time begin,
- const scoped_refptr<quota::SpecialStoragePolicy>& special_storage_policy,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
const StoragePartition::OriginMatcherFunction& origin_matcher) {
IncrementTaskCountOnIO();
base::Closure decrement_callback = base::Bind(
@@ -567,7 +571,8 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread(
// within the user-specified timeframe, and deal with the resulting set in
// ClearQuotaManagedOriginsOnIOThread().
quota_manager->GetOriginsModifiedSince(
- quota::kStorageTypePersistent, begin,
+ storage::kStorageTypePersistent,
+ begin,
base::Bind(&QuotaManagedDataDeletionHelper::ClearOriginsOnIOThread,
base::Unretained(this),
quota_manager,
@@ -580,7 +585,8 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread(
if (quota_storage_remove_mask & QUOTA_MANAGED_STORAGE_MASK_TEMPORARY) {
IncrementTaskCountOnIO();
quota_manager->GetOriginsModifiedSince(
- quota::kStorageTypeTemporary, begin,
+ storage::kStorageTypeTemporary,
+ begin,
base::Bind(&QuotaManagedDataDeletionHelper::ClearOriginsOnIOThread,
base::Unretained(this),
quota_manager,
@@ -593,7 +599,8 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread(
if (quota_storage_remove_mask & QUOTA_MANAGED_STORAGE_MASK_SYNCABLE) {
IncrementTaskCountOnIO();
quota_manager->GetOriginsModifiedSince(
- quota::kStorageTypeSyncable, begin,
+ storage::kStorageTypeSyncable,
+ begin,
base::Bind(&QuotaManagedDataDeletionHelper::ClearOriginsOnIOThread,
base::Unretained(this),
quota_manager,
@@ -605,15 +612,14 @@ void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread(
DecrementTaskCountOnIO();
}
-void StoragePartitionImpl::
- QuotaManagedDataDeletionHelper::ClearOriginsOnIOThread(
- quota::QuotaManager* quota_manager,
- const scoped_refptr<quota::SpecialStoragePolicy>&
- special_storage_policy,
- const StoragePartition::OriginMatcherFunction& origin_matcher,
- const base::Closure& callback,
- const std::set<GURL>& origins,
- quota::StorageType quota_storage_type) {
+void
+StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearOriginsOnIOThread(
+ storage::QuotaManager* quota_manager,
+ const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy,
+ const StoragePartition::OriginMatcherFunction& origin_matcher,
+ const base::Closure& callback,
+ const std::set<GURL>& origins,
+ storage::StorageType quota_storage_type) {
// The QuotaManager manages all storage other than cookies, LocalStorage,
// and SessionStorage. This loop wipes out most HTML5 storage for the given
// origins.
@@ -676,8 +682,8 @@ void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread(
const base::FilePath& path,
net::URLRequestContextGetter* rq_context,
DOMStorageContextWrapper* dom_storage_context,
- quota::QuotaManager* quota_manager,
- quota::SpecialStoragePolicy* special_storage_policy,
+ storage::QuotaManager* quota_manager,
+ storage::SpecialStoragePolicy* special_storage_policy,
WebRTCIdentityStore* webrtc_identity_store,
const base::Time begin,
const base::Time end) {
@@ -795,12 +801,12 @@ WebRTCIdentityStore* StoragePartitionImpl::GetWebRTCIdentityStore() {
}
void StoragePartitionImpl::OverrideQuotaManagerForTesting(
- quota::QuotaManager* quota_manager) {
+ storage::QuotaManager* quota_manager) {
quota_manager_ = quota_manager;
}
void StoragePartitionImpl::OverrideSpecialStoragePolicyForTesting(
- quota::SpecialStoragePolicy* special_storage_policy) {
+ storage::SpecialStoragePolicy* special_storage_policy) {
special_storage_policy_ = special_storage_policy;
}
« no previous file with comments | « content/browser/storage_partition_impl.h ('k') | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698