OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/browser_watcher/window_hang_monitor_win.h" | 5 #include "components/browser_watcher/window_hang_monitor_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 | 355 |
356 base::CommandLine command_line = | 356 base::CommandLine command_line = |
357 base::GetMultiProcessTestChildBaseCommandLine(); | 357 base::GetMultiProcessTestChildBaseCommandLine(); |
358 command_line.AppendSwitchASCII(switches::kTestChildProcess, | 358 command_line.AppendSwitchASCII(switches::kTestChildProcess, |
359 "MonitoredProcess"); | 359 "MonitoredProcess"); |
360 | 360 |
361 AppendSwitchHandle(&command_line, kChildReadPipeSwitch, child_read_pipe); | 361 AppendSwitchHandle(&command_line, kChildReadPipeSwitch, child_read_pipe); |
362 AppendSwitchHandle(&command_line, kChildWritePipeSwitch, child_write_pipe); | 362 AppendSwitchHandle(&command_line, kChildWritePipeSwitch, child_write_pipe); |
363 | 363 |
364 base::LaunchOptions options = {}; | 364 base::LaunchOptions options = {}; |
365 options.inherit_handles = true; | 365 options.inherit_mode = base::LaunchOptions::Inherit::kAll; |
jschuh
2017/07/24 19:41:27
Leave a TODO here.
| |
366 monitored_process_ = base::LaunchProcess(command_line, options); | 366 monitored_process_ = base::LaunchProcess(command_line, options); |
367 if (!monitored_process_.IsValid()) | 367 if (!monitored_process_.IsValid()) |
368 return false; | 368 return false; |
369 | 369 |
370 return WaitForSignal(IPC_SIGNAL_READY); | 370 return WaitForSignal(IPC_SIGNAL_READY); |
371 } | 371 } |
372 | 372 |
373 void StartHangMonitor() { | 373 void StartHangMonitor() { |
374 monitor_thread_.Start(monitored_process_.Duplicate()); | 374 monitor_thread_.Start(monitored_process_.Duplicate()); |
375 } | 375 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 | 469 |
470 ASSERT_TRUE(SendSignal(IPC_SIGNAL_HANG_MESSAGE_WINDOW)); | 470 ASSERT_TRUE(SendSignal(IPC_SIGNAL_HANG_MESSAGE_WINDOW)); |
471 | 471 |
472 EXPECT_EQ(WindowHangMonitor::WINDOW_HUNG, | 472 EXPECT_EQ(WindowHangMonitor::WINDOW_HUNG, |
473 monitor_thread().WaitForEvent()); | 473 monitor_thread().WaitForEvent()); |
474 | 474 |
475 ASSERT_TRUE(SendSignal(IPC_SIGNAL_TERMINATE_PROCESS)); | 475 ASSERT_TRUE(SendSignal(IPC_SIGNAL_TERMINATE_PROCESS)); |
476 } | 476 } |
477 | 477 |
478 } // namespace browser_watcher | 478 } // namespace browser_watcher |
OLD | NEW |