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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "content/browser/renderer_host/render_process_host_impl.h" | 56 #include "content/browser/renderer_host/render_process_host_impl.h" |
57 #include "content/browser/speech/speech_recognition_manager_impl.h" | 57 #include "content/browser/speech/speech_recognition_manager_impl.h" |
58 #include "content/browser/startup_task_runner.h" | 58 #include "content/browser/startup_task_runner.h" |
59 #include "content/browser/time_zone_monitor.h" | 59 #include "content/browser/time_zone_monitor.h" |
60 #include "content/browser/utility_process_host_impl.h" | 60 #include "content/browser/utility_process_host_impl.h" |
61 #include "content/browser/webui/content_web_ui_controller_factory.h" | 61 #include "content/browser/webui/content_web_ui_controller_factory.h" |
62 #include "content/browser/webui/url_data_manager.h" | 62 #include "content/browser/webui/url_data_manager.h" |
63 #include "content/common/content_switches_internal.h" | 63 #include "content/common/content_switches_internal.h" |
64 #include "content/common/host_discardable_shared_memory_manager.h" | 64 #include "content/common/host_discardable_shared_memory_manager.h" |
65 #include "content/common/host_shared_bitmap_manager.h" | 65 #include "content/common/host_shared_bitmap_manager.h" |
| 66 #include "content/common/mojo/mojo_shell_connection_impl.h" |
66 #include "content/public/browser/browser_main_parts.h" | 67 #include "content/public/browser/browser_main_parts.h" |
67 #include "content/public/browser/content_browser_client.h" | 68 #include "content/public/browser/content_browser_client.h" |
68 #include "content/public/browser/render_process_host.h" | 69 #include "content/public/browser/render_process_host.h" |
69 #include "content/public/browser/tracing_controller.h" | 70 #include "content/public/browser/tracing_controller.h" |
70 #include "content/public/common/content_switches.h" | 71 #include "content/public/common/content_switches.h" |
71 #include "content/public/common/main_function_params.h" | 72 #include "content/public/common/main_function_params.h" |
72 #include "content/public/common/result_codes.h" | 73 #include "content/public/common/result_codes.h" |
73 #include "device/battery/battery_status_service.h" | 74 #include "device/battery/battery_status_service.h" |
74 #include "ipc/mojo/scoped_ipc_support.h" | 75 #include "ipc/mojo/scoped_ipc_support.h" |
75 #include "media/audio/audio_manager.h" | 76 #include "media/audio/audio_manager.h" |
76 #include "media/base/media.h" | 77 #include "media/base/media.h" |
77 #include "media/base/user_input_monitor.h" | 78 #include "media/base/user_input_monitor.h" |
78 #include "media/midi/midi_manager.h" | 79 #include "media/midi/midi_manager.h" |
| 80 #include "mojo/shell/public/cpp/shell.h" |
79 #include "net/base/network_change_notifier.h" | 81 #include "net/base/network_change_notifier.h" |
80 #include "net/socket/client_socket_factory.h" | 82 #include "net/socket/client_socket_factory.h" |
81 #include "net/ssl/ssl_config_service.h" | 83 #include "net/ssl/ssl_config_service.h" |
82 #include "skia/ext/event_tracer_impl.h" | 84 #include "skia/ext/event_tracer_impl.h" |
83 #include "skia/ext/skia_memory_dump_provider.h" | 85 #include "skia/ext/skia_memory_dump_provider.h" |
84 #include "sql/sql_memory_dump_provider.h" | 86 #include "sql/sql_memory_dump_provider.h" |
85 #include "ui/base/clipboard/clipboard.h" | 87 #include "ui/base/clipboard/clipboard.h" |
86 | 88 |
87 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) | 89 #if defined(USE_AURA) || (defined(OS_MACOSX) && !defined(OS_IOS)) |
88 #include "content/browser/compositor/image_transport_factory.h" | 90 #include "content/browser/compositor/image_transport_factory.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 #include "ui/gfx/x/x11_connection.h" | 172 #include "ui/gfx/x/x11_connection.h" |
171 #include "ui/gfx/x/x11_switches.h" | 173 #include "ui/gfx/x/x11_switches.h" |
172 #include "ui/gfx/x/x11_types.h" | 174 #include "ui/gfx/x/x11_types.h" |
173 #endif | 175 #endif |
174 | 176 |
175 #if defined(USE_NSS_CERTS) || !defined(USE_OPENSSL) | 177 #if defined(USE_NSS_CERTS) || !defined(USE_OPENSSL) |
176 #include "crypto/nss_util.h" | 178 #include "crypto/nss_util.h" |
177 #endif | 179 #endif |
178 | 180 |
179 #if defined(MOJO_SHELL_CLIENT) | 181 #if defined(MOJO_SHELL_CLIENT) |
180 #include "content/common/mojo/mojo_shell_connection_impl.h" | |
181 #include "mojo/converters/network/network_type_converters.h" | |
182 #include "mojo/shell/public/cpp/shell.h" | |
183 #include "ui/views/mus/window_manager_connection.h" | 182 #include "ui/views/mus/window_manager_connection.h" |
184 #endif | 183 #endif |
185 | 184 |
186 // One of the linux specific headers defines this as a macro. | 185 // One of the linux specific headers defines this as a macro. |
187 #ifdef DestroyAll | 186 #ifdef DestroyAll |
188 #undef DestroyAll | 187 #undef DestroyAll |
189 #endif | 188 #endif |
190 | 189 |
191 namespace content { | 190 namespace content { |
192 namespace { | 191 namespace { |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 NOTREACHED(); | 907 NOTREACHED(); |
909 } | 908 } |
910 | 909 |
911 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 910 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
912 } | 911 } |
913 created_threads_ = true; | 912 created_threads_ = true; |
914 return result_code_; | 913 return result_code_; |
915 } | 914 } |
916 | 915 |
917 int BrowserMainLoop::PreMainMessageLoopRun() { | 916 int BrowserMainLoop::PreMainMessageLoopRun() { |
918 #if defined(MOJO_SHELL_CLIENT) | |
919 if (IsRunningInMojoShell()) { | 917 if (IsRunningInMojoShell()) { |
920 MojoShellConnectionImpl::Create(); | 918 MojoShellConnectionImpl::Create(); |
921 MojoShellConnectionImpl::Get()->BindToCommandLinePlatformChannel(); | 919 MojoShellConnectionImpl::Get()->BindToCommandLinePlatformChannel(); |
922 #if defined(USE_AURA) | 920 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) |
923 views::WindowManagerConnection::Create( | 921 views::WindowManagerConnection::Create( |
924 MojoShellConnection::Get()->GetShell()); | 922 MojoShellConnection::Get()->GetShell()); |
925 #endif | 923 #endif |
926 } | 924 } |
927 #endif | |
928 | 925 |
929 if (parts_) { | 926 if (parts_) { |
930 TRACE_EVENT0("startup", | 927 TRACE_EVENT0("startup", |
931 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); | 928 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); |
932 TRACK_SCOPED_REGION( | 929 TRACK_SCOPED_REGION( |
933 "Startup", "BrowserMainLoop::PreMainMessageLoopRun"); | 930 "Startup", "BrowserMainLoop::PreMainMessageLoopRun"); |
934 | 931 |
935 parts_->PreMainMessageLoopRun(); | 932 parts_->PreMainMessageLoopRun(); |
936 } | 933 } |
937 | 934 |
(...skipping 27 matching lines...) Expand all Loading... |
965 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); | 962 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); |
966 | 963 |
967 // Teardown may start in PostMainMessageLoopRun, and during teardown we | 964 // Teardown may start in PostMainMessageLoopRun, and during teardown we |
968 // need to be able to perform IO. | 965 // need to be able to perform IO. |
969 base::ThreadRestrictions::SetIOAllowed(true); | 966 base::ThreadRestrictions::SetIOAllowed(true); |
970 BrowserThread::PostTask( | 967 BrowserThread::PostTask( |
971 BrowserThread::IO, FROM_HERE, | 968 BrowserThread::IO, FROM_HERE, |
972 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 969 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
973 true)); | 970 true)); |
974 | 971 |
975 #if defined(MOJO_SHELL_CLIENT) | 972 if (IsRunningInMojoShell()) |
976 MojoShellConnection::Destroy(); | 973 MojoShellConnection::Destroy(); |
977 #endif | |
978 | 974 |
979 #if !defined(OS_IOS) | 975 #if !defined(OS_IOS) |
980 if (RenderProcessHost::run_renderer_in_process()) | 976 if (RenderProcessHost::run_renderer_in_process()) |
981 RenderProcessHostImpl::ShutDownInProcessRenderer(); | 977 RenderProcessHostImpl::ShutDownInProcessRenderer(); |
982 #endif | 978 #endif |
983 | 979 |
984 if (parts_) { | 980 if (parts_) { |
985 TRACE_EVENT0("shutdown", | 981 TRACE_EVENT0("shutdown", |
986 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); | 982 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); |
987 parts_->PostMainMessageLoopRun(); | 983 parts_->PostMainMessageLoopRun(); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 DCHECK(is_tracing_startup_for_duration_); | 1466 DCHECK(is_tracing_startup_for_duration_); |
1471 | 1467 |
1472 is_tracing_startup_for_duration_ = false; | 1468 is_tracing_startup_for_duration_ = false; |
1473 TracingController::GetInstance()->StopTracing( | 1469 TracingController::GetInstance()->StopTracing( |
1474 TracingController::CreateFileSink( | 1470 TracingController::CreateFileSink( |
1475 startup_trace_file_, | 1471 startup_trace_file_, |
1476 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1472 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1477 } | 1473 } |
1478 | 1474 |
1479 } // namespace content | 1475 } // namespace content |
OLD | NEW |