Chromium Code Reviews| Index: chrome/browser/conflicts/module_event_sink_impl_win.cc |
| diff --git a/chrome/browser/conflicts/module_event_sink_impl_win.cc b/chrome/browser/conflicts/module_event_sink_impl_win.cc |
| index f9472830f0cfc531ee3e686ef8cd8a1c6f852f69..3c00012e6104fb09f5a1f0026ade6cac9a7defa0 100644 |
| --- a/chrome/browser/conflicts/module_event_sink_impl_win.cc |
| +++ b/chrome/browser/conflicts/module_event_sink_impl_win.cc |
| @@ -22,22 +22,6 @@ |
| namespace { |
| -// Gets the process creation time associated with the given process. |
| -bool GetProcessCreationTime(base::ProcessHandle process, |
| - uint64_t* creation_time) { |
| - FILETIME creation_ft = {}; |
| - FILETIME exit_ft = {}; |
| - FILETIME kernel_ft = {}; |
| - FILETIME user_ft = {}; |
| - if (!::GetProcessTimes(process, &creation_ft, &exit_ft, &kernel_ft, |
| - &user_ft)) { |
| - return false; |
| - } |
| - *creation_time = (static_cast<uint64_t>(creation_ft.dwHighDateTime) << 32) | |
| - static_cast<uint64_t>(creation_ft.dwLowDateTime); |
| - return true; |
| -} |
| - |
| // Gets the path of the module in the provided remote process. Returns true on |
| // success, false otherwise. |
| bool GetModulePath(base::ProcessHandle process, |
| @@ -132,11 +116,13 @@ ModuleEventSinkImpl::ModuleEventSinkImpl(base::ProcessHandle process, |
| ModuleEventSinkImpl::~ModuleEventSinkImpl() = default; |
| // static |
| -void ModuleEventSinkImpl::Create(base::ProcessHandle process, |
| - content::ProcessType process_type, |
| - ModuleDatabase* module_database, |
| - mojom::ModuleEventSinkRequest request) { |
| +void ModuleEventSinkImpl::Create( |
| + const GetProcessHandleCallback& get_process_handle, |
| + content::ProcessType process_type, |
| + ModuleDatabase* module_database, |
| + mojom::ModuleEventSinkRequest request) { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| + base::ProcessHandle process = get_process_handle.Run(); |
|
grt (UTC plus 2)
2017/01/06 09:44:58
std::move(get_process_handle).Run() to "consume" t
chrisha
2017/01/10 21:01:46
I'm fine with that, but have never seen it. Is thi
grt (UTC plus 2)
2017/01/11 15:07:54
I found it in https://chromium.googlesource.com/ch
chrisha
2017/01/11 21:14:11
Acknowledged.
|
| auto module_event_sink_impl = base::MakeUnique<ModuleEventSinkImpl>( |
| process, process_type, module_database); |
| base::Closure error_handler = base::Bind( |
| @@ -169,6 +155,22 @@ void ModuleEventSinkImpl::OnModuleEvent(mojom::ModuleEventType event_type, |
| } |
| } |
| +// static |
| +bool ModuleEventSinkImpl::GetProcessCreationTime(base::ProcessHandle process, |
| + uint64_t* creation_time) { |
| + FILETIME creation_ft = {}; |
| + FILETIME exit_ft = {}; |
| + FILETIME kernel_ft = {}; |
| + FILETIME user_ft = {}; |
| + if (!::GetProcessTimes(process, &creation_ft, &exit_ft, &kernel_ft, |
| + &user_ft)) { |
| + return false; |
| + } |
| + *creation_time = (static_cast<uint64_t>(creation_ft.dwHighDateTime) << 32) | |
| + static_cast<uint64_t>(creation_ft.dwLowDateTime); |
| + return true; |
| +} |
| + |
| void ModuleEventSinkImpl::OnModuleLoad(uint64_t load_address) { |
| if (in_error_) |
| return; |