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

Side by Side Diff: chrome/browser/conflicts/module_event_sink_impl_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_EVENT_SINK_IMPL_WIN_H_ 5 #ifndef CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_
6 #define CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_ 6 #define CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback_forward.h"
10 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
11 #include "chrome/common/conflicts/module_event_sink_win.mojom.h" 12 #include "chrome/common/conflicts/module_event_sink_win.mojom.h"
12 #include "content/public/common/process_type.h" 13 #include "content/public/common/process_type.h"
13 14
14 class ModuleDatabase; 15 class ModuleDatabase;
15 16
16 // Implementation of the mojom::ModuleEventSink interface. This is the endpoint 17 // Implementation of the mojom::ModuleEventSink interface. This is the endpoint
17 // in the browser process. This redirects calls to the singleton ModuleDatabase 18 // in the browser process. This redirects calls to the singleton ModuleDatabase
18 // object. 19 // object.
19 class ModuleEventSinkImpl : public mojom::ModuleEventSink { 20 class ModuleEventSinkImpl : public mojom::ModuleEventSink {
20 public: 21 public:
22 // Callback for retrieving the handle associated with a process. This is used
23 // by "Create" to get a handle to the remote process.
24 using GetProcessHandleCallback = base::Callback<base::ProcessHandle()>;
25
21 // Creates a service endpoint that forwards notifications from the remote 26 // Creates a service endpoint that forwards notifications from the remote
22 // |process| of the provided |process_type| to the provided |module_database|. 27 // |process| of the provided |process_type| to the provided |module_database|.
23 // The |module_database| must outlive this object. 28 // The |module_database| must outlive this object.
24 ModuleEventSinkImpl(base::ProcessHandle process, 29 ModuleEventSinkImpl(base::ProcessHandle process,
25 content::ProcessType process_type, 30 content::ProcessType process_type,
26 ModuleDatabase* module_database); 31 ModuleDatabase* module_database);
27 ~ModuleEventSinkImpl() override; 32 ~ModuleEventSinkImpl() override;
28 33
29 // Factory function for use with service_manager::InterfaceRegistry. This 34 // Factory function for use with service_manager::InterfaceRegistry. This
30 // creates a concrete implementation of mojom::ModuleDatabase interface in the 35 // creates a concrete implementation of mojom::ModuleDatabase interface in the
31 // current process, for the remote process represented by the provided 36 // current process, for the remote process represented by the provided
32 // |request|. This should only be called on the UI thread. 37 // |request|. This should only be called on the UI thread.
33 static void Create(base::ProcessHandle process, 38 static void Create(GetProcessHandleCallback get_process_handle,
34 content::ProcessType process_type, 39 content::ProcessType process_type,
35 ModuleDatabase* module_database, 40 ModuleDatabase* module_database,
36 mojom::ModuleEventSinkRequest request); 41 mojom::ModuleEventSinkRequest request);
37 42
38 // mojom::ModuleEventSink implementation: 43 // mojom::ModuleEventSink implementation:
39 void OnModuleEvent(mojom::ModuleEventType event_type, 44 void OnModuleEvent(mojom::ModuleEventType event_type,
40 uint64_t load_address) override; 45 uint64_t load_address) override;
41 46
42 bool in_error() const { return in_error_; } 47 bool in_error() const { return in_error_; }
43 48
49 // Gets the process creation time associated with the given process.
50 static bool GetProcessCreationTime(base::ProcessHandle process,
51 uint64_t* creation_time);
52
44 private: 53 private:
45 friend class ModuleEventSinkImplTest; 54 friend class ModuleEventSinkImplTest;
46 55
47 // OnModuleEvent disptaches to these two functions depending on the event 56 // OnModuleEvent disptaches to these two functions depending on the event
48 // type. 57 // type.
49 void OnModuleLoad(uint64_t load_address); 58 void OnModuleLoad(uint64_t load_address);
50 void OnModuleUnload(uint64_t load_address); 59 void OnModuleUnload(uint64_t load_address);
51 60
52 // A handle to the process on the other side of the pipe. 61 // A handle to the process on the other side of the pipe.
53 base::ProcessHandle process_; 62 base::ProcessHandle process_;
(...skipping 11 matching lines...) Expand all
65 uint64_t creation_time_; 74 uint64_t creation_time_;
66 75
67 // Indicates whether or not this connection is in an error mode. If true then 76 // Indicates whether or not this connection is in an error mode. If true then
68 // all communication from the remote client is silently dropped. 77 // all communication from the remote client is silently dropped.
69 bool in_error_; 78 bool in_error_;
70 79
71 DISALLOW_COPY_AND_ASSIGN(ModuleEventSinkImpl); 80 DISALLOW_COPY_AND_ASSIGN(ModuleEventSinkImpl);
72 }; 81 };
73 82
74 #endif // CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_ 83 #endif // CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/conflicts/module_database_win.cc ('k') | chrome/browser/conflicts/module_event_sink_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698