| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "storage/browser/fileapi/sandbox_directory_database.h" | 5 #include "storage/browser/fileapi/sandbox_directory_database.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 std::string path = | 740 std::string path = |
| 741 FilePathToString(filesystem_data_directory_.Append( | 741 FilePathToString(filesystem_data_directory_.Append( |
| 742 kDirectoryDatabaseName)); | 742 kDirectoryDatabaseName)); |
| 743 leveldb::Options options; | 743 leveldb::Options options; |
| 744 options.max_open_files = 0; // Use minimum. | 744 options.max_open_files = 0; // Use minimum. |
| 745 options.create_if_missing = true; | 745 options.create_if_missing = true; |
| 746 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; | 746 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; |
| 747 if (env_override_) | 747 if (env_override_) |
| 748 options.env = env_override_; | 748 options.env = env_override_; |
| 749 leveldb::DB* db; | 749 leveldb::DB* db; |
| 750 leveldb::Status status = leveldb::DB::Open(options, path, &db); | 750 leveldb::Status status = leveldb_env::DBRegistry::Open(options, path, &db); |
| 751 ReportInitStatus(status); | 751 ReportInitStatus(status); |
| 752 if (status.ok()) { | 752 if (status.ok()) { |
| 753 db_.reset(db); | 753 db_.reset(db); |
| 754 return true; | 754 return true; |
| 755 } | 755 } |
| 756 HandleError(FROM_HERE, status); | 756 HandleError(FROM_HERE, status); |
| 757 | 757 |
| 758 // Corruption due to missing necessary MANIFEST-* file causes IOError instead | 758 // Corruption due to missing necessary MANIFEST-* file causes IOError instead |
| 759 // of Corruption error. | 759 // of Corruption error. |
| 760 // Try to repair database even when IOError case. | 760 // Try to repair database even when IOError case. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 void SandboxDirectoryDatabase::HandleError( | 953 void SandboxDirectoryDatabase::HandleError( |
| 954 const tracked_objects::Location& from_here, | 954 const tracked_objects::Location& from_here, |
| 955 const leveldb::Status& status) { | 955 const leveldb::Status& status) { |
| 956 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " | 956 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " |
| 957 << from_here.ToString() << " with error: " << status.ToString(); | 957 << from_here.ToString() << " with error: " << status.ToString(); |
| 958 db_.reset(); | 958 db_.reset(); |
| 959 } | 959 } |
| 960 | 960 |
| 961 } // namespace storage | 961 } // namespace storage |
| OLD | NEW |