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

Side by Side Diff: webkit/fileapi/file_system_directory_database.cc

Issue 13946004: FileAPI: Run database recovery on IOError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +test Created 7 years, 8 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
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/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
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())
kinuko 2013/04/10 06:23:49 Let me confirm. What other error types could we ha
tzik 2013/04/10 06:49:20 Status can be one of: - NotFound, - Corruption,
kinuko 2013/04/10 08:41:17 Can we have a brief comment about them? Or at leas
tzik 2013/04/10 10:59:49 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698