Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: base/process_util.h

Issue 6689014: GTTF: Detect browser crashes on shutdown in UI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file/namespace contains utility functions for enumerating, ending and 5 // This file/namespace contains utility functions for enumerating, ending and
6 // computing statistics of processes. 6 // computing statistics of processes.
7 7
8 #ifndef BASE_PROCESS_UTIL_H_ 8 #ifndef BASE_PROCESS_UTIL_H_
9 #define BASE_PROCESS_UTIL_H_ 9 #define BASE_PROCESS_UTIL_H_
10 #pragma once 10 #pragma once
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 BASE_API TerminationStatus GetTerminationStatus(ProcessHandle handle, 366 BASE_API TerminationStatus GetTerminationStatus(ProcessHandle handle,
367 int* exit_code); 367 int* exit_code);
368 368
369 // Waits for process to exit. On POSIX systems, if the process hasn't been 369 // Waits for process to exit. On POSIX systems, if the process hasn't been
370 // signaled then puts the exit code in |exit_code|; otherwise it's considered 370 // signaled then puts the exit code in |exit_code|; otherwise it's considered
371 // a failure. On Windows |exit_code| is always filled. Returns true on success, 371 // a failure. On Windows |exit_code| is always filled. Returns true on success,
372 // and closes |handle| in any case. 372 // and closes |handle| in any case.
373 BASE_API bool WaitForExitCode(ProcessHandle handle, int* exit_code); 373 BASE_API bool WaitForExitCode(ProcessHandle handle, int* exit_code);
374 374
375 // Waits for process to exit. If it did exit within |timeout_milliseconds|, 375 // Waits for process to exit. If it did exit within |timeout_milliseconds|,
376 // then puts the exit code in |exit_code|, closes |handle|, and returns true. 376 // then puts the exit code in |exit_code|, and returns true.
377 // In POSIX systems, if the process has been signaled then |exit_code| is set 377 // In POSIX systems, if the process has been signaled then |exit_code| is set
378 // to -1. Returns false on failure (the caller is then responsible for closing 378 // to -1. Returns false on failure (the caller is then responsible for closing
379 // |handle|). 379 // |handle|).
380 // The caller is always responsible for closing the |handle|.
380 BASE_API bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code, 381 BASE_API bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code,
381 int64 timeout_milliseconds); 382 int64 timeout_milliseconds);
382 383
383 // Wait for all the processes based on the named executable to exit. If filter 384 // Wait for all the processes based on the named executable to exit. If filter
384 // is non-null, then only processes selected by the filter are waited on. 385 // is non-null, then only processes selected by the filter are waited on.
385 // Returns after all processes have exited or wait_milliseconds have expired. 386 // Returns after all processes have exited or wait_milliseconds have expired.
386 // Returns true if all the processes exited, false otherwise. 387 // Returns true if all the processes exited, false otherwise.
387 BASE_API bool WaitForProcessesToExit( 388 BASE_API bool WaitForProcessesToExit(
388 const FilePath::StringType& executable_name, 389 const FilePath::StringType& executable_name,
389 int64 wait_milliseconds, 390 int64 wait_milliseconds,
390 const ProcessFilter* filter); 391 const ProcessFilter* filter);
391 392
392 // Wait for a single process to exit. Return true if it exited cleanly within 393 // Wait for a single process to exit. Return true if it exited cleanly within
393 // the given time limit. On Linux |handle| must be a child process, however 394 // the given time limit. On Linux |handle| must be a child process, however
394 // on Mac and Windows it can be any process. 395 // on Mac and Windows it can be any process.
395 BASE_API bool WaitForSingleProcess(ProcessHandle handle, 396 BASE_API bool WaitForSingleProcess(ProcessHandle handle,
396 int64 wait_milliseconds); 397 int64 wait_milliseconds);
397 398
398 // Returns true when |wait_milliseconds| have elapsed and the process
399 // is still running.
400 BASE_API bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds);
401
402 // Waits a certain amount of time (can be 0) for all the processes with a given 399 // Waits a certain amount of time (can be 0) for all the processes with a given
403 // executable name to exit, then kills off any of them that are still around. 400 // executable name to exit, then kills off any of them that are still around.
404 // If filter is non-null, then only processes selected by the filter are waited 401 // If filter is non-null, then only processes selected by the filter are waited
405 // on. Killed processes are ended with the given exit code. Returns false if 402 // on. Killed processes are ended with the given exit code. Returns false if
406 // any processes needed to be killed, true if they all exited cleanly within 403 // any processes needed to be killed, true if they all exited cleanly within
407 // the wait_milliseconds delay. 404 // the wait_milliseconds delay.
408 BASE_API bool CleanupProcesses(const FilePath::StringType& executable_name, 405 BASE_API bool CleanupProcesses(const FilePath::StringType& executable_name,
409 int64 wait_milliseconds, 406 int64 wait_milliseconds,
410 int exit_code, 407 int exit_code,
411 const ProcessFilter* filter); 408 const ProcessFilter* filter);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // instance running inside the parent. The parent's Breakpad instance should 673 // instance running inside the parent. The parent's Breakpad instance should
677 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler 674 // not handle the child's exceptions. Calling RestoreDefaultExceptionHandler
678 // in the child after forking will restore the standard exception handler. 675 // in the child after forking will restore the standard exception handler.
679 // See http://crbug.com/20371/ for more details. 676 // See http://crbug.com/20371/ for more details.
680 void RestoreDefaultExceptionHandler(); 677 void RestoreDefaultExceptionHandler();
681 #endif // defined(OS_MACOSX) 678 #endif // defined(OS_MACOSX)
682 679
683 } // namespace base 680 } // namespace base
684 681
685 #endif // BASE_PROCESS_UTIL_H_ 682 #endif // BASE_PROCESS_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/process_util_posix.cc » ('j') | chrome/test/interactive_ui/fast_shutdown_interactive_uitest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698