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

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

Issue 2576843002: [win] Create ModuleDatabase and ModuleEventSinkImpl. (Closed)
Patch Set: Fix small bug. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_
6 #define CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_
7
8 #include <stdint.h>
9
10 #include "base/process/process_handle.h"
11 #include "chrome/common/conflicts/module_event_sink_win.mojom.h"
12 #include "content/public/common/process_type.h"
13
14 class ModuleDatabase;
15
16 // Implementation of the mojom::ModuleEventSink interface. This is the endpoint
17 // in the browser process. This redirects calls to the singleton ModuleDatabase
18 // object.
19 class ModuleEventSinkImpl : public mojom::ModuleEventSink {
20 public:
21 // Creates a service endpoint that forwards notifications from the remote
22 // |process| of the provided |process_type| to the provided |module_database|.
23 // The |module_database| must outlive this object.
24 ModuleEventSinkImpl(base::ProcessHandle process,
25 content::ProcessType process_type,
26 ModuleDatabase* module_database);
27 ~ModuleEventSinkImpl() override;
28
29 // Factory function for use with service_manager::InterfaceRegistry. This
30 // creates a concrete implementation of mojom::ModuleDatabase interface in the
31 // current process, for the remote process represented by the provided
32 // |request|. This should only be called on the UI thread.
33 static void Create(base::ProcessHandle process,
34 content::ProcessType process_type,
35 ModuleDatabase* module_database,
36 mojom::ModuleEventSinkRequest request);
37
38 // mojom::ModuleEventSink implementation:
39 void OnModuleEvent(mojom::ModuleEventType event_type,
40 uint64_t load_address) override;
41
42 bool in_error() const { return in_error_; }
43
44 private:
45 friend class ModuleEventSinkImplTest;
46
47 // OnModuleEvent disptaches to these two functions depending on the event
48 // type.
49 void OnModuleLoad(uint64_t load_address);
50 void OnModuleUnload(uint64_t load_address);
51
52 // A handle to the process on the other side of the pipe.
53 base::ProcessHandle process_;
54
55 // The module database this forwards events to. The |module_database| must
56 // outlive this object.
57 ModuleDatabase* module_database_;
58
59 // The process ID of the remote process on the other end of the pipe. This is
60 // forwarded along to the ModuleDatabase for each call.
61 uint32_t process_id_;
62
63 // The creation time of the process. Combined with process_id_ this uniquely
64 // identifies a process.
65 uint64_t creation_time_;
66
67 // Indicates whether or not this connection is in an error mode. If true then
68 // all communication from the remote client is silently dropped.
69 bool in_error_;
70
71 DISALLOW_COPY_AND_ASSIGN(ModuleEventSinkImpl);
72 };
73
74 #endif // CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/conflicts/module_database_win_unittest.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