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

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

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

Powered by Google App Engine
This is Rietveld 408576698