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

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

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 unified diff | Download patch
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 <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
15 #include "content/public/common/process_type.h" 15 #include "content/public/common/process_type.h"
16 16
17 // A class that keeps track of all modules loaded across Chrome processes. 17 // A class that keeps track of all modules loaded across Chrome processes.
18 // Drives the chrome://conflicts UI. 18 // Drives the chrome://conflicts UI.
19 //
20 // This is effectively a singleton, but doesn't use base::Singleton. The intent
21 // is for the object to be created when Chrome is single-threaded, and for it
22 // be set as the process-wide singleton via SetInstance.
19 class ModuleDatabase { 23 class ModuleDatabase {
20 public: 24 public:
21 // A ModuleDatabase is by default bound to a provided sequenced task runner. 25 // A ModuleDatabase is by default bound to a provided sequenced task runner.
22 // All calls must be made in the context of this task runner, unless 26 // All calls must be made in the context of this task runner, unless
23 // otherwise noted. For calls from other contexts this task runner is used to 27 // otherwise noted. For calls from other contexts this task runner is used to
24 // bounce the call when appropriate. 28 // bounce the call when appropriate.
25 explicit ModuleDatabase(scoped_refptr<base::SequencedTaskRunner> task_runner); 29 explicit ModuleDatabase(scoped_refptr<base::SequencedTaskRunner> task_runner);
26 ~ModuleDatabase(); 30 ~ModuleDatabase();
27 31
32 // Retrieves the singleton global instance of the ModuleDatabase.
33 static ModuleDatabase* GetInstance();
34
35 // Sets the global instance of the ModuleDatabase. Ownership is passed to the
36 // global instance and deliberately leaked, unless manually cleaned up. This
37 // has no locking and should be called when Chrome is single threaded.
38 static void SetInstance(std::unique_ptr<ModuleDatabase> module_database);
39
28 // Indicates that process with the given type has started. This must be called 40 // Indicates that process with the given type has started. This must be called
29 // before any calls to OnModuleEvent or OnModuleUnload. Must be called in the 41 // before any calls to OnModuleEvent or OnModuleUnload. Must be called in the
30 // same sequence as |task_runner_|. 42 // same sequence as |task_runner_|.
31 void OnProcessStarted(uint32_t process_id, 43 void OnProcessStarted(uint32_t process_id,
32 uint64_t creation_time, 44 uint64_t creation_time,
33 content::ProcessType process_type); 45 content::ProcessType process_type);
34 46
35 // Indicates that a module has been loaded. The data passed to this function 47 // Indicates that a module has been loaded. The data passed to this function
36 // is taken as gospel, so if it originates from a remote process it should be 48 // is taken as gospel, so if it originates from a remote process it should be
37 // independently validated first. (In practice, see ModuleEventSinkImpl for 49 // independently validated first. (In practice, see ModuleEventSinkImpl for
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // 246 //
235 // These are modified by the various static *LoadAddress* helper functions in 247 // These are modified by the various static *LoadAddress* helper functions in
236 // ModuleDatabase. The vector maintains the invariant the element with maximum 248 // ModuleDatabase. The vector maintains the invariant the element with maximum
237 // module ID is always last. This ensures that the usual operation of loading 249 // module ID is always last. This ensures that the usual operation of loading
238 // a module is O(1). 250 // a module is O(1).
239 ModuleLoadAddresses loaded_modules; 251 ModuleLoadAddresses loaded_modules;
240 ModuleLoadAddresses unloaded_modules; 252 ModuleLoadAddresses unloaded_modules;
241 }; 253 };
242 254
243 #endif // CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_ 255 #endif // CHROME_BROWSER_CONFLICTS_MODULE_DATABASE_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/conflicts/module_database_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698