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_origin_database.h" | 5 #include "webkit/browser/fileapi/sandbox_origin_database.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 DB_REPAIR_SUCCEEDED, DB_REPAIR_MAX); | 104 DB_REPAIR_SUCCEEDED, DB_REPAIR_MAX); |
105 LOG(WARNING) << "Repairing SandboxOriginDatabase completed."; | 105 LOG(WARNING) << "Repairing SandboxOriginDatabase completed."; |
106 return true; | 106 return true; |
107 } | 107 } |
108 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel, | 108 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel, |
109 DB_REPAIR_FAILED, DB_REPAIR_MAX); | 109 DB_REPAIR_FAILED, DB_REPAIR_MAX); |
110 // fall through | 110 // fall through |
111 case DELETE_ON_CORRUPTION: | 111 case DELETE_ON_CORRUPTION: |
112 if (!base::DeleteFile(file_system_directory_, true)) | 112 if (!base::DeleteFile(file_system_directory_, true)) |
113 return false; | 113 return false; |
114 if (!file_util::CreateDirectory(file_system_directory_)) | 114 if (!base::CreateDirectory(file_system_directory_)) |
115 return false; | 115 return false; |
116 return Init(init_option, FAIL_ON_CORRUPTION); | 116 return Init(init_option, FAIL_ON_CORRUPTION); |
117 } | 117 } |
118 NOTREACHED(); | 118 NOTREACHED(); |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 bool SandboxOriginDatabase::RepairDatabase(const std::string& db_path) { | 122 bool SandboxOriginDatabase::RepairDatabase(const std::string& db_path) { |
123 DCHECK(!db_.get()); | 123 DCHECK(!db_.get()); |
124 leveldb::Options options; | 124 leveldb::Options options; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 db_->Put(leveldb::WriteOptions(), LastPathKey(), std::string("-1")); | 332 db_->Put(leveldb::WriteOptions(), LastPathKey(), std::string("-1")); |
333 if (!status.ok()) { | 333 if (!status.ok()) { |
334 HandleError(FROM_HERE, status); | 334 HandleError(FROM_HERE, status); |
335 return false; | 335 return false; |
336 } | 336 } |
337 *number = -1; | 337 *number = -1; |
338 return true; | 338 return true; |
339 } | 339 } |
340 | 340 |
341 } // namespace fileapi | 341 } // namespace fileapi |
OLD | NEW |