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

Unified Diff: components/leveldb_proto/leveldb_database.h

Issue 2340983002: [tracing] Memory dump provider for leveldb_proto (Closed)
Patch Set: Fix test name and IOS build. Created 4 years, 3 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 | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/leveldb_proto/leveldb_database.h
diff --git a/components/leveldb_proto/leveldb_database.h b/components/leveldb_proto/leveldb_database.h
index a3caf2f932ae6ee16217bbca2bc016858c08d82d..4474a87ca644160a20e404eb200cf18900aaa25c 100644
--- a/components/leveldb_proto/leveldb_database.h
+++ b/components/leveldb_proto/leveldb_database.h
@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/strings/string_split.h"
#include "base/threading/thread_collision_warner.h"
+#include "base/trace_event/memory_dump_provider.h"
namespace base {
class HistogramBase;
@@ -29,14 +30,14 @@ namespace leveldb_proto {
// Interacts with the LevelDB third party module.
// Once constructed, function calls and destruction should all occur on the
// same thread (not necessarily the same as the constructor).
-class LevelDB {
+class LevelDB : base::trace_event::MemoryDumpProvider {
public:
// Constructor. Does *not* open a leveldb - only initialize this class.
// |client_name| is the name of the "client" that owns this instance. Used
// for UMA statics as so: LevelDB.<value>.<client name>. It is best to not
// change once shipped.
explicit LevelDB(const char* client_name);
- virtual ~LevelDB();
+ ~LevelDB() override;
virtual bool InitWithOptions(const base::FilePath& database_dir,
const leveldb::Options& options);
@@ -48,6 +49,10 @@ class LevelDB {
static bool Destroy(const base::FilePath& database_dir);
+ // base::trace_event::MemoryDumpProvider implementation.
+ bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& dump_args,
+ base::trace_event::ProcessMemoryDump* pmd) override;
+
private:
DFAKE_MUTEX(thread_checker_);
@@ -56,6 +61,8 @@ class LevelDB {
std::unique_ptr<leveldb::Env> env_;
std::unique_ptr<leveldb::DB> db_;
base::HistogramBase* open_histogram_;
+ // Name of the client shown in chrome://tracing.
+ std::string client_name_;
DISALLOW_COPY_AND_ASSIGN(LevelDB);
};
« no previous file with comments | « no previous file | components/leveldb_proto/leveldb_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698