| 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 16 matching lines...) Expand all Loading... |
| 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 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" | 36 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" |
| 37 #include "chrome/common/chrome_constants.h" | 37 #include "chrome/install_static/initialize_from_primary_module.h" |
| 38 #include "chrome/install_static/install_details.h" | |
| 39 #include "components/browser_watcher/endsession_watcher_window_win.h" | 38 #include "components/browser_watcher/endsession_watcher_window_win.h" |
| 40 #include "components/browser_watcher/exit_code_watcher_win.h" | 39 #include "components/browser_watcher/exit_code_watcher_win.h" |
| 41 #include "components/browser_watcher/window_hang_monitor_win.h" | 40 #include "components/browser_watcher/window_hang_monitor_win.h" |
| 42 | 41 |
| 43 namespace { | 42 namespace { |
| 44 | 43 |
| 45 // Use the same log facility as Chrome for convenience. | 44 // Use the same log facility as Chrome for convenience. |
| 46 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} | 45 // {7FE69228-633E-4f06-80C1-527FEA23E3A7} |
| 47 const GUID kChromeWatcherTraceProviderName = { | 46 const GUID kChromeWatcherTraceProviderName = { |
| 48 0x7fe69228, 0x633e, 0x4f06, | 47 0x7fe69228, 0x633e, 0x4f06, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 180 |
| 182 } // namespace | 181 } // namespace |
| 183 | 182 |
| 184 // The main entry point to the watcher, declared as extern "C" to avoid name | 183 // The main entry point to the watcher, declared as extern "C" to avoid name |
| 185 // mangling. | 184 // mangling. |
| 186 extern "C" int WatcherMain(const base::char16* registry_path, | 185 extern "C" int WatcherMain(const base::char16* registry_path, |
| 187 HANDLE process_handle, | 186 HANDLE process_handle, |
| 188 DWORD main_thread_id, | 187 DWORD main_thread_id, |
| 189 HANDLE on_initialized_event_handle, | 188 HANDLE on_initialized_event_handle, |
| 190 const base::char16* browser_data_directory) { | 189 const base::char16* browser_data_directory) { |
| 191 install_static::InstallDetails::InitializeFromPrimaryModule( | 190 install_static::InitializeFromPrimaryModule(); |
| 192 chrome::kChromeElfDllName); | |
| 193 base::Process process(process_handle); | 191 base::Process process(process_handle); |
| 194 base::win::ScopedHandle on_initialized_event(on_initialized_event_handle); | 192 base::win::ScopedHandle on_initialized_event(on_initialized_event_handle); |
| 195 | 193 |
| 196 // The exit manager is in charge of calling the dtors of singletons. | 194 // The exit manager is in charge of calling the dtors of singletons. |
| 197 base::AtExitManager exit_manager; | 195 base::AtExitManager exit_manager; |
| 198 // Initialize the commandline singleton from the environment. | 196 // Initialize the commandline singleton from the environment. |
| 199 base::CommandLine::Init(0, nullptr); | 197 base::CommandLine::Init(0, nullptr); |
| 200 | 198 |
| 201 logging::LogEventProvider::Initialize(kChromeWatcherTraceProviderName); | 199 logging::LogEventProvider::Initialize(kChromeWatcherTraceProviderName); |
| 202 | 200 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 219 | 217 |
| 220 // Wind logging down. | 218 // Wind logging down. |
| 221 logging::LogEventProvider::Uninitialize(); | 219 logging::LogEventProvider::Uninitialize(); |
| 222 | 220 |
| 223 return 0; | 221 return 0; |
| 224 } | 222 } |
| 225 | 223 |
| 226 static_assert( | 224 static_assert( |
| 227 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, | 225 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, |
| 228 "WatcherMain() has wrong type"); | 226 "WatcherMain() has wrong type"); |
| OLD | NEW |