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

Unified Diff: third_party/leveldatabase/env_chromium.cc

Issue 2964793002: leveldb: Use base::RepeatingCallback in DBTracker. (Closed)
Patch Set: Address comments Created 3 years, 5 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 | « third_party/leveldatabase/env_chromium.h ('k') | third_party/leveldatabase/env_chromium_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/leveldatabase/env_chromium.cc
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index 928d4be2027d0ab979c2e1f8aa9b1029b2e133b8..7a0f4ad03f18b378b52d94398510e54e6ccb05a4 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -11,6 +11,7 @@
#include <sys/types.h>
#endif
+#include "base/bind.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
@@ -1192,7 +1193,9 @@ class DBTracker::MemoryDumpProvider
public:
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) override {
- auto db_visitor = [&](TrackedDB* db) {
+ auto db_visitor = [](const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* pmd,
+ TrackedDB* db) {
std::string db_dump_name = base::StringPrintf(
"leveldatabase/0x%" PRIXPTR, reinterpret_cast<uintptr_t>(db));
auto* db_dump = pmd->CreateAllocatorDump(db_dump_name.c_str());
@@ -1222,7 +1225,8 @@ class DBTracker::MemoryDumpProvider
}
};
- DBTracker::GetInstance()->VisitDatabases(db_visitor);
+ DBTracker::GetInstance()->VisitDatabases(
+ base::BindRepeating(db_visitor, args, base::Unretained(pmd)));
return true;
}
};
@@ -1256,7 +1260,7 @@ leveldb::Status DBTracker::OpenDatabase(const leveldb::Options& options,
void DBTracker::VisitDatabases(const DatabaseVisitor& visitor) {
base::AutoLock lock(databases_lock_);
for (auto* i = databases_.head(); i != databases_.end(); i = i->next()) {
- visitor(i->value());
+ visitor.Run(i->value());
}
}
« no previous file with comments | « third_party/leveldatabase/env_chromium.h ('k') | third_party/leveldatabase/env_chromium_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698