| 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/memory/memory_pressure_monitor.h" | 10 #include "base/memory/memory_pressure_monitor.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "content/browser/speech/speech_recognition_manager_impl.h" | 44 #include "content/browser/speech/speech_recognition_manager_impl.h" |
| 45 #include "content/browser/startup_task_runner.h" | 45 #include "content/browser/startup_task_runner.h" |
| 46 #include "content/browser/time_zone_monitor.h" | 46 #include "content/browser/time_zone_monitor.h" |
| 47 #include "content/browser/webui/content_web_ui_controller_factory.h" | 47 #include "content/browser/webui/content_web_ui_controller_factory.h" |
| 48 #include "content/browser/webui/url_data_manager.h" | 48 #include "content/browser/webui/url_data_manager.h" |
| 49 #include "content/common/content_switches_internal.h" | 49 #include "content/common/content_switches_internal.h" |
| 50 #include "content/common/host_discardable_shared_memory_manager.h" | 50 #include "content/common/host_discardable_shared_memory_manager.h" |
| 51 #include "content/common/host_shared_bitmap_manager.h" | 51 #include "content/common/host_shared_bitmap_manager.h" |
| 52 #include "content/public/browser/browser_main_parts.h" | 52 #include "content/public/browser/browser_main_parts.h" |
| 53 #include "content/public/browser/content_browser_client.h" | 53 #include "content/public/browser/content_browser_client.h" |
| 54 #include "content/public/browser/mojo_shell_context.h" |
| 54 #include "content/public/browser/render_process_host.h" | 55 #include "content/public/browser/render_process_host.h" |
| 55 #include "content/public/browser/tracing_controller.h" | 56 #include "content/public/browser/tracing_controller.h" |
| 56 #include "content/public/common/content_switches.h" | 57 #include "content/public/common/content_switches.h" |
| 57 #include "content/public/common/main_function_params.h" | 58 #include "content/public/common/main_function_params.h" |
| 58 #include "content/public/common/result_codes.h" | 59 #include "content/public/common/result_codes.h" |
| 59 #include "crypto/nss_util.h" | 60 #include "crypto/nss_util.h" |
| 60 #include "device/battery/battery_status_service.h" | 61 #include "device/battery/battery_status_service.h" |
| 61 #include "media/audio/audio_manager.h" | 62 #include "media/audio/audio_manager.h" |
| 62 #include "media/base/media.h" | 63 #include "media/base/media.h" |
| 63 #include "media/base/user_input_monitor.h" | 64 #include "media/base/user_input_monitor.h" |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); | 861 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); |
| 861 | 862 |
| 862 // Teardown may start in PostMainMessageLoopRun, and during teardown we | 863 // Teardown may start in PostMainMessageLoopRun, and during teardown we |
| 863 // need to be able to perform IO. | 864 // need to be able to perform IO. |
| 864 base::ThreadRestrictions::SetIOAllowed(true); | 865 base::ThreadRestrictions::SetIOAllowed(true); |
| 865 BrowserThread::PostTask( | 866 BrowserThread::PostTask( |
| 866 BrowserThread::IO, FROM_HERE, | 867 BrowserThread::IO, FROM_HERE, |
| 867 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 868 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
| 868 true)); | 869 true)); |
| 869 | 870 |
| 871 mojo_shell_context_.reset(); |
| 872 |
| 870 #if !defined(OS_IOS) | 873 #if !defined(OS_IOS) |
| 871 if (RenderProcessHost::run_renderer_in_process()) | 874 if (RenderProcessHost::run_renderer_in_process()) |
| 872 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 875 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
| 873 #endif | 876 #endif |
| 874 | 877 |
| 875 if (parts_) { | 878 if (parts_) { |
| 876 TRACE_EVENT0("shutdown", | 879 TRACE_EVENT0("shutdown", |
| 877 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 880 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
| 878 parts_->PostMainMessageLoopRun(); | 881 parts_->PostMainMessageLoopRun(); |
| 879 } | 882 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 SystemHotkeyHelperMac::GetInstance()->DeferredLoadSystemHotkeys(); | 1219 SystemHotkeyHelperMac::GetInstance()->DeferredLoadSystemHotkeys(); |
| 1217 if (ShouldEnableBootstrapSandbox()) { | 1220 if (ShouldEnableBootstrapSandbox()) { |
| 1218 TRACE_EVENT0("startup", | 1221 TRACE_EVENT0("startup", |
| 1219 "BrowserMainLoop::BrowserThreadsStarted:BootstrapSandbox"); | 1222 "BrowserMainLoop::BrowserThreadsStarted:BootstrapSandbox"); |
| 1220 CHECK(GetBootstrapSandbox()); | 1223 CHECK(GetBootstrapSandbox()); |
| 1221 } | 1224 } |
| 1222 #endif // defined(OS_MACOSX) | 1225 #endif // defined(OS_MACOSX) |
| 1223 | 1226 |
| 1224 #endif // !defined(OS_IOS) | 1227 #endif // !defined(OS_IOS) |
| 1225 | 1228 |
| 1229 mojo_shell_context_ = MojoShellContext::Create(); |
| 1230 |
| 1226 return result_code_; | 1231 return result_code_; |
| 1227 } | 1232 } |
| 1228 | 1233 |
| 1229 bool BrowserMainLoop::UsingInProcessGpu() const { | 1234 bool BrowserMainLoop::UsingInProcessGpu() const { |
| 1230 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || | 1235 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || |
| 1231 parsed_command_line_.HasSwitch(switches::kInProcessGPU); | 1236 parsed_command_line_.HasSwitch(switches::kInProcessGPU); |
| 1232 } | 1237 } |
| 1233 | 1238 |
| 1234 bool BrowserMainLoop::InitializeToolkit() { | 1239 bool BrowserMainLoop::InitializeToolkit() { |
| 1235 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1240 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 | 1334 |
| 1330 void BrowserMainLoop::EndStartupTracing() { | 1335 void BrowserMainLoop::EndStartupTracing() { |
| 1331 is_tracing_startup_ = false; | 1336 is_tracing_startup_ = false; |
| 1332 TracingController::GetInstance()->DisableRecording( | 1337 TracingController::GetInstance()->DisableRecording( |
| 1333 TracingController::CreateFileSink( | 1338 TracingController::CreateFileSink( |
| 1334 startup_trace_file_, | 1339 startup_trace_file_, |
| 1335 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1340 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1336 } | 1341 } |
| 1337 | 1342 |
| 1338 } // namespace content | 1343 } // namespace content |
| OLD | NEW |