OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/base_switches.h" | 5 #include "base/base_switches.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/debug/debugger.h" | 7 #include "base/debug/debugger.h" |
8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
9 #include "base/debug/stack_trace.h" | |
10 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
11 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
12 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
14 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
15 #include "base/pending_task.h" | 14 #include "base/pending_task.h" |
16 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
17 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
18 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
19 #include "base/timer/hi_res_timer_manager.h" | 18 #include "base/timer/hi_res_timer_manager.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 176 |
178 { | 177 { |
179 #if defined(OS_WIN) || defined(OS_MACOSX) | 178 #if defined(OS_WIN) || defined(OS_MACOSX) |
180 // TODO(markus): Check if it is OK to unconditionally move this | 179 // TODO(markus): Check if it is OK to unconditionally move this |
181 // instruction down. | 180 // instruction down. |
182 RenderProcessImpl render_process; | 181 RenderProcessImpl render_process; |
183 RenderThreadImpl::Create(main_message_loop.Pass(), | 182 RenderThreadImpl::Create(main_message_loop.Pass(), |
184 renderer_scheduler.Pass()); | 183 renderer_scheduler.Pass()); |
185 #endif | 184 #endif |
186 bool run_loop = true; | 185 bool run_loop = true; |
187 if (!no_sandbox) { | 186 if (!no_sandbox) |
188 run_loop = platform.EnableSandbox(); | 187 run_loop = platform.EnableSandbox(); |
189 } else { | |
190 LOG(ERROR) << "Running without renderer sandbox"; | |
191 #if !defined(NDEBUG) || (defined(CFI_ENFORCEMENT) && !defined(OFFICIAL_BUILD)) | |
192 // For convenience, we print the stack traces for crashes. When sandbox | |
193 // is enabled, the in-process stack dumping is enabled as part of the | |
194 // EnableSandbox() call. | |
195 base::debug::EnableInProcessStackDumping(); | |
196 #endif | |
197 } | |
198 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 188 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
199 RenderProcessImpl render_process; | 189 RenderProcessImpl render_process; |
200 RenderThreadImpl::Create(main_message_loop.Pass(), | 190 RenderThreadImpl::Create(main_message_loop.Pass(), |
201 renderer_scheduler.Pass()); | 191 renderer_scheduler.Pass()); |
202 #endif | 192 #endif |
203 base::HighResolutionTimerManager hi_res_timer_manager; | 193 base::HighResolutionTimerManager hi_res_timer_manager; |
204 | 194 |
205 if (run_loop) { | 195 if (run_loop) { |
206 #if defined(OS_MACOSX) | 196 #if defined(OS_MACOSX) |
207 if (pool) | 197 if (pool) |
208 pool->Recycle(); | 198 pool->Recycle(); |
209 #endif | 199 #endif |
210 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 200 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
211 base::MessageLoop::current()->Run(); | 201 base::MessageLoop::current()->Run(); |
212 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 202 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
213 } | 203 } |
214 #if defined(LEAK_SANITIZER) | 204 #if defined(LEAK_SANITIZER) |
215 // Run leak detection before RenderProcessImpl goes out of scope. This helps | 205 // Run leak detection before RenderProcessImpl goes out of scope. This helps |
216 // ignore shutdown-only leaks. | 206 // ignore shutdown-only leaks. |
217 __lsan_do_leak_check(); | 207 __lsan_do_leak_check(); |
218 #endif | 208 #endif |
219 } | 209 } |
220 platform.PlatformUninitialize(); | 210 platform.PlatformUninitialize(); |
221 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 211 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
222 return 0; | 212 return 0; |
223 } | 213 } |
224 | 214 |
225 } // namespace content | 215 } // namespace content |
OLD | NEW |