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

Unified Diff: third_party/leveldatabase/env_chromium.h

Issue 2953473002: Use leveldb_env::OpenDB() to open leveldb databases. (Closed)
Patch Set: Rebase; add comments to CHECK() 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 | « storage/browser/fileapi/sandbox_origin_database.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..02a68c6416ececa46669a493d7e69fed47e2227f 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,8 @@ 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.
+ // This function is an implementation detail of leveldb_env::OpenDB(), and
+ // has similar guarantees regarding |dbptr| argument.
leveldb::Status OpenDatabase(const leveldb::Options& options,
const std::string& name,
TrackedDB** dbptr);
@@ -285,7 +294,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);
« no previous file with comments | « storage/browser/fileapi/sandbox_origin_database.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698