| 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/local/local_file_change_tracker.h" | 5 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" | 13 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" |
| 14 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 14 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 15 #include "storage/browser/fileapi/file_system_context.h" | 15 #include "storage/browser/fileapi/file_system_context.h" |
| 16 #include "storage/browser/fileapi/file_system_file_util.h" | 16 #include "storage/browser/fileapi/file_system_file_util.h" |
| 17 #include "storage/browser/fileapi/file_system_operation_context.h" | 17 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 18 #include "storage/common/fileapi/file_system_util.h" | 18 #include "storage/common/fileapi/file_system_util.h" |
| 19 #include "third_party/leveldatabase/env_chromium.h" |
| 19 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 20 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| 20 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 21 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
| 21 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 22 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 22 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" | 23 #include "third_party/leveldatabase/src/include/leveldb/write_batch.h" |
| 23 | 24 |
| 24 using storage::FileSystemContext; | 25 using storage::FileSystemContext; |
| 25 using storage::FileSystemFileUtil; | 26 using storage::FileSystemFileUtil; |
| 26 using storage::FileSystemOperationContext; | 27 using storage::FileSystemOperationContext; |
| 27 using storage::FileSystemURL; | 28 using storage::FileSystemURL; |
| 28 using storage::FileSystemURLSet; | 29 using storage::FileSystemURLSet; |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 SyncStatusCode LocalFileChangeTracker::TrackerDB::Init( | 474 SyncStatusCode LocalFileChangeTracker::TrackerDB::Init( |
| 474 RecoveryOption recovery_option) { | 475 RecoveryOption recovery_option) { |
| 475 if (db_.get() && db_status_ == SYNC_STATUS_OK) | 476 if (db_.get() && db_status_ == SYNC_STATUS_OK) |
| 476 return SYNC_STATUS_OK; | 477 return SYNC_STATUS_OK; |
| 477 | 478 |
| 478 std::string path = | 479 std::string path = |
| 479 storage::FilePathToString(base_path_.Append(kDatabaseName)); | 480 storage::FilePathToString(base_path_.Append(kDatabaseName)); |
| 480 leveldb::Options options; | 481 leveldb::Options options; |
| 481 options.max_open_files = 0; // Use minimum. | 482 options.max_open_files = 0; // Use minimum. |
| 482 options.create_if_missing = true; | 483 options.create_if_missing = true; |
| 484 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; |
| 483 if (env_override_) | 485 if (env_override_) |
| 484 options.env = env_override_; | 486 options.env = env_override_; |
| 485 leveldb::DB* db; | 487 leveldb::DB* db; |
| 486 leveldb::Status status = leveldb::DB::Open(options, path, &db); | 488 leveldb::Status status = leveldb::DB::Open(options, path, &db); |
| 487 if (status.ok()) { | 489 if (status.ok()) { |
| 488 db_.reset(db); | 490 db_.reset(db); |
| 489 return SYNC_STATUS_OK; | 491 return SYNC_STATUS_OK; |
| 490 } | 492 } |
| 491 | 493 |
| 492 HandleError(FROM_HERE, status); | 494 HandleError(FROM_HERE, status); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 if (!status.ok() && !status.IsNotFound()) { | 611 if (!status.ok() && !status.IsNotFound()) { |
| 610 HandleError(FROM_HERE, status); | 612 HandleError(FROM_HERE, status); |
| 611 db_status_ = LevelDBStatusToSyncStatusCode(status); | 613 db_status_ = LevelDBStatusToSyncStatusCode(status); |
| 612 db_.reset(); | 614 db_.reset(); |
| 613 return db_status_; | 615 return db_status_; |
| 614 } | 616 } |
| 615 return SYNC_STATUS_OK; | 617 return SYNC_STATUS_OK; |
| 616 } | 618 } |
| 617 | 619 |
| 618 } // namespace sync_file_system | 620 } // namespace sync_file_system |
| OLD | NEW |