Chromium Code Reviews| Index: content/renderer/renderer_main.cc |
| diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc |
| index 306dee9aaf0ea6a511c53ae66884e431dc7abb29..6d8d2001871a7a3ccc4308a2a0d976f48c1fa577 100644 |
| --- a/content/renderer/renderer_main.cc |
| +++ b/content/renderer/renderer_main.cc |
| @@ -126,6 +126,25 @@ class RendererMessageLoopObserver : public MessageLoop::TaskObserver { |
| DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver); |
| }; |
| +#if defined(RENDERER_SIGTERM_HANDLER) |
| +static void SigtermHandler(int signum) |
| +{ |
|
Evan Martin
2012/03/26 17:17:25
curly should be on same line of function decl (see
|
| + LOG(INFO) << "SIGTERM caught by the renderer process. Calling exit()."; |
|
Evan Martin
2012/03/26 17:17:25
I think LOG() probably does a bunch of stuff that
|
| + exit(signum); |
| +} |
| + |
| +static void AddSigtermHandler() |
| +{ |
| + struct sigaction termAction; |
|
Evan Martin
2012/03/26 17:17:25
variable names should be like term_action
|
| + termAction.sa_handler = SigtermHandler; |
| + sigfillset(&termAction.sa_mask); |
| + termAction.sa_flags = 0; |
| + LOG(INFO) << "Installing SIGTERM handler to the renderer process."; |
| + sigaction(SIGTERM, &termAction, NULL); |
| + LOG(INFO) << "Added SIGTERM handler to the renderer process."; |
|
Evan Martin
2012/03/26 17:17:25
Rather than this, perhaps you should just check th
|
| +} |
| +#endif |
| + |
| // mainline routine for running as the Renderer process |
| int RendererMain(const content::MainFunctionParams& parameters) { |
| TRACE_EVENT_BEGIN_ETW("RendererMain", 0, ""); |
| @@ -232,6 +251,10 @@ int RendererMain(const content::MainFunctionParams& parameters) { |
| startup_timer.Stop(); // End of Startup Time Measurement. |
| +#if defined(RENDERER_SIGTERM_HANDLER) |
| + AddSigtermHandler(); |
| +#endif |
| + |
| if (run_loop) { |
| #if defined(OS_MACOSX) |
| if (pool) |