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/appcache/appcache_database.h" | 5 #include "webkit/browser/appcache/appcache_database.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 | 1179 |
1180 bool AppCacheDatabase::DeleteExistingAndCreateNewDatabase() { | 1180 bool AppCacheDatabase::DeleteExistingAndCreateNewDatabase() { |
1181 DCHECK(!db_file_path_.empty()); | 1181 DCHECK(!db_file_path_.empty()); |
1182 DCHECK(file_util::PathExists(db_file_path_)); | 1182 DCHECK(file_util::PathExists(db_file_path_)); |
1183 VLOG(1) << "Deleting existing appcache data and starting over."; | 1183 VLOG(1) << "Deleting existing appcache data and starting over."; |
1184 | 1184 |
1185 ResetConnectionAndTables(); | 1185 ResetConnectionAndTables(); |
1186 | 1186 |
1187 // This also deletes the disk cache data. | 1187 // This also deletes the disk cache data. |
1188 base::FilePath directory = db_file_path_.DirName(); | 1188 base::FilePath directory = db_file_path_.DirName(); |
1189 if (!file_util::Delete(directory, true) || | 1189 if (!base::Delete(directory, true) || |
1190 !file_util::CreateDirectory(directory)) { | 1190 !file_util::CreateDirectory(directory)) { |
1191 return false; | 1191 return false; |
1192 } | 1192 } |
1193 | 1193 |
1194 // Make sure the steps above actually deleted things. | 1194 // Make sure the steps above actually deleted things. |
1195 if (file_util::PathExists(db_file_path_)) | 1195 if (file_util::PathExists(db_file_path_)) |
1196 return false; | 1196 return false; |
1197 | 1197 |
1198 // So we can't go recursive. | 1198 // So we can't go recursive. |
1199 if (is_recreating_) | 1199 if (is_recreating_) |
1200 return false; | 1200 return false; |
1201 | 1201 |
1202 base::AutoReset<bool> auto_reset(&is_recreating_, true); | 1202 base::AutoReset<bool> auto_reset(&is_recreating_, true); |
1203 return LazyOpen(true); | 1203 return LazyOpen(true); |
1204 } | 1204 } |
1205 | 1205 |
1206 } // namespace appcache | 1206 } // namespace appcache |
OLD | NEW |