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

Unified Diff: storage/browser/fileapi/sandbox_directory_database.cc

Issue 1639973002: FileSystem: Prevent iterator from being deleted after database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: storage/browser/fileapi/sandbox_directory_database.cc
diff --git a/storage/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc
index 343f09f5c7a22eb194434c9ed5d765ee8b69f6df..add0c3276b22da347cdc18c856af220f75c5057d 100644
--- a/storage/browser/fileapi/sandbox_directory_database.cc
+++ b/storage/browser/fileapi/sandbox_directory_database.cc
@@ -844,11 +844,14 @@ void SandboxDirectoryDatabase::ReportInitStatus(
bool SandboxDirectoryDatabase::StoreDefaultValues() {
// Verify that this is a totally new database, and initialize it.
- scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(leveldb::ReadOptions()));
- iter->SeekToFirst();
- if (iter->Valid()) { // DB was not empty--we shouldn't have been called.
- LOG(ERROR) << "File system origin database is corrupt!";
- return false;
+ {
+ scoped_ptr<leveldb::Iterator> iter(
nhiroki 2016/01/27 00:48:00 Can you add a comment about why we need to wrap th
cmumford 2016/01/27 16:33:56 Done.
+ db_->NewIterator(leveldb::ReadOptions()));
+ iter->SeekToFirst();
+ if (iter->Valid()) { // DB was not empty--we shouldn't have been called.
+ LOG(ERROR) << "File system origin database is corrupt!";
+ return false;
+ }
}
// This is always the first write into the database. If we ever add a
// version number, it should go in this transaction too.
« no previous file with comments | « no previous file | storage/browser/fileapi/sandbox_origin_database.cc » ('j') | storage/browser/fileapi/sandbox_origin_database.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698