| 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 21 matching lines...) Expand all Loading... |
| 32 #include "content/browser/gamepad/gamepad_service.h" | 32 #include "content/browser/gamepad/gamepad_service.h" |
| 33 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 33 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 34 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 34 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 35 #include "content/browser/gpu/compositor_util.h" | 35 #include "content/browser/gpu/compositor_util.h" |
| 36 #include "content/browser/gpu/gpu_data_manager_impl.h" | 36 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 37 #include "content/browser/gpu/gpu_process_host.h" | 37 #include "content/browser/gpu/gpu_process_host.h" |
| 38 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 38 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 39 #include "content/browser/histogram_synchronizer.h" | 39 #include "content/browser/histogram_synchronizer.h" |
| 40 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 40 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 41 #include "content/browser/media/media_internals.h" | 41 #include "content/browser/media/media_internals.h" |
| 42 #include "content/browser/mojo/mojo_shell_context.h" |
| 42 #include "content/browser/net/browser_online_state_observer.h" | 43 #include "content/browser/net/browser_online_state_observer.h" |
| 43 #include "content/browser/renderer_host/media/media_stream_manager.h" | 44 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 44 #include "content/browser/speech/speech_recognition_manager_impl.h" | 45 #include "content/browser/speech/speech_recognition_manager_impl.h" |
| 45 #include "content/browser/startup_task_runner.h" | 46 #include "content/browser/startup_task_runner.h" |
| 46 #include "content/browser/time_zone_monitor.h" | 47 #include "content/browser/time_zone_monitor.h" |
| 47 #include "content/browser/webui/content_web_ui_controller_factory.h" | 48 #include "content/browser/webui/content_web_ui_controller_factory.h" |
| 48 #include "content/browser/webui/url_data_manager.h" | 49 #include "content/browser/webui/url_data_manager.h" |
| 49 #include "content/common/content_switches_internal.h" | 50 #include "content/common/content_switches_internal.h" |
| 50 #include "content/common/host_discardable_shared_memory_manager.h" | 51 #include "content/common/host_discardable_shared_memory_manager.h" |
| 51 #include "content/common/host_shared_bitmap_manager.h" | 52 #include "content/common/host_shared_bitmap_manager.h" |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); | 883 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); |
| 883 | 884 |
| 884 // Teardown may start in PostMainMessageLoopRun, and during teardown we | 885 // Teardown may start in PostMainMessageLoopRun, and during teardown we |
| 885 // need to be able to perform IO. | 886 // need to be able to perform IO. |
| 886 base::ThreadRestrictions::SetIOAllowed(true); | 887 base::ThreadRestrictions::SetIOAllowed(true); |
| 887 BrowserThread::PostTask( | 888 BrowserThread::PostTask( |
| 888 BrowserThread::IO, FROM_HERE, | 889 BrowserThread::IO, FROM_HERE, |
| 889 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 890 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
| 890 true)); | 891 true)); |
| 891 | 892 |
| 893 mojo_shell_context_.reset(); |
| 894 |
| 892 #if !defined(OS_IOS) | 895 #if !defined(OS_IOS) |
| 893 if (RenderProcessHost::run_renderer_in_process()) | 896 if (RenderProcessHost::run_renderer_in_process()) |
| 894 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 897 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
| 895 #endif | 898 #endif |
| 896 | 899 |
| 897 if (parts_) { | 900 if (parts_) { |
| 898 TRACE_EVENT0("shutdown", | 901 TRACE_EVENT0("shutdown", |
| 899 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 902 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
| 900 parts_->PostMainMessageLoopRun(); | 903 parts_->PostMainMessageLoopRun(); |
| 901 } | 904 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 SystemHotkeyHelperMac::GetInstance()->DeferredLoadSystemHotkeys(); | 1241 SystemHotkeyHelperMac::GetInstance()->DeferredLoadSystemHotkeys(); |
| 1239 if (ShouldEnableBootstrapSandbox()) { | 1242 if (ShouldEnableBootstrapSandbox()) { |
| 1240 TRACE_EVENT0("startup", | 1243 TRACE_EVENT0("startup", |
| 1241 "BrowserMainLoop::BrowserThreadsStarted:BootstrapSandbox"); | 1244 "BrowserMainLoop::BrowserThreadsStarted:BootstrapSandbox"); |
| 1242 CHECK(GetBootstrapSandbox()); | 1245 CHECK(GetBootstrapSandbox()); |
| 1243 } | 1246 } |
| 1244 #endif // defined(OS_MACOSX) | 1247 #endif // defined(OS_MACOSX) |
| 1245 | 1248 |
| 1246 #endif // !defined(OS_IOS) | 1249 #endif // !defined(OS_IOS) |
| 1247 | 1250 |
| 1251 mojo_shell_context_.reset(new MojoShellContext); |
| 1252 |
| 1248 return result_code_; | 1253 return result_code_; |
| 1249 } | 1254 } |
| 1250 | 1255 |
| 1251 bool BrowserMainLoop::UsingInProcessGpu() const { | 1256 bool BrowserMainLoop::UsingInProcessGpu() const { |
| 1252 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || | 1257 return parsed_command_line_.HasSwitch(switches::kSingleProcess) || |
| 1253 parsed_command_line_.HasSwitch(switches::kInProcessGPU); | 1258 parsed_command_line_.HasSwitch(switches::kInProcessGPU); |
| 1254 } | 1259 } |
| 1255 | 1260 |
| 1256 bool BrowserMainLoop::InitializeToolkit() { | 1261 bool BrowserMainLoop::InitializeToolkit() { |
| 1257 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); | 1262 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit"); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 DCHECK(is_tracing_startup_); | 1359 DCHECK(is_tracing_startup_); |
| 1355 | 1360 |
| 1356 is_tracing_startup_ = false; | 1361 is_tracing_startup_ = false; |
| 1357 TracingController::GetInstance()->DisableRecording( | 1362 TracingController::GetInstance()->DisableRecording( |
| 1358 TracingController::CreateFileSink( | 1363 TracingController::CreateFileSink( |
| 1359 startup_trace_file_, | 1364 startup_trace_file_, |
| 1360 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1365 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1361 } | 1366 } |
| 1362 | 1367 |
| 1363 } // namespace content | 1368 } // namespace content |
| OLD | NEW |