Chromium Code Reviews| Index: webkit/dom_storage/dom_storage_database.cc |
| =================================================================== |
| --- webkit/dom_storage/dom_storage_database.cc (revision 127981) |
| +++ webkit/dom_storage/dom_storage_database.cc (working copy) |
| @@ -13,6 +13,8 @@ |
| namespace { |
| +const FilePath::CharType kJournal[] = FILE_PATH_LITERAL("-journal"); |
| + |
| class HistogramUniquifier { |
| public: |
| static const char* name() { return "Sqlite.DomStorageDatabase.Error"; } |
| @@ -26,6 +28,14 @@ |
| namespace dom_storage { |
| +// static |
| +FilePath DomStorageDatabase::GetJournalFilePath( |
| + const FilePath& database_path) { |
| + FilePath::StringType journal_file_name = |
| + database_path.BaseName().value() + kJournal; |
| + return database_path.DirName().Append(journal_file_name); |
| +} |
| + |
| DomStorageDatabase::DomStorageDatabase(const FilePath& file_path) |
| : file_path_(file_path) { |
| // Note: in normal use we should never get an empty backing path here. |
| @@ -49,9 +59,10 @@ |
| DomStorageDatabase::~DomStorageDatabase() { |
| if (known_to_be_empty_ && !file_path_.empty()) { |
| - // Delete the db from disk, it's empty. |
| + // Delete the db and any lingering journal file from disk. |
|
michaeln
2012/03/21 23:22:02
added additional logic to also delete lingering jo
|
| Close(); |
| file_util::Delete(file_path_, false); |
| + file_util::Delete(GetJournalFilePath(file_path_), false); |
| } |
| } |