| Index: content/browser/indexed_db/indexed_db_context_impl.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc
|
| index 39b3a07a70ab7d8aed3cb69d7dc0ff9fc12de55d..57b025efc587e3a10559dd107cb61e3c164d8616 100644
|
| --- a/content/browser/indexed_db/indexed_db_context_impl.cc
|
| +++ b/content/browser/indexed_db/indexed_db_context_impl.cc
|
| @@ -313,8 +313,7 @@ void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) {
|
| const bool kNonRecursive = false;
|
| base::DeleteFile(idb_directory, kNonRecursive);
|
| }
|
| - base::DeleteFile(GetBlobPath(storage::GetIdentifierFromOrigin(origin_url)),
|
| - true /* recursive */);
|
| +
|
| QueryDiskAndUpdateQuotaUsage(origin_url);
|
| if (s.ok()) {
|
| RemoveFromOriginSet(origin_url);
|
| @@ -323,6 +322,39 @@ void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) {
|
| }
|
| }
|
|
|
| +void IndexedDBContextImpl::CopyOriginData(const GURL& origin_url,
|
| + IndexedDBContext* dest_context) {
|
| + DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
|
| +
|
| + if (data_path_.empty() || !IsInOriginSet(origin_url))
|
| + return;
|
| +
|
| + IndexedDBContextImpl* dest_context_impl =
|
| + static_cast<IndexedDBContextImpl*>(dest_context);
|
| +
|
| + ForceClose(origin_url, FORCE_CLOSE_COPY_ORIGIN);
|
| + std::string origin_id = storage::GetIdentifierFromOrigin(origin_url);
|
| +
|
| + // Make sure we're not about to delete our own database.
|
| + CHECK_NE(dest_context_impl->data_path().value(), data_path().value());
|
| +
|
| + // Delete any existing storage paths in the destination context.
|
| + // A previously failed migration may have left behind partially copied
|
| + // directories.
|
| + for (const base::FilePath& dest_path :
|
| + dest_context_impl->GetStoragePaths(origin_url))
|
| + base::DeleteFile(dest_path, true);
|
| +
|
| + base::FilePath dest_data_path = dest_context_impl->data_path();
|
| + base::CreateDirectory(dest_data_path);
|
| +
|
| + for (const base::FilePath& src_data_path : GetStoragePaths(origin_url)) {
|
| + if (base::PathExists(src_data_path)) {
|
| + base::CopyDirectory(src_data_path, dest_data_path, true);
|
| + }
|
| + }
|
| +}
|
| +
|
| void IndexedDBContextImpl::ForceClose(const GURL origin_url,
|
| ForceCloseReason reason) {
|
| DCHECK(TaskRunner()->RunsTasksOnCurrentThread());
|
|
|