Chromium Code Reviews| OLD | NEW | 
|---|---|
| (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 explicit ModuleEventSinkImpl(base::ProcessHandle process, | |
| 
 
grt (UTC plus 2)
2016/12/20 11:11:35
nit: no explicit
 
chrisha
2016/12/20 19:46:24
Done.
 
 | |
| 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; | |
| 39 | |
| 40 private: | |
| 41 friend class ModuleEventSinkImplTest; | |
| 42 | |
| 43 // OnModuleEvent reroutes to these two functions depending on the event | |
| 
 
grt (UTC plus 2)
2016/12/20 11:11:35
reroutes or just routes? how about dispatches or c
 
chrisha
2016/12/20 19:46:24
Done.
 
 | |
| 44 // type. | |
| 45 void OnModuleLoad(mojom::ModuleEventType event_type, uint64_t load_address); | |
| 46 void OnModuleUnload(uint64_t load_address); | |
| 47 | |
| 48 // A handle to the process on the other side of the pipe. | |
| 49 base::ProcessHandle process_; | |
| 50 | |
| 51 // The module database this forwards events to. The |module_database| must | |
| 52 // outlive this object. | |
| 53 ModuleDatabase* module_database_; | |
| 54 | |
| 55 // The process ID of the remote process on the other end of the pipe. This is | |
| 56 // forwarded along to the ModuleDatabase for each call. | |
| 57 uint32_t process_id_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(ModuleEventSinkImpl); | |
| 60 }; | |
| 61 | |
| 62 #endif // CHROME_BROWSER_CONFLICTS_MODULE_EVENT_SINK_IMPL_WIN_H_ | |
| OLD | NEW |