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

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
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 "ui/views/mus/window_manager_connection.h"
177 #endif
178
173 // One of the linux specific headers defines this as a macro. 179 // One of the linux specific headers defines this as a macro.
174 #ifdef DestroyAll 180 #ifdef DestroyAll
175 #undef DestroyAll 181 #undef DestroyAll
176 #endif 182 #endif
177 183
178 namespace content { 184 namespace content {
179 namespace { 185 namespace {
180 186
181 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 187 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
182 void SetupSandbox(const base::CommandLine& parsed_command_line) { 188 void SetupSandbox(const base::CommandLine& parsed_command_line) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 NOTREACHED(); 902 NOTREACHED();
897 } 903 }
898 904
899 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); 905 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start");
900 } 906 }
901 created_threads_ = true; 907 created_threads_ = true;
902 return result_code_; 908 return result_code_;
903 } 909 }
904 910
905 int BrowserMainLoop::PreMainMessageLoopRun() { 911 int BrowserMainLoop::PreMainMessageLoopRun() {
912 #if defined(MOJO_SHELL_CLIENT)
913 if (IsRunningInMojoShell()) {
914 MojoShellConnectionImpl::Create();
915 mus::mojom::WindowManagerPtr window_manager;
916 application->ConnectToService(
917 mojo::URLRequest::From(std::string("mojo:example_wm")),
918 &window_manager);
919 views::WindowManagerConnection::Create(window_manager.Pass(), application);
920 }
921 #endif
922
906 if (parts_) { 923 if (parts_) {
907 TRACE_EVENT0("startup", 924 TRACE_EVENT0("startup",
908 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun"); 925 "BrowserMainLoop::CreateThreads:PreMainMessageLoopRun");
909 TRACK_SCOPED_REGION( 926 TRACK_SCOPED_REGION(
910 "Startup", "BrowserMainLoop::PreMainMessageLoopRun"); 927 "Startup", "BrowserMainLoop::PreMainMessageLoopRun");
911 928
912 parts_->PreMainMessageLoopRun(); 929 parts_->PreMainMessageLoopRun();
913 } 930 }
914 931
915 // If the UI thread blocks, the whole UI is unresponsive. 932 // If the UI thread blocks, the whole UI is unresponsive.
(...skipping 26 matching lines...) Expand all
942 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp"); 959 TRACE_EVENT0("shutdown", "BrowserMainLoop::ShutdownThreadsAndCleanUp");
943 960
944 // Teardown may start in PostMainMessageLoopRun, and during teardown we 961 // Teardown may start in PostMainMessageLoopRun, and during teardown we
945 // need to be able to perform IO. 962 // need to be able to perform IO.
946 base::ThreadRestrictions::SetIOAllowed(true); 963 base::ThreadRestrictions::SetIOAllowed(true);
947 BrowserThread::PostTask( 964 BrowserThread::PostTask(
948 BrowserThread::IO, FROM_HERE, 965 BrowserThread::IO, FROM_HERE,
949 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 966 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
950 true)); 967 true));
951 968
969 #if defined(MOJO_SHELL_CLIENT)
970 MojoShellConnection::Destroy();
971 #endif
952 mojo_ipc_support_.reset(); 972 mojo_ipc_support_.reset();
953 mojo_shell_context_.reset(); 973 mojo_shell_context_.reset();
954 974
955 #if !defined(OS_IOS) 975 #if !defined(OS_IOS)
956 if (RenderProcessHost::run_renderer_in_process()) 976 if (RenderProcessHost::run_renderer_in_process())
957 RenderProcessHostImpl::ShutDownInProcessRenderer(); 977 RenderProcessHostImpl::ShutDownInProcessRenderer();
958 #endif 978 #endif
959 979
960 if (parts_) { 980 if (parts_) {
961 TRACE_EVENT0("shutdown", 981 TRACE_EVENT0("shutdown",
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 DCHECK(is_tracing_startup_for_duration_); 1448 DCHECK(is_tracing_startup_for_duration_);
1429 1449
1430 is_tracing_startup_for_duration_ = false; 1450 is_tracing_startup_for_duration_ = false;
1431 TracingController::GetInstance()->StopTracing( 1451 TracingController::GetInstance()->StopTracing(
1432 TracingController::CreateFileSink( 1452 TracingController::CreateFileSink(
1433 startup_trace_file_, 1453 startup_trace_file_,
1434 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1454 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1435 } 1455 }
1436 1456
1437 } // namespace content 1457 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698