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

Unified Diff: content/browser/leveldb_wrapper_impl.cc

Issue 2697953002: Remove incorrect optimization in LevelDBWrapperImpl::DeleteAll(). (Closed)
Patch Set: fix web platform test Created 3 years, 10 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
« no previous file with comments | « no previous file | content/browser/leveldb_wrapper_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/leveldb_wrapper_impl.cc
diff --git a/content/browser/leveldb_wrapper_impl.cc b/content/browser/leveldb_wrapper_impl.cc
index a675adc07d298e5f5e3827f58fa46f293cc5292f..3f3c4e6fa26059824af8289a81a680959983c7f1 100644
--- a/content/browser/leveldb_wrapper_impl.cc
+++ b/content/browser/leveldb_wrapper_impl.cc
@@ -186,20 +186,23 @@ void LevelDBWrapperImpl::Delete(const std::vector<uint8_t>& key,
void LevelDBWrapperImpl::DeleteAll(const std::string& source,
const DeleteAllCallback& callback) {
- if (!map_ && !on_load_complete_tasks_.empty()) {
+ if (!map_) {
LoadMap(
base::Bind(&LevelDBWrapperImpl::DeleteAll, base::Unretained(this),
source, callback));
return;
}
- if (database_ && (!map_ || !map_->empty())) {
+ if (map_->empty()) {
+ callback.Run(true);
+ return;
+ }
+
+ if (database_) {
CreateCommitBatchIfNeeded();
commit_batch_->clear_all_first = true;
commit_batch_->changed_keys.clear();
}
- if (!map_)
- map_.reset(new ValueMap);
map_->clear();
bytes_used_ = 0;
« no previous file with comments | « no previous file | content/browser/leveldb_wrapper_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698