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

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

Issue 2721503003: Add ModuleInspector (Closed)
Patch Set: merge Created 3 years, 9 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 da6397a9c010ab78acb255407483372f6fe1d985..217b19975300d310656ff536be1e9617d348c23a 100644
--- a/chrome/browser/conflicts/module_database_win.cc
+++ b/chrome/browser/conflicts/module_database_win.cc
@@ -25,7 +25,12 @@ ModuleDatabase* g_instance = nullptr;
ModuleDatabase::ModuleDatabase(
scoped_refptr<base::SequencedTaskRunner> task_runner)
- : task_runner_(std::move(task_runner)), weak_ptr_factory_(this) {}
+ : task_runner_(std::move(task_runner)),
+ // ModuleDatabase owns |module_inspector_|, so it is safe to use
+ // base::Unretained().
+ module_inspector_(base::Bind(&ModuleDatabase::OnModuleInspected,
+ base::Unretained(this))),
+ weak_ptr_factory_(this) {}
ModuleDatabase::~ModuleDatabase() {
if (this == g_instance)
@@ -294,6 +299,10 @@ ModuleDatabase::ModuleInfo* ModuleDatabase::FindOrCreateModuleInfo(
modules_.size()),
std::forward_as_tuple());
+ // New modules must be inspected.
+ if (result.second)
+ module_inspector_.AddModule(result.first->first);
+
return &(*result.first);
}
@@ -322,6 +331,16 @@ void ModuleDatabase::DeleteProcessInfo(uint32_t process_id,
processes_.erase(key);
}
+void ModuleDatabase::OnModuleInspected(
+ const ModuleInfoKey& module_key,
+ std::unique_ptr<ModuleInspectionResult> inspection_result) {
+ DCHECK(task_runner_->RunsTasksOnCurrentThread());
+
+ auto it = modules_.find(module_key);
+ if (it != modules_.end())
+ it->second.inspection_result = std::move(inspection_result);
+}
+
// ModuleDatabase::ProcessInfoKey ----------------------------------------------
ModuleDatabase::ProcessInfoKey::ProcessInfoKey(
« no previous file with comments | « chrome/browser/conflicts/module_database_win.h ('k') | chrome/browser/conflicts/module_database_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698