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

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

Issue 2916663002: Pass the path mapping via RefCountedData in ModuleInspector (Closed)
Patch Set: Created 3 years, 7 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 | « chrome/browser/conflicts/module_inspector_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/conflicts/module_inspector_win.cc
diff --git a/chrome/browser/conflicts/module_inspector_win.cc b/chrome/browser/conflicts/module_inspector_win.cc
index e706b06ea2ab9c14a318544e469051a463ede8b6..a17b640e7280b8d30cef907456d39bfc3d0f25bc 100644
--- a/chrome/browser/conflicts/module_inspector_win.cc
+++ b/chrome/browser/conflicts/module_inspector_win.cc
@@ -18,13 +18,22 @@ StringMapping GetPathMapping() {
});
}
+// Wrapper function for InspectModule() that takes the StringMapping via a
+// scoped_refptr. This saves a copy per invocation.
+std::unique_ptr<ModuleInspectionResult> InspectModuleOnBlockingSequence(
+ scoped_refptr<base::RefCountedData<StringMapping>> env_variable_mapping,
+ const ModuleInfoKey& module_key) {
+ return InspectModule(env_variable_mapping->data, module_key);
+}
+
} // namespace
ModuleInspector::ModuleInspector(
const OnModuleInspectedCallback& on_module_inspected_callback)
: on_module_inspected_callback_(on_module_inspected_callback),
inspection_task_priority_(base::TaskPriority::BACKGROUND),
- path_mapping_(GetPathMapping()),
+ path_mapping_(base::MakeRefCounted<base::RefCountedData<StringMapping>>(
+ GetPathMapping())),
weak_ptr_factory_(this) {}
ModuleInspector::~ModuleInspector() = default;
@@ -50,7 +59,8 @@ void ModuleInspector::StartInspectingModule() {
FROM_HERE,
{base::MayBlock(), inspection_task_priority_,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
- base::BindOnce(&InspectModule, path_mapping_, module_key),
+ base::BindOnce(&InspectModuleOnBlockingSequence, path_mapping_,
+ module_key),
base::BindOnce(&ModuleInspector::OnInspectionFinished,
weak_ptr_factory_.GetWeakPtr(), module_key));
}
« no previous file with comments | « chrome/browser/conflicts/module_inspector_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698