| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <sddl.h> | 6 #include <sddl.h> |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "base/strings/string_number_conversions.h" | 26 #include "base/strings/string_number_conversions.h" |
| 27 #include "base/strings/string_piece.h" | 27 #include "base/strings/string_piece.h" |
| 28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 29 #include "base/synchronization/waitable_event.h" | 29 #include "base/synchronization/waitable_event.h" |
| 30 #include "base/threading/platform_thread.h" | 30 #include "base/threading/platform_thread.h" |
| 31 #include "base/threading/thread.h" | 31 #include "base/threading/thread.h" |
| 32 #include "base/threading/thread_task_runner_handle.h" | 32 #include "base/threading/thread_task_runner_handle.h" |
| 33 #include "base/time/time.h" | 33 #include "base/time/time.h" |
| 34 #include "base/win/scoped_handle.h" | 34 #include "base/win/scoped_handle.h" |
| 35 #include "base/win/win_util.h" | 35 #include "base/win/win_util.h" |
| 36 | |
| 37 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" | 36 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" |
| 38 #include "chrome/installer/util/util_constants.h" | 37 #include "chrome/common/chrome_constants.h" |
| 38 #include "chrome/install_static/install_details.h" |
| 39 #include "chrome_elf/chrome_elf_constants.h" |
| 39 #include "components/browser_watcher/endsession_watcher_window_win.h" | 40 #include "components/browser_watcher/endsession_watcher_window_win.h" |
| 40 #include "components/browser_watcher/exit_code_watcher_win.h" | 41 #include "components/browser_watcher/exit_code_watcher_win.h" |
| 41 #include "components/browser_watcher/window_hang_monitor_win.h" | 42 #include "components/browser_watcher/window_hang_monitor_win.h" |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // Use the same log facility as Chrome for convenience. | 46 // Use the same log facility as Chrome for convenience. |
| 46 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} | 47 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} |
| 47 const GUID kChromeWatcherTraceProviderName = { | 48 const GUID kChromeWatcherTraceProviderName = { |
| 48 0x7fe69228, 0x633e, 0x4f06, | 49 0x7fe69228, 0x633e, 0x4f06, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 181 } |
| 181 | 182 |
| 182 } // namespace | 183 } // namespace |
| 183 | 184 |
| 184 // The main entry point to the watcher, declared as extern "C" to avoid name | 185 // The main entry point to the watcher, declared as extern "C" to avoid name |
| 185 // mangling. | 186 // mangling. |
| 186 extern "C" int WatcherMain(const base::char16* registry_path, | 187 extern "C" int WatcherMain(const base::char16* registry_path, |
| 187 HANDLE process_handle, | 188 HANDLE process_handle, |
| 188 DWORD main_thread_id, | 189 DWORD main_thread_id, |
| 189 HANDLE on_initialized_event_handle, | 190 HANDLE on_initialized_event_handle, |
| 190 const base::char16* browser_data_directory, | 191 const base::char16* browser_data_directory) { |
| 191 const base::char16* channel_name) { | 192 install_static::InstallDetails::InitializeForModule( |
| 193 chrome::kChromeElfDllName, kChromeElfInstallDetailsPayloadFunctionName); |
| 192 base::Process process(process_handle); | 194 base::Process process(process_handle); |
| 193 base::win::ScopedHandle on_initialized_event(on_initialized_event_handle); | 195 base::win::ScopedHandle on_initialized_event(on_initialized_event_handle); |
| 194 | 196 |
| 195 // The exit manager is in charge of calling the dtors of singletons. | 197 // The exit manager is in charge of calling the dtors of singletons. |
| 196 base::AtExitManager exit_manager; | 198 base::AtExitManager exit_manager; |
| 197 // Initialize the commandline singleton from the environment. | 199 // Initialize the commandline singleton from the environment. |
| 198 base::CommandLine::Init(0, nullptr); | 200 base::CommandLine::Init(0, nullptr); |
| 199 | 201 |
| 200 logging::LogEventProvider::Initialize(kChromeWatcherTraceProviderName); | 202 logging::LogEventProvider::Initialize(kChromeWatcherTraceProviderName); |
| 201 | 203 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 218 | 220 |
| 219 // Wind logging down. | 221 // Wind logging down. |
| 220 logging::LogEventProvider::Uninitialize(); | 222 logging::LogEventProvider::Uninitialize(); |
| 221 | 223 |
| 222 return 0; | 224 return 0; |
| 223 } | 225 } |
| 224 | 226 |
| 225 static_assert( | 227 static_assert( |
| 226 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, | 228 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, |
| 227 "WatcherMain() has wrong type"); | 229 "WatcherMain() has wrong type"); |
| OLD | NEW |