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

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

Issue 2613803005: [win] Enable ModuleDatabase behind a flag. (Closed)
Patch Set: Rebase. 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 22c1d7909b55d2318db480350ff5820627014165..af71f6eec30813b79fdd1ae8ed1d6b6efeaa05a6 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,
« no previous file with comments | « chrome/browser/conflicts/module_database_win.h ('k') | chrome/browser/conflicts/module_event_sink_impl_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698