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 b54d59a46ffbdd6ca3434e954bc327f6ea84be1b..1049bea3d0a49dde56b19b4b31972ed448818ff0 100644 |
--- a/content/browser/indexed_db/indexed_db_context_impl.cc |
+++ b/content/browser/indexed_db/indexed_db_context_impl.cc |
@@ -315,6 +315,27 @@ void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) { |
} |
} |
+void IndexedDBContextImpl::CopyOriginData(const GURL& origin_url, |
+ IndexedDBContext* dest_context) { |
+ DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
+ ForceClose(origin_url, FORCE_CLOSE_COPY_ORIGIN); |
+ if (data_path_.empty() || !IsInOriginSet(origin_url)) |
+ return; |
+ |
+ base::FilePath idb_directory = GetFilePath(origin_url); |
+ base::FilePath dest_directory = dest_context->GetFilePath(origin_url); |
+ |
+ if (base::PathExists(dest_directory)) { |
+ return; |
+ } |
+ |
+ if (!base::PathExists(dest_directory.DirName())) { |
+ base::CreateDirectory(dest_directory.DirName()); |
+ } |
+ |
+ base::CopyDirectory(idb_directory, dest_directory.DirName(), true); |
+} |
+ |
void IndexedDBContextImpl::ForceClose(const GURL origin_url, |
ForceCloseReason reason) { |
DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
@@ -346,11 +367,6 @@ base::FilePath IndexedDBContextImpl::GetFilePath(const GURL& origin_url) const { |
return GetIndexedDBFilePath(origin_id); |
} |
-base::FilePath IndexedDBContextImpl::GetFilePathForTesting( |
- const std::string& origin_id) const { |
- return GetIndexedDBFilePath(origin_id); |
-} |
- |
void IndexedDBContextImpl::SetTaskRunnerForTesting( |
base::SequencedTaskRunner* task_runner) { |
DCHECK(!task_runner_.get()); |