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

Unified Diff: storage/browser/fileapi/sandbox_origin_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_origin_database.cc
diff --git a/storage/browser/fileapi/sandbox_origin_database.cc b/storage/browser/fileapi/sandbox_origin_database.cc
index 85424a2351c8b3f08a5db910cc71491bc3f32d43..12bbafead7d9c06c60e59ef3a72949d1ba1dc3ff 100644
--- a/storage/browser/fileapi/sandbox_origin_database.cc
+++ b/storage/browser/fileapi/sandbox_origin_database.cc
@@ -331,16 +331,18 @@ bool SandboxOriginDatabase::GetLastPathNumber(int* number) {
return false;
}
// 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, but had no last path number!
- LOG(ERROR) << "File system origin database is corrupt!";
- return false;
+ {
+ scoped_ptr<leveldb::Iterator> iter(
nhiroki 2016/01/27 00:48:00 ditto.
cmumford 2016/01/27 16:33:56 Done.
+ db_->NewIterator(leveldb::ReadOptions()));
+ iter->SeekToFirst();
+ if (iter->Valid()) { // DB was not empty, but had no last path number!
+ 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, they should go in in a single transaction.
- status =
- db_->Put(leveldb::WriteOptions(), LastPathKey(), std::string("-1"));
+ status = db_->Put(leveldb::WriteOptions(), LastPathKey(), std::string("-1"));
if (!status.ok()) {
HandleError(FROM_HERE, status);
return false;

Powered by Google App Engine
This is Rietveld 408576698