| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "app/resource_bundle.h" | 6 #include "app/resource_bundle.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/field_trial.h" | 8 #include "base/field_trial.h" |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/platform_thread.h" | 12 #include "base/platform_thread.h" |
| 13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 14 #include "base/scoped_nsautorelease_pool.h" | 14 #include "base/scoped_nsautorelease_pool.h" |
| 15 #include "base/stats_counters.h" | 15 #include "base/stats_counters.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "base/system_monitor.h" | 17 #include "base/system_monitor.h" |
| 18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 19 #include "chrome/common/chrome_counters.h" | 19 #include "chrome/common/chrome_counters.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/logging_chrome.h" | 21 #include "chrome/common/logging_chrome.h" |
| 22 #include "chrome/common/main_function_params.h" | 22 #include "chrome/common/main_function_params.h" |
| 23 #include "chrome/renderer/renderer_main_platform_delegate.h" | 23 #include "chrome/renderer/renderer_main_platform_delegate.h" |
| 24 #include "chrome/renderer/render_process.h" | 24 #include "chrome/renderer/render_process.h" |
| 25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 27 | 27 |
| 28 #if defined(OS_LINUX) |
| 29 #include "chrome/app/breakpad_linux.h" |
| 30 #endif |
| 31 |
| 28 // This function provides some ways to test crash and assertion handling | 32 // This function provides some ways to test crash and assertion handling |
| 29 // behavior of the renderer. | 33 // behavior of the renderer. |
| 30 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { | 34 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { |
| 31 // This parameter causes an assertion. | 35 // This parameter causes an assertion. |
| 32 if (command_line.HasSwitch(switches::kRendererAssertTest)) { | 36 if (command_line.HasSwitch(switches::kRendererAssertTest)) { |
| 33 DCHECK(false); | 37 DCHECK(false); |
| 34 } | 38 } |
| 35 | 39 |
| 36 // This parameter causes a null pointer crash (crash reporter trigger). | 40 // This parameter causes a null pointer crash (crash reporter trigger). |
| 37 if (command_line.HasSwitch(switches::kRendererCrashTest)) { | 41 if (command_line.HasSwitch(switches::kRendererCrashTest)) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 57 pause(); | 61 pause(); |
| 58 #endif // defined(OS_MACOSX) | 62 #endif // defined(OS_MACOSX) |
| 59 } | 63 } |
| 60 } | 64 } |
| 61 | 65 |
| 62 // mainline routine for running as the Renderer process | 66 // mainline routine for running as the Renderer process |
| 63 int RendererMain(const MainFunctionParams& parameters) { | 67 int RendererMain(const MainFunctionParams& parameters) { |
| 64 const CommandLine& parsed_command_line = parameters.command_line_; | 68 const CommandLine& parsed_command_line = parameters.command_line_; |
| 65 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | 69 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; |
| 66 | 70 |
| 71 #if defined(OS_LINUX) |
| 72 // Needs to be called after we have chrome::DIR_USER_DATA. |
| 73 InitCrashReporter(); |
| 74 #endif |
| 75 |
| 67 // This function allows pausing execution using the --renderer-startup-dialog | 76 // This function allows pausing execution using the --renderer-startup-dialog |
| 68 // flag allowing us to attach a debugger. | 77 // flag allowing us to attach a debugger. |
| 69 // Do not move this function down since that would mean we can't easily debug | 78 // Do not move this function down since that would mean we can't easily debug |
| 70 // whatever occurs before it. | 79 // whatever occurs before it. |
| 71 HandleRendererErrorTestParameters(parsed_command_line); | 80 HandleRendererErrorTestParameters(parsed_command_line); |
| 72 | 81 |
| 73 RendererMainPlatformDelegate platform(parameters); | 82 RendererMainPlatformDelegate platform(parameters); |
| 74 | 83 |
| 75 StatsScope<StatsCounterTimer> | 84 StatsScope<StatsCounterTimer> |
| 76 startup_timer(chrome::Counters::renderer_main()); | 85 startup_timer(chrome::Counters::renderer_main()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 if (run_loop) { | 128 if (run_loop) { |
| 120 // Load the accelerator table from the browser executable and tell the | 129 // Load the accelerator table from the browser executable and tell the |
| 121 // message loop to use it when translating messages. | 130 // message loop to use it when translating messages. |
| 122 if (pool) pool->Recycle(); | 131 if (pool) pool->Recycle(); |
| 123 MessageLoop::current()->Run(); | 132 MessageLoop::current()->Run(); |
| 124 } | 133 } |
| 125 } | 134 } |
| 126 platform.PlatformUninitialize(); | 135 platform.PlatformUninitialize(); |
| 127 return 0; | 136 return 0; |
| 128 } | 137 } |
| OLD | NEW |