| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/child_process.h" | 5 #include "chrome/common/child_process.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <signal.h> // For SigUSR1Handler below. | 8 #include <signal.h> // For SigUSR1Handler below. |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include "app/l10n_util.h" | |
| 12 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 13 #include "base/process_util.h" | 12 #include "base/process_util.h" |
| 14 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 15 #include "base/thread.h" | 14 #include "base/thread.h" |
| 16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/common/child_thread.h" | 16 #include "chrome/common/child_thread.h" |
| 18 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
| 19 | 18 |
| 20 #if defined(OS_POSIX) | 19 #if defined(OS_POSIX) |
| 21 static void SigUSR1Handler(int signal) { } | 20 static void SigUSR1Handler(int signal) { } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 main_thread_->OnProcessFinalRelease(); | 66 main_thread_->OnProcessFinalRelease(); |
| 68 } | 67 } |
| 69 | 68 |
| 70 base::WaitableEvent* ChildProcess::GetShutDownEvent() { | 69 base::WaitableEvent* ChildProcess::GetShutDownEvent() { |
| 71 DCHECK(child_process_); | 70 DCHECK(child_process_); |
| 72 return &child_process_->shutdown_event_; | 71 return &child_process_->shutdown_event_; |
| 73 } | 72 } |
| 74 | 73 |
| 75 void ChildProcess::WaitForDebugger(const std::wstring& label) { | 74 void ChildProcess::WaitForDebugger(const std::wstring& label) { |
| 76 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
| 77 std::wstring title = l10n_util::GetString(IDS_PRODUCT_NAME); | 76 #if defined(GOOGLE_CHROME_BUILD) |
| 78 std::wstring message = label; | 77 std::wstring title = L"Google Chrome"; |
| 79 message += L" starting with pid: "; | 78 #else // CHROMIUM_BUILD |
| 80 message += UTF8ToWide(base::IntToString(base::GetCurrentProcId())); | 79 std::wstring title = L"Chromium"; |
| 81 title += L" "; | 80 #endif // CHROMIUM_BUILD |
| 82 title += label; // makes attaching to process easier | 81 std::wstring message = label; |
| 83 ::MessageBox(NULL, message.c_str(), title.c_str(), | 82 message += L" starting with pid: "; |
| 84 MB_OK | MB_SETFOREGROUND); | 83 message += UTF8ToWide(base::IntToString(base::GetCurrentProcId())); |
| 84 title += L" "; |
| 85 title += label; // makes attaching to process easier |
| 86 ::MessageBox(NULL, message.c_str(), title.c_str(), |
| 87 MB_OK | MB_SETFOREGROUND); |
| 85 #elif defined(OS_POSIX) | 88 #elif defined(OS_POSIX) |
| 86 // TODO(playmobil): In the long term, overriding this flag doesn't seem | 89 // TODO(playmobil): In the long term, overriding this flag doesn't seem |
| 87 // right, either use our own flag or open a dialog we can use. | 90 // right, either use our own flag or open a dialog we can use. |
| 88 // This is just to ease debugging in the interim. | 91 // This is just to ease debugging in the interim. |
| 89 LOG(WARNING) << label | 92 LOG(WARNING) << label |
| 90 << " (" | 93 << " (" |
| 91 << getpid() | 94 << getpid() |
| 92 << ") paused waiting for debugger to attach @ pid"; | 95 << ") paused waiting for debugger to attach @ pid"; |
| 93 // Install a signal handler so that pause can be woken. | 96 // Install a signal handler so that pause can be woken. |
| 94 struct sigaction sa; | 97 struct sigaction sa; |
| 95 memset(&sa, 0, sizeof(sa)); | 98 memset(&sa, 0, sizeof(sa)); |
| 96 sa.sa_handler = SigUSR1Handler; | 99 sa.sa_handler = SigUSR1Handler; |
| 97 sigaction(SIGUSR1, &sa, NULL); | 100 sigaction(SIGUSR1, &sa, NULL); |
| 98 | 101 |
| 99 pause(); | 102 pause(); |
| 100 #endif // defined(OS_POSIX) | 103 #endif // defined(OS_POSIX) |
| 101 } | 104 } |
| OLD | NEW |