Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Side by Side Diff: webkit/browser/fileapi/sandbox_directory_database.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 if (find_info.IsDirectory()) { 303 if (find_info.IsDirectory()) {
304 pending_directories.push(relative_file_path); 304 pending_directories.push(relative_file_path);
305 continue; 305 continue;
306 } 306 }
307 307
308 // Check if the file has a database entry. 308 // Check if the file has a database entry.
309 std::set<base::FilePath>::iterator itr = 309 std::set<base::FilePath>::iterator itr =
310 files_in_db_.find(relative_file_path); 310 files_in_db_.find(relative_file_path);
311 if (itr == files_in_db_.end()) { 311 if (itr == files_in_db_.end()) {
312 if (!file_util::Delete(absolute_file_path, false)) 312 if (!base::Delete(absolute_file_path, false))
313 return false; 313 return false;
314 } else { 314 } else {
315 files_in_db_.erase(itr); 315 files_in_db_.erase(itr);
316 } 316 }
317 } 317 }
318 } 318 }
319 319
320 return files_in_db_.empty(); 320 return files_in_db_.empty();
321 } 321 }
322 322
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel, 741 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel,
742 DB_REPAIR_SUCCEEDED, DB_REPAIR_MAX); 742 DB_REPAIR_SUCCEEDED, DB_REPAIR_MAX);
743 return true; 743 return true;
744 } 744 }
745 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel, 745 UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel,
746 DB_REPAIR_FAILED, DB_REPAIR_MAX); 746 DB_REPAIR_FAILED, DB_REPAIR_MAX);
747 LOG(WARNING) << "Failed to repair SandboxDirectoryDatabase."; 747 LOG(WARNING) << "Failed to repair SandboxDirectoryDatabase.";
748 // fall through 748 // fall through
749 case DELETE_ON_CORRUPTION: 749 case DELETE_ON_CORRUPTION:
750 LOG(WARNING) << "Clearing SandboxDirectoryDatabase."; 750 LOG(WARNING) << "Clearing SandboxDirectoryDatabase.";
751 if (!file_util::Delete(filesystem_data_directory_, true)) 751 if (!base::Delete(filesystem_data_directory_, true))
752 return false; 752 return false;
753 if (!file_util::CreateDirectory(filesystem_data_directory_)) 753 if (!file_util::CreateDirectory(filesystem_data_directory_))
754 return false; 754 return false;
755 return Init(FAIL_ON_CORRUPTION); 755 return Init(FAIL_ON_CORRUPTION);
756 } 756 }
757 757
758 NOTREACHED(); 758 NOTREACHED();
759 return false; 759 return false;
760 } 760 }
761 761
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 916
917 void SandboxDirectoryDatabase::HandleError( 917 void SandboxDirectoryDatabase::HandleError(
918 const tracked_objects::Location& from_here, 918 const tracked_objects::Location& from_here,
919 const leveldb::Status& status) { 919 const leveldb::Status& status) {
920 LOG(ERROR) << "SandboxDirectoryDatabase failed at: " 920 LOG(ERROR) << "SandboxDirectoryDatabase failed at: "
921 << from_here.ToString() << " with error: " << status.ToString(); 921 << from_here.ToString() << " with error: " << status.ToString();
922 db_.reset(); 922 db_.reset();
923 } 923 }
924 924
925 } // namespace fileapi 925 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/sandbox_database_test_helper.cc ('k') | webkit/browser/fileapi/sandbox_directory_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698