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

Unified Diff: webkit/dom_storage/dom_storage_database.cc

Issue 9817011: DomStorage data deletion and memory purging. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
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.
Close();
file_util::Delete(file_path_, false);
+ file_util::Delete(GetJournalFilePath(file_path_), false);
}
}

Powered by Google App Engine
This is Rietveld 408576698