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

Unified Diff: third_party/leveldatabase/env_chromium.h

Issue 2953473002: Use leveldb_env::OpenDB() to open leveldb databases. (Closed)
Patch Set: Don't dump in background mode 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
Index: third_party/leveldatabase/env_chromium.h
diff --git a/third_party/leveldatabase/env_chromium.h b/third_party/leveldatabase/env_chromium.h
index 690a032ad763cd96946e633de5145322bff4a592..9539ef13cf34208cf68e46d85ec0d52d1d5dc2a1 100644
--- a/third_party/leveldatabase/env_chromium.h
+++ b/third_party/leveldatabase/env_chromium.h
@@ -242,6 +242,13 @@ class DBTracker {
// DBTracker singleton instance.
static DBTracker* GetInstance();
+ // Returns name of memory-infra dump for |tracked_db|. Can be used to attach
+ // additional info to the database dump, or to properly attribute memory
+ // usage in memory dump providers that also dump |tracked_db|.
+ // Note that |tracked_db| should be a live database instance produced by
+ // OpenDatabase() method or leveldb_env::OpenDB() function.
+ static std::string GetMemoryDumpName(leveldb::DB* tracked_db);
+
// Provides extra information about a tracked database.
class TrackedDB : public leveldb::DB {
public:
@@ -252,6 +259,9 @@ class DBTracker {
// Opens a database and starts tracking it. As long as the opened database
// is alive (i.e. its instance is not destroyed) the database is exposed to
// memory-infra and is enumerated by VisitDatabases() method.
pwnall 2017/07/07 22:30:29 nit 1: Can you please add a statement that this i
+ // The function guarantees that:
pwnall 2017/07/07 22:30:29 nit 2: You could say that the function has the sam
DmitrySkiba 2017/07/17 22:09:25 Done.
+ // 1. |dbptr| is not touched on failure
+ // 2. |dbptr| is not NULL on success
leveldb::Status OpenDatabase(const leveldb::Options& options,
const std::string& name,
TrackedDB** dbptr);
@@ -285,7 +295,9 @@ class DBTracker {
};
// Opens a database and exposes it to Chrome's tracing (see DBTracker for
-// details). Note that |dbptr| is touched only when function succeeds.
+// details). The function guarantees that:
+// 1. |dbptr| is not touched on failure
+// 2. |dbptr| is not NULL on success
leveldb::Status OpenDB(const leveldb::Options& options,
const std::string& name,
std::unique_ptr<leveldb::DB>* dbptr);

Powered by Google App Engine
This is Rietveld 408576698