| 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 "webkit/fileapi/file_system_directory_database.h" | 5 #include "webkit/fileapi/file_system_directory_database.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <stack> | 10 #include <stack> |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 options.create_if_missing = true; | 707 options.create_if_missing = true; |
| 708 leveldb::DB* db; | 708 leveldb::DB* db; |
| 709 leveldb::Status status = leveldb::DB::Open(options, path, &db); | 709 leveldb::Status status = leveldb::DB::Open(options, path, &db); |
| 710 ReportInitStatus(status); | 710 ReportInitStatus(status); |
| 711 if (status.ok()) { | 711 if (status.ok()) { |
| 712 db_.reset(db); | 712 db_.reset(db); |
| 713 return true; | 713 return true; |
| 714 } | 714 } |
| 715 HandleError(FROM_HERE, status); | 715 HandleError(FROM_HERE, status); |
| 716 | 716 |
| 717 if (!status.IsCorruption()) | 717 if (!status.IsCorruption() && !status.IsIOError()) |
| 718 return false; | 718 return false; |
| 719 | 719 |
| 720 switch (recovery_option) { | 720 switch (recovery_option) { |
| 721 case FAIL_ON_CORRUPTION: | 721 case FAIL_ON_CORRUPTION: |
| 722 return false; | 722 return false; |
| 723 case REPAIR_ON_CORRUPTION: | 723 case REPAIR_ON_CORRUPTION: |
| 724 LOG(WARNING) << "Corrupted FileSystemDirectoryDatabase detected." | 724 LOG(WARNING) << "Corrupted FileSystemDirectoryDatabase detected." |
| 725 << " Attempting to repair."; | 725 << " Attempting to repair."; |
| 726 if (RepairDatabase(path)) | 726 if (RepairDatabase(path)) |
| 727 return true; | 727 return true; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 897 |
| 898 void FileSystemDirectoryDatabase::HandleError( | 898 void FileSystemDirectoryDatabase::HandleError( |
| 899 const tracked_objects::Location& from_here, | 899 const tracked_objects::Location& from_here, |
| 900 const leveldb::Status& status) { | 900 const leveldb::Status& status) { |
| 901 LOG(ERROR) << "FileSystemDirectoryDatabase failed at: " | 901 LOG(ERROR) << "FileSystemDirectoryDatabase failed at: " |
| 902 << from_here.ToString() << " with error: " << status.ToString(); | 902 << from_here.ToString() << " with error: " << status.ToString(); |
| 903 db_.reset(); | 903 db_.reset(); |
| 904 } | 904 } |
| 905 | 905 |
| 906 } // namespace fileapi | 906 } // namespace fileapi |
| OLD | NEW |