OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 } // namespace | 517 } // namespace |
518 | 518 |
519 // static | 519 // static |
520 scoped_ptr<MetadataDatabase> MetadataDatabase::Create( | 520 scoped_ptr<MetadataDatabase> MetadataDatabase::Create( |
521 const base::FilePath& database_path, | 521 const base::FilePath& database_path, |
522 leveldb::Env* env_override, | 522 leveldb::Env* env_override, |
523 SyncStatusCode* status_out) { | 523 SyncStatusCode* status_out) { |
524 bool enable_on_disk_index = !CommandLine::ForCurrentProcess()->HasSwitch( | 524 bool enable_on_disk_index = !CommandLine::ForCurrentProcess()->HasSwitch( |
525 kDisableMetadataDatabaseOnDisk); | 525 kDisableMetadataDatabaseOnDisk); |
| 526 return CreateInternal(database_path, env_override, enable_on_disk_index, |
| 527 status_out); |
| 528 } |
| 529 |
| 530 // static |
| 531 scoped_ptr<MetadataDatabase> MetadataDatabase::CreateInternal( |
| 532 const base::FilePath& database_path, |
| 533 leveldb::Env* env_override, |
| 534 bool enable_on_disk_index, |
| 535 SyncStatusCode* status_out) { |
526 scoped_ptr<MetadataDatabase> metadata_database( | 536 scoped_ptr<MetadataDatabase> metadata_database( |
527 new MetadataDatabase(database_path, | 537 new MetadataDatabase(database_path, |
528 enable_on_disk_index, | 538 enable_on_disk_index, |
529 env_override)); | 539 env_override)); |
530 | 540 |
531 SyncStatusCode status = metadata_database->Initialize(); | 541 SyncStatusCode status = metadata_database->Initialize(); |
532 if (status == SYNC_DATABASE_ERROR_FAILED) { | 542 if (status == SYNC_DATABASE_ERROR_FAILED) { |
533 // Delete the previous instance to avoid creating a LevelDB instance for | 543 // Delete the previous instance to avoid creating a LevelDB instance for |
534 // the same path. | 544 // the same path. |
535 metadata_database.reset(); | 545 metadata_database.reset(); |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 return false; | 1791 return false; |
1782 | 1792 |
1783 if (!parents.empty()) | 1793 if (!parents.empty()) |
1784 return false; | 1794 return false; |
1785 | 1795 |
1786 return true; | 1796 return true; |
1787 } | 1797 } |
1788 | 1798 |
1789 } // namespace drive_backend | 1799 } // namespace drive_backend |
1790 } // namespace sync_file_system | 1800 } // namespace sync_file_system |
OLD | NEW |