summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/indexed_db/indexed_db_quota_client.cc4
-rw-r--r--content/browser/indexed_db/indexed_db_quota_client.h1
-rw-r--r--webkit/browser/appcache/appcache_quota_client.cc4
-rw-r--r--webkit/browser/appcache/appcache_quota_client.h1
-rw-r--r--webkit/browser/database/database_quota_client.cc4
-rw-r--r--webkit/browser/database/database_quota_client.h3
-rw-r--r--webkit/browser/fileapi/file_system_context.cc14
-rw-r--r--webkit/browser/fileapi/file_system_quota_client.cc6
-rw-r--r--webkit/browser/fileapi/file_system_quota_client.h1
-rw-r--r--webkit/browser/quota/mock_storage_client.cc4
-rw-r--r--webkit/browser/quota/mock_storage_client.h1
-rw-r--r--webkit/browser/quota/quota_client.h2
-rw-r--r--webkit/browser/quota/usage_tracker.cc6
-rw-r--r--webkit/browser/quota/usage_tracker_unittest.cc4
14 files changed, 46 insertions, 9 deletions
diff --git a/content/browser/indexed_db/indexed_db_quota_client.cc b/content/browser/indexed_db/indexed_db_quota_client.cc
index 1b187c5..5e0cea8 100644
--- a/content/browser/indexed_db/indexed_db_quota_client.cc
+++ b/content/browser/indexed_db/indexed_db_quota_client.cc
@@ -175,4 +175,8 @@ void IndexedDBQuotaClient::DeleteOriginData(const GURL& origin,
callback);
}
+bool IndexedDBQuotaClient::DoesSupport(quota::StorageType type) const {
+ return type == quota::kStorageTypeTemporary;
+}
+
} // namespace content
diff --git a/content/browser/indexed_db/indexed_db_quota_client.h b/content/browser/indexed_db/indexed_db_quota_client.h
index 6c0f2bb..3c48c27 100644
--- a/content/browser/indexed_db/indexed_db_quota_client.h
+++ b/content/browser/indexed_db/indexed_db_quota_client.h
@@ -43,6 +43,7 @@ class IndexedDBQuotaClient : public quota::QuotaClient,
virtual void DeleteOriginData(const GURL& origin,
quota::StorageType type,
const DeletionCallback& callback) OVERRIDE;
+ virtual bool DoesSupport(quota::StorageType type) const OVERRIDE;
private:
scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
diff --git a/webkit/browser/appcache/appcache_quota_client.cc b/webkit/browser/appcache/appcache_quota_client.cc
index 7f2d647..fc8db6d 100644
--- a/webkit/browser/appcache/appcache_quota_client.cc
+++ b/webkit/browser/appcache/appcache_quota_client.cc
@@ -139,6 +139,10 @@ void AppCacheQuotaClient::DeleteOriginData(const GURL& origin,
origin, GetServiceDeleteCallback()->callback());
}
+bool AppCacheQuotaClient::DoesSupport(quota::StorageType type) const {
+ return type == quota::kStorageTypeTemporary;
+}
+
void AppCacheQuotaClient::DidDeleteAppCachesForOrigin(int rv) {
DCHECK(service_);
if (quota_manager_is_destroyed_)
diff --git a/webkit/browser/appcache/appcache_quota_client.h b/webkit/browser/appcache/appcache_quota_client.h
index d2efb12..c490183 100644
--- a/webkit/browser/appcache/appcache_quota_client.h
+++ b/webkit/browser/appcache/appcache_quota_client.h
@@ -50,6 +50,7 @@ class AppCacheQuotaClient : public quota::QuotaClient {
virtual void DeleteOriginData(const GURL& origin,
quota::StorageType type,
const DeletionCallback& callback) OVERRIDE;
+ virtual bool DoesSupport(quota::StorageType type) const OVERRIDE;
private:
friend class AppCacheService; // for NotifyAppCacheIsDestroyed
diff --git a/webkit/browser/database/database_quota_client.cc b/webkit/browser/database/database_quota_client.cc
index 650edfe..08e8666 100644
--- a/webkit/browser/database/database_quota_client.cc
+++ b/webkit/browser/database/database_quota_client.cc
@@ -215,4 +215,8 @@ void DatabaseQuotaClient::DeleteOriginData(
delete_callback);
}
+bool DatabaseQuotaClient::DoesSupport(quota::StorageType type) const {
+ return type == quota::kStorageTypeTemporary;
+}
+
} // namespace webkit_database
diff --git a/webkit/browser/database/database_quota_client.h b/webkit/browser/database/database_quota_client.h
index bc070213..2c6d0aed 100644
--- a/webkit/browser/database/database_quota_client.h
+++ b/webkit/browser/database/database_quota_client.h
@@ -39,10 +39,11 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE DatabaseQuotaClient
const GetOriginsCallback& callback) OVERRIDE;
virtual void GetOriginsForHost(quota::StorageType type,
const std::string& host,
- const GetOriginsCallback& callback) OVERRIDE;
+ const GetOriginsCallback& callback) OVERRIDE;
virtual void DeleteOriginData(const GURL& origin,
quota::StorageType type,
const DeletionCallback& callback) OVERRIDE;
+ virtual bool DoesSupport(quota::StorageType type) const OVERRIDE;
private:
scoped_refptr<base::MessageLoopProxy> db_tracker_thread_;
scoped_refptr<DatabaseTracker> db_tracker_; // only used on its thread
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
index 2053cb1..b7fbf68 100644
--- a/webkit/browser/fileapi/file_system_context.cc
+++ b/webkit/browser/fileapi/file_system_context.cc
@@ -121,11 +121,6 @@ FileSystemContext::FileSystemContext(
external_mount_points_(external_mount_points),
partition_path_(partition_path),
operation_runner_(new FileSystemOperationRunner(this)) {
- if (quota_manager_proxy) {
- quota_manager_proxy->RegisterClient(CreateQuotaClient(
- this, options.is_incognito()));
- }
-
RegisterBackend(sandbox_backend_.get());
RegisterBackend(isolated_backend_.get());
@@ -135,6 +130,12 @@ FileSystemContext::FileSystemContext(
RegisterBackend(*iter);
}
+ if (quota_manager_proxy) {
+ // Quota client assumes all backends have registered.
+ quota_manager_proxy->RegisterClient(CreateQuotaClient(
+ this, options.is_incognito()));
+ }
+
sandbox_backend_->Initialize(this);
isolated_backend_->Initialize(this);
for (ScopedVector<FileSystemBackend>::const_iterator iter =
@@ -222,7 +223,8 @@ FileSystemBackend* FileSystemContext::GetFileSystemBackend(
}
bool FileSystemContext::IsSandboxFileSystem(FileSystemType type) const {
- return GetQuotaUtil(type) != NULL;
+ FileSystemBackendMap::const_iterator found = backend_map_.find(type);
+ return found != backend_map_.end() && found->second->GetQuotaUtil();
}
const UpdateObserverList* FileSystemContext::GetUpdateObservers(
diff --git a/webkit/browser/fileapi/file_system_quota_client.cc b/webkit/browser/fileapi/file_system_quota_client.cc
index 343a6e6..76725df 100644
--- a/webkit/browser/fileapi/file_system_quota_client.cc
+++ b/webkit/browser/fileapi/file_system_quota_client.cc
@@ -197,6 +197,12 @@ void FileSystemQuotaClient::DeleteOriginData(
callback);
}
+bool FileSystemQuotaClient::DoesSupport(quota::StorageType storage_type) const {
+ FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type);
+ DCHECK(type != kFileSystemTypeUnknown);
+ return file_system_context_->IsSandboxFileSystem(type);
+}
+
base::SequencedTaskRunner* FileSystemQuotaClient::file_task_runner() const {
return file_system_context_->default_file_task_runner();
}
diff --git a/webkit/browser/fileapi/file_system_quota_client.h b/webkit/browser/fileapi/file_system_quota_client.h
index f216804..f3cf68d 100644
--- a/webkit/browser/fileapi/file_system_quota_client.h
+++ b/webkit/browser/fileapi/file_system_quota_client.h
@@ -56,6 +56,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemQuotaClient
const GURL& origin,
quota::StorageType type,
const DeletionCallback& callback) OVERRIDE;
+ virtual bool DoesSupport(quota::StorageType type) const OVERRIDE;
private:
base::SequencedTaskRunner* file_task_runner() const;
diff --git a/webkit/browser/quota/mock_storage_client.cc b/webkit/browser/quota/mock_storage_client.cc
index 7e25654..61fd667 100644
--- a/webkit/browser/quota/mock_storage_client.cc
+++ b/webkit/browser/quota/mock_storage_client.cc
@@ -121,6 +121,10 @@ void MockStorageClient::DeleteOriginData(
weak_factory_.GetWeakPtr(), origin, type, callback));
}
+bool MockStorageClient::DoesSupport(quota::StorageType type) const {
+ return true;
+}
+
void MockStorageClient::RunGetOriginUsage(
const GURL& origin_url, StorageType type,
const GetUsageCallback& callback) {
diff --git a/webkit/browser/quota/mock_storage_client.h b/webkit/browser/quota/mock_storage_client.h
index 4b3d03f..42c6162 100644
--- a/webkit/browser/quota/mock_storage_client.h
+++ b/webkit/browser/quota/mock_storage_client.h
@@ -59,6 +59,7 @@ class MockStorageClient : public QuotaClient {
virtual void DeleteOriginData(const GURL& origin,
StorageType type,
const DeletionCallback& callback) OVERRIDE;
+ virtual bool DoesSupport(quota::StorageType type) const OVERRIDE;
private:
void RunGetOriginUsage(const GURL& origin_url,
diff --git a/webkit/browser/quota/quota_client.h b/webkit/browser/quota/quota_client.h
index eff1f1e..5c0da46 100644
--- a/webkit/browser/quota/quota_client.h
+++ b/webkit/browser/quota/quota_client.h
@@ -69,6 +69,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaClient {
virtual void DeleteOriginData(const GURL& origin,
StorageType type,
const DeletionCallback& callback) = 0;
+
+ virtual bool DoesSupport(StorageType type) const = 0;
};
// TODO(dmikurube): Replace it to std::vector for efficiency.
diff --git a/webkit/browser/quota/usage_tracker.cc b/webkit/browser/quota/usage_tracker.cc
index 4bf6488..57b5e0d 100644
--- a/webkit/browser/quota/usage_tracker.cc
+++ b/webkit/browser/quota/usage_tracker.cc
@@ -78,8 +78,10 @@ UsageTracker::UsageTracker(const QuotaClientList& clients,
for (QuotaClientList::const_iterator iter = clients.begin();
iter != clients.end();
++iter) {
- client_tracker_map_[(*iter)->id()] =
- new ClientUsageTracker(this, *iter, type, special_storage_policy);
+ if ((*iter)->DoesSupport(type)) {
+ client_tracker_map_[(*iter)->id()] =
+ new ClientUsageTracker(this, *iter, type, special_storage_policy);
+ }
}
}
diff --git a/webkit/browser/quota/usage_tracker_unittest.cc b/webkit/browser/quota/usage_tracker_unittest.cc
index 985db2d..98d97ac6 100644
--- a/webkit/browser/quota/usage_tracker_unittest.cc
+++ b/webkit/browser/quota/usage_tracker_unittest.cc
@@ -89,6 +89,10 @@ class MockQuotaClient : public QuotaClient {
FROM_HERE, base::Bind(callback, kQuotaStatusOk));
}
+ virtual bool DoesSupport(quota::StorageType type) const OVERRIDE {
+ return type == quota::kStorageTypeTemporary;
+ }
+
int64 GetUsage(const GURL& origin) {
UsageMap::const_iterator found = usage_map_.find(origin);
if (found == usage_map_.end())