Chromium Code Reviews| 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 c7e13263677bc3aa093aa0d7ff52426d861b3c78..e3f650e67b969c2ef4340f3f00cd4ecbc7674638 100644 |
| --- a/content/browser/indexed_db/indexed_db_context_impl.cc |
| +++ b/content/browser/indexed_db/indexed_db_context_impl.cc |
| @@ -322,6 +322,29 @@ 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 = |
| + GetFilePathForTesting(origin_url.possibly_invalid_spec()); |
|
jsbell
2014/12/12 17:46:09
The "ForTesting" methods should only be called fro
|
| + base::FilePath dest_directory = |
|
jsbell
2014/12/12 17:46:09
This is basically just computing <context>/Indexed
ryanackley
2014/12/12 19:03:04
Should I expose the methods I need on IndexedDBCon
|
| + dest_context->GetFilePathForTesting(origin_url.possibly_invalid_spec()); |
| + |
| + 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()); |