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

Unified Diff: chrome/browser/conflicts/module_database_win.cc

Issue 2613803005: [win] Enable ModuleDatabase behind a flag. (Closed)
Patch Set: Address grt's comments. Created 3 years, 11 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: chrome/browser/conflicts/module_database_win.cc
diff --git a/chrome/browser/conflicts/module_database_win.cc b/chrome/browser/conflicts/module_database_win.cc
index 969bdaab7e2f99d29ca761b8640646dfaee8e677..0c3fb69fbfb8a1a58074fcb735d1996af8a11110 100644
--- a/chrome/browser/conflicts/module_database_win.cc
+++ b/chrome/browser/conflicts/module_database_win.cc
@@ -19,13 +19,32 @@ static_assert(content::PROCESS_TYPE_BROWSER == 2,
"assumes browser process type has value 2");
constexpr uint32_t kFirstValidProcessType = content::PROCESS_TYPE_BROWSER;
+ModuleDatabase* g_instance = nullptr;
+
} // namespace
ModuleDatabase::ModuleDatabase(
scoped_refptr<base::SequencedTaskRunner> task_runner)
: task_runner_(std::move(task_runner)), weak_ptr_factory_(this) {}
-ModuleDatabase::~ModuleDatabase() = default;
+ModuleDatabase::~ModuleDatabase() {
+ if (this == g_instance)
+ g_instance = nullptr;
+}
+
+// static
+ModuleDatabase* ModuleDatabase::GetInstance() {
+ return g_instance;
+}
+
+// static
+void ModuleDatabase::SetInstance(
+ std::unique_ptr<ModuleDatabase> module_database) {
+ DCHECK_EQ(nullptr, g_instance);
+ // This is deliberately leaked. It can be cleaned up by manually deleting the
+ // ModuleDatabase
+ g_instance = module_database.release();
+}
void ModuleDatabase::OnProcessStarted(uint32_t process_id,
uint64_t creation_time,

Powered by Google App Engine
This is Rietveld 408576698