| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 486 |
| 487 std::string path = | 487 std::string path = |
| 488 storage::FilePathToString(base_path_.Append(kDatabaseName)); | 488 storage::FilePathToString(base_path_.Append(kDatabaseName)); |
| 489 leveldb::Options options; | 489 leveldb::Options options; |
| 490 options.max_open_files = 0; // Use minimum. | 490 options.max_open_files = 0; // Use minimum. |
| 491 options.create_if_missing = true; | 491 options.create_if_missing = true; |
| 492 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; | 492 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; |
| 493 if (env_override_) | 493 if (env_override_) |
| 494 options.env = env_override_; | 494 options.env = env_override_; |
| 495 leveldb::DB* db; | 495 leveldb::DB* db; |
| 496 leveldb::Status status = leveldb::DB::Open(options, path, &db); | 496 leveldb::Status status = leveldb_env::DBRegistry::Open(options, path, &db); |
| 497 UMA_HISTOGRAM_ENUMERATION("SyncFileSystem.TrackerDB.Open", | 497 UMA_HISTOGRAM_ENUMERATION("SyncFileSystem.TrackerDB.Open", |
| 498 leveldb_env::GetLevelDBStatusUMAValue(status), | 498 leveldb_env::GetLevelDBStatusUMAValue(status), |
| 499 leveldb_env::LEVELDB_STATUS_MAX); | 499 leveldb_env::LEVELDB_STATUS_MAX); |
| 500 if (status.ok()) { | 500 if (status.ok()) { |
| 501 db_.reset(db); | 501 db_.reset(db); |
| 502 return SYNC_STATUS_OK; | 502 return SYNC_STATUS_OK; |
| 503 } | 503 } |
| 504 | 504 |
| 505 HandleError(FROM_HERE, status); | 505 HandleError(FROM_HERE, status); |
| 506 if (!status.IsCorruption()) | 506 if (!status.IsCorruption()) |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 if (!status.ok() && !status.IsNotFound()) { | 624 if (!status.ok() && !status.IsNotFound()) { |
| 625 HandleError(FROM_HERE, status); | 625 HandleError(FROM_HERE, status); |
| 626 db_status_ = LevelDBStatusToSyncStatusCode(status); | 626 db_status_ = LevelDBStatusToSyncStatusCode(status); |
| 627 db_.reset(); | 627 db_.reset(); |
| 628 return db_status_; | 628 return db_status_; |
| 629 } | 629 } |
| 630 return SYNC_STATUS_OK; | 630 return SYNC_STATUS_OK; |
| 631 } | 631 } |
| 632 | 632 |
| 633 } // namespace sync_file_system | 633 } // namespace sync_file_system |
| OLD | NEW |