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

Side by Side Diff: chrome/browser/conflicts/module_database_win.h

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 unified diff | Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/conflicts/module_database_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_ 5 #ifndef CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_
6 #define CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_ 6 #define CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "chrome/browser/conflicts/module_info_win.h" 17 #include "chrome/browser/conflicts/module_info_win.h"
18 #include "chrome/browser/conflicts/module_inspector_win.h"
18 #include "content/public/common/process_type.h" 19 #include "content/public/common/process_type.h"
19 20
20 // A class that keeps track of all modules loaded across Chrome processes. 21 // A class that keeps track of all modules loaded across Chrome processes.
21 // Drives the chrome://conflicts UI. 22 // Drives the chrome://conflicts UI.
22 // 23 //
23 // This is effectively a singleton, but doesn't use base::Singleton. The intent 24 // This is effectively a singleton, but doesn't use base::Singleton. The intent
24 // is for the object to be created when Chrome is single-threaded, and for it 25 // is for the object to be created when Chrome is single-threaded, and for it
25 // be set as the process-wide singleton via SetInstance. 26 // be set as the process-wide singleton via SetInstance.
26 class ModuleDatabase { 27 class ModuleDatabase {
27 public: 28 public:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ProcessInfo* GetProcessInfo(uint32_t process_id, uint64_t creation_time); 136 ProcessInfo* GetProcessInfo(uint32_t process_id, uint64_t creation_time);
136 137
137 // Creates a process info entry. 138 // Creates a process info entry.
138 void CreateProcessInfo(uint32_t process_id, 139 void CreateProcessInfo(uint32_t process_id,
139 uint64_t creation_time, 140 uint64_t creation_time,
140 content::ProcessType process_type); 141 content::ProcessType process_type);
141 142
142 // Deletes a process info entry. 143 // Deletes a process info entry.
143 void DeleteProcessInfo(uint32_t process_id, uint64_t creation_time); 144 void DeleteProcessInfo(uint32_t process_id, uint64_t creation_time);
144 145
146 // Callback for ModuleInspector.
147 void OnModuleInspected(
148 const ModuleInfoKey& module_key,
149 std::unique_ptr<ModuleInspectionResult> inspection_result);
150
145 // The task runner to which this object is bound. 151 // The task runner to which this object is bound.
146 scoped_refptr<base::SequencedTaskRunner> task_runner_; 152 scoped_refptr<base::SequencedTaskRunner> task_runner_;
147 153
148 // A map of all known modules. 154 // A map of all known modules.
149 ModuleMap modules_; 155 ModuleMap modules_;
150 156
157 // Inspects new modules on a blocking task runner.
158 ModuleInspector module_inspector_;
159
151 // A map of all known running processes, and modules loaded/unloaded in 160 // A map of all known running processes, and modules loaded/unloaded in
152 // them. 161 // them.
153 ProcessMap processes_; 162 ProcessMap processes_;
154 163
155 // Weak pointer factory for this object. This is used when bouncing 164 // Weak pointer factory for this object. This is used when bouncing
156 // incoming events to |task_runner_|. 165 // incoming events to |task_runner_|.
157 base::WeakPtrFactory<ModuleDatabase> weak_ptr_factory_; 166 base::WeakPtrFactory<ModuleDatabase> weak_ptr_factory_;
158 167
159 DISALLOW_COPY_AND_ASSIGN(ModuleDatabase); 168 DISALLOW_COPY_AND_ASSIGN(ModuleDatabase);
160 }; 169 };
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // 207 //
199 // These are modified by the various static *LoadAddress* helper functions in 208 // These are modified by the various static *LoadAddress* helper functions in
200 // ModuleDatabase. The vector maintains the invariant the element with maximum 209 // ModuleDatabase. The vector maintains the invariant the element with maximum
201 // module ID is always last. This ensures that the usual operation of loading 210 // module ID is always last. This ensures that the usual operation of loading
202 // a module is O(1). 211 // a module is O(1).
203 ModuleLoadAddresses loaded_modules; 212 ModuleLoadAddresses loaded_modules;
204 ModuleLoadAddresses unloaded_modules; 213 ModuleLoadAddresses unloaded_modules;
205 }; 214 };
206 215
207 #endif // CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_ 216 #endif // CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/conflicts/module_database_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698