OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/conflicts/module_inspector_win.h" | 5 #include "chrome/browser/conflicts/module_inspector_win.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/task_scheduler/post_task.h" | 10 #include "base/task_scheduler/post_task.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 StringMapping GetPathMapping() { | 14 StringMapping GetPathMapping() { |
15 return GetEnvironmentVariablesMapping({ | 15 return GetEnvironmentVariablesMapping({ |
16 L"LOCALAPPDATA", L"ProgramFiles", L"ProgramData", L"USERPROFILE", | 16 L"LOCALAPPDATA", L"ProgramFiles", L"ProgramData", L"USERPROFILE", |
17 L"SystemRoot", L"TEMP", L"TMP", L"CommonProgramFiles", | 17 L"SystemRoot", L"TEMP", L"TMP", L"CommonProgramFiles", |
18 }); | 18 }); |
19 } | 19 } |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 ModuleInspector::ModuleInspector( | 23 ModuleInspector::ModuleInspector( |
24 const OnModuleInspectedCallback& on_module_inspected_callback) | 24 const OnModuleInspectedCallback& on_module_inspected_callback) |
25 : on_module_inspected_callback_(on_module_inspected_callback), | 25 : on_module_inspected_callback_(on_module_inspected_callback), |
26 inspection_task_traits_( | 26 inspection_task_traits_( |
27 base::TaskTraits() | 27 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
28 .MayBlock() | 28 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}), |
29 .WithPriority(base::TaskPriority::BACKGROUND) | |
30 .WithShutdownBehavior( | |
31 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)), | |
32 path_mapping_(GetPathMapping()), | 29 path_mapping_(GetPathMapping()), |
33 weak_ptr_factory_(this) {} | 30 weak_ptr_factory_(this) {} |
34 | 31 |
35 ModuleInspector::~ModuleInspector() = default; | 32 ModuleInspector::~ModuleInspector() = default; |
36 | 33 |
37 void ModuleInspector::AddModule(const ModuleInfoKey& module_key) { | 34 void ModuleInspector::AddModule(const ModuleInfoKey& module_key) { |
38 DCHECK(thread_checker_.CalledOnValidThread()); | 35 DCHECK(thread_checker_.CalledOnValidThread()); |
39 queue_.push(module_key); | 36 queue_.push(module_key); |
40 if (queue_.size() == 1) | 37 if (queue_.size() == 1) |
41 StartInspectingModule(); | 38 StartInspectingModule(); |
(...skipping 19 matching lines...) Expand all Loading... |
61 | 58 |
62 void ModuleInspector::OnInspectionFinished( | 59 void ModuleInspector::OnInspectionFinished( |
63 const ModuleInfoKey& module_key, | 60 const ModuleInfoKey& module_key, |
64 std::unique_ptr<ModuleInspectionResult> inspection_result) { | 61 std::unique_ptr<ModuleInspectionResult> inspection_result) { |
65 on_module_inspected_callback_.Run(module_key, std::move(inspection_result)); | 62 on_module_inspected_callback_.Run(module_key, std::move(inspection_result)); |
66 | 63 |
67 // Continue the work. | 64 // Continue the work. |
68 if (!queue_.empty()) | 65 if (!queue_.empty()) |
69 StartInspectingModule(); | 66 StartInspectingModule(); |
70 } | 67 } |
OLD | NEW |