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 #if defined(OS_LINUX) | |
25 #include "chrome/renderer/render_crash_handler_linux.h" | |
26 #endif | |
27 #include "chrome/renderer/render_process.h" | 24 #include "chrome/renderer/render_process.h" |
28 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
29 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
30 | 27 |
31 // This function provides some ways to test crash and assertion handling | 28 // This function provides some ways to test crash and assertion handling |
32 // behavior of the renderer. | 29 // behavior of the renderer. |
33 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { | 30 static void HandleRendererErrorTestParameters(const CommandLine& command_line) { |
34 // This parameter causes an assertion. | 31 // This parameter causes an assertion. |
35 if (command_line.HasSwitch(switches::kRendererAssertTest)) { | 32 if (command_line.HasSwitch(switches::kRendererAssertTest)) { |
36 DCHECK(false); | 33 DCHECK(false); |
(...skipping 29 matching lines...) Expand all Loading... |
66 int RendererMain(const MainFunctionParams& parameters) { | 63 int RendererMain(const MainFunctionParams& parameters) { |
67 const CommandLine& parsed_command_line = parameters.command_line_; | 64 const CommandLine& parsed_command_line = parameters.command_line_; |
68 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; | 65 base::ScopedNSAutoreleasePool* pool = parameters.autorelease_pool_; |
69 | 66 |
70 // This function allows pausing execution using the --renderer-startup-dialog | 67 // This function allows pausing execution using the --renderer-startup-dialog |
71 // flag allowing us to attach a debugger. | 68 // flag allowing us to attach a debugger. |
72 // Do not move this function down since that would mean we can't easily debug | 69 // Do not move this function down since that would mean we can't easily debug |
73 // whatever occurs before it. | 70 // whatever occurs before it. |
74 HandleRendererErrorTestParameters(parsed_command_line); | 71 HandleRendererErrorTestParameters(parsed_command_line); |
75 | 72 |
76 #if defined(OS_LINUX) | |
77 EnableRendererCrashDumping(); | |
78 #endif | |
79 | |
80 RendererMainPlatformDelegate platform(parameters); | 73 RendererMainPlatformDelegate platform(parameters); |
81 | 74 |
82 StatsScope<StatsCounterTimer> | 75 StatsScope<StatsCounterTimer> |
83 startup_timer(chrome::Counters::renderer_main()); | 76 startup_timer(chrome::Counters::renderer_main()); |
84 | 77 |
85 // The main thread of the renderer services IO. | 78 // The main thread of the renderer services IO. |
86 MessageLoopForIO main_message_loop; | 79 MessageLoopForIO main_message_loop; |
87 std::wstring app_name = chrome::kBrowserAppName; | 80 std::wstring app_name = chrome::kBrowserAppName; |
88 PlatformThread::SetName(WideToASCII(app_name + L"_RendererMain").c_str()); | 81 PlatformThread::SetName(WideToASCII(app_name + L"_RendererMain").c_str()); |
89 | 82 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (run_loop) { | 119 if (run_loop) { |
127 // Load the accelerator table from the browser executable and tell the | 120 // Load the accelerator table from the browser executable and tell the |
128 // message loop to use it when translating messages. | 121 // message loop to use it when translating messages. |
129 if (pool) pool->Recycle(); | 122 if (pool) pool->Recycle(); |
130 MessageLoop::current()->Run(); | 123 MessageLoop::current()->Run(); |
131 } | 124 } |
132 } | 125 } |
133 platform.PlatformUninitialize(); | 126 platform.PlatformUninitialize(); |
134 return 0; | 127 return 0; |
135 } | 128 } |
OLD | NEW |