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 10 matching lines...) Expand all Loading... |
21 #include "base/process/process.h" | 21 #include "base/process/process.h" |
22 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
23 #include "base/sequenced_task_runner.h" | 23 #include "base/sequenced_task_runner.h" |
24 #include "base/single_thread_task_runner.h" | 24 #include "base/single_thread_task_runner.h" |
25 #include "base/strings/string16.h" | 25 #include "base/strings/string16.h" |
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/thread_task_runner_handle.h" | 30 #include "base/thread_task_runner_handle.h" |
| 31 #include "base/threading/platform_thread.h" |
31 #include "base/threading/thread.h" | 32 #include "base/threading/thread.h" |
32 #include "base/time/time.h" | 33 #include "base/time/time.h" |
33 #include "base/win/scoped_handle.h" | 34 #include "base/win/scoped_handle.h" |
34 #include "base/win/win_util.h" | 35 #include "base/win/win_util.h" |
35 | 36 |
36 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" | 37 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" |
37 #include "chrome/chrome_watcher/kasko_util.h" | 38 #include "chrome/chrome_watcher/kasko_util.h" |
38 #include "chrome/installer/util/util_constants.h" | 39 #include "chrome/installer/util/util_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" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // Only activate hang reports for the canary channel. | 224 // Only activate hang reports for the canary channel. |
224 if (launched_kasko && | 225 if (launched_kasko && |
225 base::StringPiece16(channel_name) == installer::kChromeChannelCanary) { | 226 base::StringPiece16(channel_name) == installer::kChromeChannelCanary) { |
226 on_hung_callback = base::Bind(&DumpHungProcess, main_thread_id, | 227 on_hung_callback = base::Bind(&DumpHungProcess, main_thread_id, |
227 channel_name, L"hung-process"); | 228 channel_name, L"hung-process"); |
228 } | 229 } |
229 #endif // BUILDFLAG(ENABLE_KASKO_HANG_REPORTS) | 230 #endif // BUILDFLAG(ENABLE_KASKO_HANG_REPORTS) |
230 #endif // BUILDFLAG(ENABLE_KASKO) | 231 #endif // BUILDFLAG(ENABLE_KASKO) |
231 | 232 |
232 // Run a UI message loop on the main thread. | 233 // Run a UI message loop on the main thread. |
| 234 base::PlatformThread::SetName("WatcherMainThread"); |
233 base::MessageLoop msg_loop(base::MessageLoop::TYPE_UI); | 235 base::MessageLoop msg_loop(base::MessageLoop::TYPE_UI); |
234 msg_loop.set_thread_name("WatcherMainThread"); | |
235 | 236 |
236 base::RunLoop run_loop; | 237 base::RunLoop run_loop; |
237 BrowserMonitor monitor(registry_path, &run_loop); | 238 BrowserMonitor monitor(registry_path, &run_loop); |
238 if (!monitor.StartWatching(process.Duplicate(), | 239 if (!monitor.StartWatching(process.Duplicate(), |
239 std::move(on_initialized_event))) { | 240 std::move(on_initialized_event))) { |
240 return 1; | 241 return 1; |
241 } | 242 } |
242 | 243 |
243 { | 244 { |
244 // Scoped to force |hang_monitor| destruction before Kasko is shut down. | 245 // Scoped to force |hang_monitor| destruction before Kasko is shut down. |
(...skipping 13 matching lines...) Expand all Loading... |
258 | 259 |
259 // Wind logging down. | 260 // Wind logging down. |
260 logging::LogEventProvider::Uninitialize(); | 261 logging::LogEventProvider::Uninitialize(); |
261 | 262 |
262 return 0; | 263 return 0; |
263 } | 264 } |
264 | 265 |
265 static_assert( | 266 static_assert( |
266 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, | 267 std::is_same<decltype(&WatcherMain), ChromeWatcherMainFunction>::value, |
267 "WatcherMain() has wrong type"); | 268 "WatcherMain() has wrong type"); |
OLD | NEW |