Index: content/browser/in_process_webkit/indexed_db_context_impl.cc |
diff --git a/content/browser/in_process_webkit/indexed_db_context_impl.cc b/content/browser/in_process_webkit/indexed_db_context_impl.cc |
index 2d0c1ffce504724616566f7c068755fe31296026..e94fac08ac59b6d581c6c479480bb406ea368194 100644 |
--- a/content/browser/in_process_webkit/indexed_db_context_impl.cc |
+++ b/content/browser/in_process_webkit/indexed_db_context_impl.cc |
@@ -106,36 +106,6 @@ IndexedDBContextImpl::IndexedDBContextImpl( |
} |
} |
-IndexedDBContextImpl::~IndexedDBContextImpl() { |
- WebKit::WebIDBFactory* factory = idb_factory_.release(); |
- if (factory) { |
- if (!BrowserThread::DeleteSoon(BrowserThread::WEBKIT_DEPRECATED, |
- FROM_HERE, factory)) |
- delete factory; |
- } |
- |
- if (data_path_.empty()) |
- return; |
- |
- if (save_session_state_) |
- return; |
- |
- bool has_session_only_databases = |
- special_storage_policy_.get() && |
- special_storage_policy_->HasSessionOnlyOrigins(); |
- |
- // Clearning only session-only databases, and there are none. |
- if (!clear_local_state_on_exit_ && !has_session_only_databases) |
- return; |
- |
- // No WEBKIT thread here means we are running in a unit test where no clean |
- // up is needed. |
- BrowserThread::PostTask( |
- BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, |
- base::Bind(&ClearLocalState, data_path_, clear_local_state_on_exit_, |
- special_storage_policy_)); |
-} |
- |
WebIDBFactory* IndexedDBContextImpl::GetIDBFactory() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
if (!idb_factory_.get()) { |
@@ -147,31 +117,6 @@ WebIDBFactory* IndexedDBContextImpl::GetIDBFactory() { |
return idb_factory_.get(); |
} |
-void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
- if (data_path_.empty() || !IsInOriginSet(origin_url)) |
- return; |
- // TODO(michaeln): When asked to delete an origin with open connections, |
- // forcibly close those connections then delete. |
- if (connection_count_.find(origin_url) == connection_count_.end()) { |
- string16 origin_id = DatabaseUtil::GetOriginIdentifier(origin_url); |
- FilePath idb_directory = GetIndexedDBFilePath(origin_id); |
- EnsureDiskUsageCacheInitialized(origin_url); |
- bool deleted = file_util::Delete(idb_directory, true /*recursive*/); |
- QueryDiskAndUpdateQuotaUsage(origin_url); |
- if (deleted) { |
- RemoveFromOriginSet(origin_url); |
- origin_size_map_.erase(origin_url); |
- space_available_map_.erase(origin_url); |
- } |
- } |
-} |
- |
-FilePath IndexedDBContextImpl::GetFilePathForTesting( |
- const string16& origin_id) const { |
- return GetIndexedDBFilePath(origin_id); |
-} |
- |
std::vector<GURL> IndexedDBContextImpl::GetAllOrigins() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
std::vector<GURL> origins; |
@@ -201,6 +146,31 @@ base::Time IndexedDBContextImpl::GetOriginLastModified(const GURL& origin_url) { |
return file_info.last_modified; |
} |
+void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
+ if (data_path_.empty() || !IsInOriginSet(origin_url)) |
+ return; |
+ // TODO(michaeln): When asked to delete an origin with open connections, |
+ // forcibly close those connections then delete. |
+ if (connection_count_.find(origin_url) == connection_count_.end()) { |
+ string16 origin_id = DatabaseUtil::GetOriginIdentifier(origin_url); |
+ FilePath idb_directory = GetIndexedDBFilePath(origin_id); |
+ EnsureDiskUsageCacheInitialized(origin_url); |
+ bool deleted = file_util::Delete(idb_directory, true /*recursive*/); |
+ QueryDiskAndUpdateQuotaUsage(origin_url); |
+ if (deleted) { |
+ RemoveFromOriginSet(origin_url); |
+ origin_size_map_.erase(origin_url); |
+ space_available_map_.erase(origin_url); |
+ } |
+ } |
+} |
+ |
+FilePath IndexedDBContextImpl::GetFilePathForTesting( |
+ const string16& origin_id) const { |
+ return GetIndexedDBFilePath(origin_id); |
+} |
+ |
void IndexedDBContextImpl::ConnectionOpened(const GURL& origin_url) { |
if (quota_manager_proxy()) { |
quota_manager_proxy()->NotifyStorageAccessed( |
@@ -237,15 +207,6 @@ void IndexedDBContextImpl::TransactionComplete(const GURL& origin_url) { |
QueryAvailableQuota(origin_url); |
} |
-FilePath IndexedDBContextImpl::GetIndexedDBFilePath( |
- const string16& origin_id) const { |
- DCHECK(!data_path_.empty()); |
- FilePath::StringType id = |
- webkit_glue::WebStringToFilePathString(origin_id).append( |
- FILE_PATH_LITERAL(".indexeddb")); |
- return data_path_.Append(id.append(kIndexedDBExtension)); |
-} |
- |
bool IndexedDBContextImpl::WouldBeOverQuota(const GURL& origin_url, |
int64 additional_bytes) { |
if (space_available_map_.find(origin_url) == space_available_map_.end()) { |
@@ -265,6 +226,45 @@ quota::QuotaManagerProxy* IndexedDBContextImpl::quota_manager_proxy() { |
return quota_manager_proxy_; |
} |
+IndexedDBContextImpl::~IndexedDBContextImpl() { |
+ WebKit::WebIDBFactory* factory = idb_factory_.release(); |
+ if (factory) { |
+ if (!BrowserThread::DeleteSoon(BrowserThread::WEBKIT_DEPRECATED, |
+ FROM_HERE, factory)) |
+ delete factory; |
+ } |
+ |
+ if (data_path_.empty()) |
+ return; |
+ |
+ if (save_session_state_) |
+ return; |
+ |
+ bool has_session_only_databases = |
+ special_storage_policy_.get() && |
+ special_storage_policy_->HasSessionOnlyOrigins(); |
+ |
+ // Clearning only session-only databases, and there are none. |
+ if (!clear_local_state_on_exit_ && !has_session_only_databases) |
+ return; |
+ |
+ // No WEBKIT thread here means we are running in a unit test where no clean |
+ // up is needed. |
+ BrowserThread::PostTask( |
+ BrowserThread::WEBKIT_DEPRECATED, FROM_HERE, |
+ base::Bind(&ClearLocalState, data_path_, clear_local_state_on_exit_, |
+ special_storage_policy_)); |
+} |
+ |
+FilePath IndexedDBContextImpl::GetIndexedDBFilePath( |
+ const string16& origin_id) const { |
+ DCHECK(!data_path_.empty()); |
+ FilePath::StringType id = |
+ webkit_glue::WebStringToFilePathString(origin_id).append( |
+ FILE_PATH_LITERAL(".indexeddb")); |
+ return data_path_.Append(id.append(kIndexedDBExtension)); |
+} |
+ |
int64 IndexedDBContextImpl::ReadUsageFromDisk(const GURL& origin_url) const { |
if (data_path_.empty()) |
return 0; |