Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 1442893002: Move Shell connection to content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i2
Patch Set: . Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/child_process_launcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 #if defined(USE_X11) 164 #if defined(USE_X11)
165 #include "ui/gfx/x/x11_connection.h" 165 #include "ui/gfx/x/x11_connection.h"
166 #include "ui/gfx/x/x11_types.h" 166 #include "ui/gfx/x/x11_types.h"
167 #endif 167 #endif
168 168
169 #if defined(USE_NSS_CERTS) || !defined(USE_OPENSSL) 169 #if defined(USE_NSS_CERTS) || !defined(USE_OPENSSL)
170 #include "crypto/nss_util.h" 170 #include "crypto/nss_util.h"
171 #endif 171 #endif
172 172
173 #if defined(MOJO_SHELL_CLIENT)
174 #include "components/mus/public/interfaces/window_manager.mojom.h"
175 #include "content/common/mojo/mojo_shell_connection_impl.h"
176 #include "mojo/application/public/cpp/application_impl.h"
177 #include "mojo/converters/network/network_type_converters.h"
178 #include "ui/views/mus/window_manager_connection.h"
179 #endif
180
173 // One of the linux specific headers defines this as a macro. 181 // One of the linux specific headers defines this as a macro.
174 #ifdef DestroyAll 182 #ifdef DestroyAll
175 #undef DestroyAll 183 #undef DestroyAll
176 #endif 184 #endif
177 185
178 namespace content { 186 namespace content {
179 namespace { 187 namespace {
180 188
181 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 189 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
182 void SetupSandbox(const base::CommandLine& parsed_command_line) { 190 void SetupSandbox(const base::CommandLine& parsed_command_line) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 NOTREACHED(); 904 NOTREACHED();
897 } 905 }
898 906
899 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); 907 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start");
900 } 908 }
901 created_threads_ = true; 909 created_threads_ = true;
902 return result_code_; 910 return result_code_;
903 } 911 }
904 912
905 int BrowserMainLoop::PreMainMessageLoopRun() { 913 int BrowserMainLoop::PreMainMessageLoopRun() {
914 #if defined(MOJO_SHELL_CLIENT)
915 if (IsRunningInMojoShell()) {
916 MojoShellConnectionImpl::Create();
917 #if defined(USE_AURA)
918 mus::mojom::WindowManagerPtr window_manager;
919 mojo::ApplicationImpl* application =
920 MojoShellConnection::Get()->GetApplication();
921 application->ConnectToService(
922 mojo::URLRequest::From(std::string("mojo:example_wm")),
923 &window_manager);
924 views::WindowManagerConnection::Create(window_manager.Pass(), application);
925 #endif
926 }
927 #endif
928
906 if (parts_) { 929 if (parts_) {
907 TRACE_EVENT0("startup", 930 TRACE_EVENT0("startup",
908 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); 931 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun");
909 TRACK_SCOPED_REGION( 932 TRACK_SCOPED_REGION(
910 "Startup", "BrowserMainLoop::PreMainMessageLoopRun"); 933 "Startup", "BrowserMainLoop::PreMainMessageLoopRun");
911 934
912 parts_->PreMainMessageLoopRun(); 935 parts_->PreMainMessageLoopRun();
913 } 936 }
914 937
915 // If the UI thread blocks, the whole UI is unresponsive. 938 // If the UI thread blocks, the whole UI is unresponsive.
(...skipping 26 matching lines...) Expand all
942 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); 965 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp");
943 966
944 // Teardown may start in PostMainMessageLoopRun, and during teardown we 967 // Teardown may start in PostMainMessageLoopRun, and during teardown we
945 // need to be able to perform IO. 968 // need to be able to perform IO.
946 base::ThreadRestrictions::SetIOAllowed(true); 969 base::ThreadRestrictions::SetIOAllowed(true);
947 BrowserThread::PostTask( 970 BrowserThread::PostTask(
948 BrowserThread::IO, FROM_HERE, 971 BrowserThread::IO, FROM_HERE,
949 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 972 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
950 true)); 973 true));
951 974
975 #if defined(MOJO_SHELL_CLIENT)
976 MojoShellConnection::Destroy();
977 #endif
952 mojo_ipc_support_.reset(); 978 mojo_ipc_support_.reset();
953 mojo_shell_context_.reset(); 979 mojo_shell_context_.reset();
954 980
955 #if !defined(OS_IOS) 981 #if !defined(OS_IOS)
956 if (RenderProcessHost::run_renderer_in_process()) 982 if (RenderProcessHost::run_renderer_in_process())
957 RenderProcessHostImpl::ShutDownInProcessRenderer(); 983 RenderProcessHostImpl::ShutDownInProcessRenderer();
958 #endif 984 #endif
959 985
960 if (parts_) { 986 if (parts_) {
961 TRACE_EVENT0("shutdown", 987 TRACE_EVENT0("shutdown",
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 DCHECK(is_tracing_startup_for_duration_); 1454 DCHECK(is_tracing_startup_for_duration_);
1429 1455
1430 is_tracing_startup_for_duration_ = false; 1456 is_tracing_startup_for_duration_ = false;
1431 TracingController::GetInstance()->StopTracing( 1457 TracingController::GetInstance()->StopTracing(
1432 TracingController::CreateFileSink( 1458 TracingController::CreateFileSink(
1433 startup_trace_file_, 1459 startup_trace_file_,
1434 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1460 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1435 } 1461 }
1436 1462
1437 } // namespace content 1463 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/child_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698