| 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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  739  |  739  | 
|  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::Status status = leveldb_env::OpenDB(options, path, &db_); | 
|  750   leveldb::Status status = leveldb::DB::Open(options, path, &db); |  | 
|  751   ReportInitStatus(status); |  750   ReportInitStatus(status); | 
|  752   if (status.ok()) { |  751   if (status.ok()) { | 
|  753     db_.reset(db); |  | 
|  754     return true; |  752     return true; | 
|  755   } |  753   } | 
|  756   HandleError(FROM_HERE, status); |  754   HandleError(FROM_HERE, status); | 
|  757  |  755  | 
|  758   // Corruption due to missing necessary MANIFEST-* file causes IOError instead |  756   // Corruption due to missing necessary MANIFEST-* file causes IOError instead | 
|  759   // of Corruption error. |  757   // of Corruption error. | 
|  760   // Try to repair database even when IOError case. |  758   // Try to repair database even when IOError case. | 
|  761   if (!status.IsCorruption() && !status.IsIOError()) |  759   if (!status.IsCorruption() && !status.IsIOError()) | 
|  762     return false; |  760     return false; | 
|  763  |  761  | 
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  952  |  950  | 
|  953 void SandboxDirectoryDatabase::HandleError( |  951 void SandboxDirectoryDatabase::HandleError( | 
|  954     const tracked_objects::Location& from_here, |  952     const tracked_objects::Location& from_here, | 
|  955     const leveldb::Status& status) { |  953     const leveldb::Status& status) { | 
|  956   LOG(ERROR) << "SandboxDirectoryDatabase failed at: " |  954   LOG(ERROR) << "SandboxDirectoryDatabase failed at: " | 
|  957              << from_here.ToString() << " with error: " << status.ToString(); |  955              << from_here.ToString() << " with error: " << status.ToString(); | 
|  958   db_.reset(); |  956   db_.reset(); | 
|  959 } |  957 } | 
|  960  |  958  | 
|  961 }  // namespace storage |  959 }  // namespace storage | 
| OLD | NEW |