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/browser/fileapi/sandbox_directory_database.h" | 5 #include "webkit/browser/fileapi/sandbox_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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 return true; | 746 return true; |
747 } | 747 } |
748 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel, | 748 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel, |
749 DB_REPAIR_FAILED, DB_REPAIR_MAX); | 749 DB_REPAIR_FAILED, DB_REPAIR_MAX); |
750 LOG(WARNING) << "Failed to repair SandboxDirectoryDatabase."; | 750 LOG(WARNING) << "Failed to repair SandboxDirectoryDatabase."; |
751 // fall through | 751 // fall through |
752 case DELETE_ON_CORRUPTION: | 752 case DELETE_ON_CORRUPTION: |
753 LOG(WARNING) << "Clearing SandboxDirectoryDatabase."; | 753 LOG(WARNING) << "Clearing SandboxDirectoryDatabase."; |
754 if (!base::DeleteFile(filesystem_data_directory_, true)) | 754 if (!base::DeleteFile(filesystem_data_directory_, true)) |
755 return false; | 755 return false; |
756 if (!file_util::CreateDirectory(filesystem_data_directory_)) | 756 if (!base::CreateDirectory(filesystem_data_directory_)) |
757 return false; | 757 return false; |
758 return Init(FAIL_ON_CORRUPTION); | 758 return Init(FAIL_ON_CORRUPTION); |
759 } | 759 } |
760 | 760 |
761 NOTREACHED(); | 761 NOTREACHED(); |
762 return false; | 762 return false; |
763 } | 763 } |
764 | 764 |
765 bool SandboxDirectoryDatabase::RepairDatabase(const std::string& db_path) { | 765 bool SandboxDirectoryDatabase::RepairDatabase(const std::string& db_path) { |
766 DCHECK(!db_.get()); | 766 DCHECK(!db_.get()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 919 |
920 void SandboxDirectoryDatabase::HandleError( | 920 void SandboxDirectoryDatabase::HandleError( |
921 const tracked_objects::Location& from_here, | 921 const tracked_objects::Location& from_here, |
922 const leveldb::Status& status) { | 922 const leveldb::Status& status) { |
923 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " | 923 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " |
924 << from_here.ToString() << " with error: " << status.ToString(); | 924 << from_here.ToString() << " with error: " << status.ToString(); |
925 db_.reset(); | 925 db_.reset(); |
926 } | 926 } |
927 | 927 |
928 } // namespace fileapi | 928 } // namespace fileapi |
OLD | NEW |