| 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 "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "content/browser/startup_task_runner.h" | 42 #include "content/browser/startup_task_runner.h" |
| 43 #include "content/browser/time_zone_monitor.h" | 43 #include "content/browser/time_zone_monitor.h" |
| 44 #include "content/browser/webui/content_web_ui_controller_factory.h" | 44 #include "content/browser/webui/content_web_ui_controller_factory.h" |
| 45 #include "content/browser/webui/url_data_manager.h" | 45 #include "content/browser/webui/url_data_manager.h" |
| 46 #include "content/common/content_switches_internal.h" | 46 #include "content/common/content_switches_internal.h" |
| 47 #include "content/common/host_discardable_shared_memory_manager.h" | 47 #include "content/common/host_discardable_shared_memory_manager.h" |
| 48 #include "content/common/host_shared_bitmap_manager.h" | 48 #include "content/common/host_shared_bitmap_manager.h" |
| 49 #include "content/public/browser/browser_main_parts.h" | 49 #include "content/public/browser/browser_main_parts.h" |
| 50 #include "content/public/browser/browser_shutdown.h" | 50 #include "content/public/browser/browser_shutdown.h" |
| 51 #include "content/public/browser/content_browser_client.h" | 51 #include "content/public/browser/content_browser_client.h" |
| 52 #include "content/public/browser/mojo_shell_context.h" |
| 52 #include "content/public/browser/render_process_host.h" | 53 #include "content/public/browser/render_process_host.h" |
| 53 #include "content/public/browser/tracing_controller.h" | 54 #include "content/public/browser/tracing_controller.h" |
| 54 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
| 55 #include "content/public/common/main_function_params.h" | 56 #include "content/public/common/main_function_params.h" |
| 56 #include "content/public/common/result_codes.h" | 57 #include "content/public/common/result_codes.h" |
| 57 #include "crypto/nss_util.h" | 58 #include "crypto/nss_util.h" |
| 58 #include "device/battery/battery_status_service.h" | 59 #include "device/battery/battery_status_service.h" |
| 59 #include "media/audio/audio_manager.h" | 60 #include "media/audio/audio_manager.h" |
| 60 #include "media/base/media.h" | 61 #include "media/base/media.h" |
| 61 #include "media/base/user_input_monitor.h" | 62 #include "media/base/user_input_monitor.h" |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); | 840 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); |
| 840 | 841 |
| 841 // Teardown may start in PostMainMessageLoopRun, and during teardown we | 842 // Teardown may start in PostMainMessageLoopRun, and during teardown we |
| 842 // need to be able to perform IO. | 843 // need to be able to perform IO. |
| 843 base::ThreadRestrictions::SetIOAllowed(true); | 844 base::ThreadRestrictions::SetIOAllowed(true); |
| 844 BrowserThread::PostTask( | 845 BrowserThread::PostTask( |
| 845 BrowserThread::IO, FROM_HERE, | 846 BrowserThread::IO, FROM_HERE, |
| 846 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 847 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
| 847 true)); | 848 true)); |
| 848 | 849 |
| 850 mojo_shell_context_.reset(); |
| 851 |
| 849 #if !defined(OS_IOS) | 852 #if !defined(OS_IOS) |
| 850 if (RenderProcessHost::run_renderer_in_process()) | 853 if (RenderProcessHost::run_renderer_in_process()) |
| 851 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 854 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
| 852 #endif | 855 #endif |
| 853 | 856 |
| 854 if (parts_) { | 857 if (parts_) { |
| 855 TRACE_EVENT0("shutdown", | 858 TRACE_EVENT0("shutdown", |
| 856 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 859 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
| 857 parts_->PostMainMessageLoopRun(); | 860 parts_->PostMainMessageLoopRun(); |
| 858 } | 861 } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 SystemHotkeyHelperMac::GetInstance()->DeferredLoadSystemHotkeys(); | 1200 SystemHotkeyHelperMac::GetInstance()->DeferredLoadSystemHotkeys(); |
| 1198 if (ShouldEnableBootstrapSandbox()) { | 1201 if (ShouldEnableBootstrapSandbox()) { |
| 1199 TRACE_EVENT0("startup", | 1202 TRACE_EVENT0("startup", |
| 1200 "BrowserMainLoop::BrowserThreadsStarted:BootstrapSandbox"); | 1203 "BrowserMainLoop::BrowserThreadsStarted:BootstrapSandbox"); |
| 1201 CHECK(GetBootstrapSandbox()); | 1204 CHECK(GetBootstrapSandbox()); |
| 1202 } | 1205 } |
| 1203 #endif // defined(OS_MACOSX) | 1206 #endif // defined(OS_MACOSX) |
| 1204 | 1207 |
| 1205 #endif // !defined(OS_IOS) | 1208 #endif // !defined(OS_IOS) |
| 1206 | 1209 |
| 1210 mojo_shell_context_ = MojoShellContext::Create(); |
| 1211 GetContentClient()->browser()->ConfigureMojoShell(mojo_shell_context_.get()); |
| 1212 |
| 1207 return result_code_; | 1213 return result_code_; |
| 1208 } | 1214 } |
| 1209 | 1215 |
| 1210 bool BrowserMainLoop::UsingInProcessGpu() const { | 1216 bool BrowserMainLoop::UsingInProcessGpu() const { |
| 1211 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || | 1217 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || |
| 1212 parsed_command_line_.HasSwitch(switches::kInProcessGPU); | 1218 parsed_command_line_.HasSwitch(switches::kInProcessGPU); |
| 1213 } | 1219 } |
| 1214 | 1220 |
| 1215 bool BrowserMainLoop::InitializeToolkit() { | 1221 bool BrowserMainLoop::InitializeToolkit() { |
| 1216 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1222 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 | 1316 |
| 1311 void BrowserMainLoop::EndStartupTracing() { | 1317 void BrowserMainLoop::EndStartupTracing() { |
| 1312 is_tracing_startup_ = false; | 1318 is_tracing_startup_ = false; |
| 1313 TracingController::GetInstance()->DisableRecording( | 1319 TracingController::GetInstance()->DisableRecording( |
| 1314 TracingController::CreateFileSink( | 1320 TracingController::CreateFileSink( |
| 1315 startup_trace_file_, | 1321 startup_trace_file_, |
| 1316 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1322 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1317 } | 1323 } |
| 1318 | 1324 |
| 1319 } // namespace content | 1325 } // namespace content |
| OLD | NEW |