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

Unified Diff: content/browser/leveldb_wrapper_impl.cc

Issue 2597353002: Add callback to LevelDBWrapperImpl to allow extra operations on commit. (Closed)
Patch Set: Created 4 years 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 | « content/browser/leveldb_wrapper_impl.h ('k') | 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 69cf6ceb53eca8f6f6943b18738e57d4abeecbb9..15ee20d374b9722f9c3a08334fd83f16f5202ef6 100644
--- a/content/browser/leveldb_wrapper_impl.cc
+++ b/content/browser/leveldb_wrapper_impl.cc
@@ -41,9 +41,11 @@ LevelDBWrapperImpl::LevelDBWrapperImpl(
base::TimeDelta default_commit_delay,
int max_bytes_per_hour,
int max_commits_per_hour,
- const base::Closure& no_bindings_callback)
+ const base::Closure& no_bindings_callback,
+ const PrepareToCommitCallback& prepare_to_commit_callback)
: prefix_(leveldb::StdStringToUint8Vector(prefix)),
no_bindings_callback_(no_bindings_callback),
+ prepare_to_commit_callback_(prepare_to_commit_callback),
database_(database),
bytes_used_(0),
max_size_(max_size),
@@ -334,7 +336,8 @@ void LevelDBWrapperImpl::CommitChanges() {
commit_rate_limiter_.add_samples(1);
// Commit all our changes in a single batch.
- std::vector<leveldb::mojom::BatchedOperationPtr> operations;
+ std::vector<leveldb::mojom::BatchedOperationPtr> operations =
+ prepare_to_commit_callback_.Run();
if (commit_batch_->clear_all_first) {
leveldb::mojom::BatchedOperationPtr item =
leveldb::mojom::BatchedOperation::New();
« no previous file with comments | « content/browser/leveldb_wrapper_impl.h ('k') | content/browser/leveldb_wrapper_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698