| 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" |
| 9 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
| 14 #include "base/pending_task.h" | 15 #include "base/pending_task.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 17 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
| 18 #include "base/timer/hi_res_timer_manager.h" | 19 #include "base/timer/hi_res_timer_manager.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 177 |
| 177 { | 178 { |
| 178 #if defined(OS_WIN) || defined(OS_MACOSX) | 179 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 179 // TODO(markus): Check if it is OK to unconditionally move this | 180 // TODO(markus): Check if it is OK to unconditionally move this |
| 180 // instruction down. | 181 // instruction down. |
| 181 RenderProcessImpl render_process; | 182 RenderProcessImpl render_process; |
| 182 RenderThreadImpl::Create(main_message_loop.Pass(), | 183 RenderThreadImpl::Create(main_message_loop.Pass(), |
| 183 renderer_scheduler.Pass()); | 184 renderer_scheduler.Pass()); |
| 184 #endif | 185 #endif |
| 185 bool run_loop = true; | 186 bool run_loop = true; |
| 186 if (!no_sandbox) | 187 if (!no_sandbox) { |
| 187 run_loop = platform.EnableSandbox(); | 188 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 } |
| 188 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 198 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 189 RenderProcessImpl render_process; | 199 RenderProcessImpl render_process; |
| 190 RenderThreadImpl::Create(main_message_loop.Pass(), | 200 RenderThreadImpl::Create(main_message_loop.Pass(), |
| 191 renderer_scheduler.Pass()); | 201 renderer_scheduler.Pass()); |
| 192 #endif | 202 #endif |
| 193 base::HighResolutionTimerManager hi_res_timer_manager; | 203 base::HighResolutionTimerManager hi_res_timer_manager; |
| 194 | 204 |
| 195 if (run_loop) { | 205 if (run_loop) { |
| 196 #if defined(OS_MACOSX) | 206 #if defined(OS_MACOSX) |
| 197 if (pool) | 207 if (pool) |
| 198 pool->Recycle(); | 208 pool->Recycle(); |
| 199 #endif | 209 #endif |
| 200 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 210 TRACE_EVENT_BEGIN_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
| 201 base::MessageLoop::current()->Run(); | 211 base::MessageLoop::current()->Run(); |
| 202 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); | 212 TRACE_EVENT_END_ETW("RendererMain.START_MSG_LOOP", 0, 0); |
| 203 } | 213 } |
| 204 #if defined(LEAK_SANITIZER) | 214 #if defined(LEAK_SANITIZER) |
| 205 // Run leak detection before RenderProcessImpl goes out of scope. This helps | 215 // Run leak detection before RenderProcessImpl goes out of scope. This helps |
| 206 // ignore shutdown-only leaks. | 216 // ignore shutdown-only leaks. |
| 207 __lsan_do_leak_check(); | 217 __lsan_do_leak_check(); |
| 208 #endif | 218 #endif |
| 209 } | 219 } |
| 210 platform.PlatformUninitialize(); | 220 platform.PlatformUninitialize(); |
| 211 TRACE_EVENT_END_ETW("RendererMain", 0, ""); | 221 TRACE_EVENT_END_ETW("RendererMain", 0, ""); |
| 212 return 0; | 222 return 0; |
| 213 } | 223 } |
| 214 | 224 |
| 215 } // namespace content | 225 } // namespace content |
| OLD | NEW |