diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 01:43:56 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 01:43:56 +0000 |
commit | cd60f084650684bb407f237bde2f7156b9f75aca (patch) | |
tree | 8dfe29aeefde03908ff1ab894ea220ed89812b4b /chrome/common/child_process.cc | |
parent | 2858d5406a254a1dba769b112ca86951f0ec9361 (diff) | |
download | chromium_src-cd60f084650684bb407f237bde2f7156b9f75aca.zip chromium_src-cd60f084650684bb407f237bde2f7156b9f75aca.tar.gz chromium_src-cd60f084650684bb407f237bde2f7156b9f75aca.tar.bz2 |
Added support for --worker-startup-dialog command line flag.
Added ChildProcess::WaitForDebugger() utility routine, and changed the various
processes to use it.
Review URL: http://codereview.chromium.org/370006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process.cc')
-rw-r--r-- | chrome/common/child_process.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/chrome/common/child_process.cc b/chrome/common/child_process.cc index 34ea7a2..328ca14 100644 --- a/chrome/common/child_process.cc +++ b/chrome/common/child_process.cc @@ -4,8 +4,18 @@ #include "chrome/common/child_process.h" +#include "app/l10n_util.h" #include "base/message_loop.h" +#include "base/process_util.h" +#include "base/string_util.h" #include "chrome/common/child_thread.h" +#include "grit/chromium_strings.h" + +#if defined(OS_POSIX) +#include <signal.h> + +static void SigUSR1Handler(int signal) { } +#endif ChildProcess* ChildProcess::child_process_; @@ -57,3 +67,31 @@ base::WaitableEvent* ChildProcess::GetShutDownEvent() { DCHECK(child_process_); return &child_process_->shutdown_event_; } + +void ChildProcess::WaitForDebugger(const std::wstring& label) { +#if defined(OS_WIN) + std::wstring title = l10n_util::GetString(IDS_PRODUCT_NAME); + std::wstring message = label; + message += L" starting with pid: "; + message += IntToWString(base::GetCurrentProcId()); + title += L" "; + title += label; // makes attaching to process easier + ::MessageBox(NULL, message.c_str(), title.c_str(), + MB_OK | MB_SETFOREGROUND); +#elif defined(OS_POSIX) + // TODO(playmobil): In the long term, overriding this flag doesn't seem + // right, either use our own flag or open a dialog we can use. + // This is just to ease debugging in the interim. + LOG(WARNING) << label + << " (" + << getpid() + << ") paused waiting for debugger to attach @ pid"; + // Install a signal handler so that pause can be woken. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SigUSR1Handler; + sigaction(SIGUSR1, &sa, NULL); + + pause(); +#endif // defined(OS_POSIX) +} |