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

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

Issue 2056833002: WIP HW (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 months 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/BUILD.gn ('k') | content/browser/compositor/DEPS » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 // data during shutdown, so the blocking pool needs to be available. There 1098 // data during shutdown, so the blocking pool needs to be available. There
1099 // may also be slow operations pending that will blcok shutdown, so closing 1099 // may also be slow operations pending that will blcok shutdown, so closing
1100 // it here (which will block until required operations are complete) gives 1100 // it here (which will block until required operations are complete) gives
1101 // more head start for those operations to finish. 1101 // more head start for those operations to finish.
1102 { 1102 {
1103 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); 1103 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
1104 BrowserThreadImpl::ShutdownThreadPool(); 1104 BrowserThreadImpl::ShutdownThreadPool();
1105 } 1105 }
1106 // Must happen after the IO thread is shutdown since this may be accessed from 1106 // Must happen after the IO thread is shutdown since this may be accessed from
1107 // it. 1107 // it.
1108 { 1108 if (!shell::ShellIsRemote()) {
1109 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); 1109 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory");
1110 if (BrowserGpuChannelHostFactory::instance()) 1110 if (BrowserGpuChannelHostFactory::instance())
1111 BrowserGpuChannelHostFactory::Terminate(); 1111 BrowserGpuChannelHostFactory::Terminate();
1112 } 1112 }
1113 1113
1114 // Must happen after the I/O thread is shutdown since this class lives on the 1114 // Must happen after the I/O thread is shutdown since this class lives on the
1115 // I/O thread and isn't threadsafe. 1115 // I/O thread and isn't threadsafe.
1116 { 1116 {
1117 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); 1117 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService");
1118 GamepadService::GetInstance()->Terminate(); 1118 GamepadService::GetInstance()->Terminate();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 } 1152 }
1153 1153
1154 int BrowserMainLoop::BrowserThreadsStarted() { 1154 int BrowserMainLoop::BrowserThreadsStarted() {
1155 TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted"); 1155 TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted");
1156 1156
1157 // Bring up Mojo IPC and shell as early as possible. 1157 // Bring up Mojo IPC and shell as early as possible.
1158 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport( 1158 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport(
1159 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO) 1159 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO)
1160 ->task_runner())); 1160 ->task_runner()));
1161 1161
1162 if (shell::ShellIsRemote()) {
1163 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1164 switches::kIsRunningInMojoShell);
1165 }
1162 mojo_shell_context_.reset(new MojoShellContext); 1166 mojo_shell_context_.reset(new MojoShellContext);
1163 if (shell::ShellIsRemote()) { 1167 if (shell::ShellIsRemote()) {
1164 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) 1168 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
1165 // TODO(rockot): Remove the blocking wait for init. 1169 // TODO(rockot): Remove the blocking wait for init.
1166 // http://crbug.com/594852. 1170 // http://crbug.com/594852.
1167 if (MojoShellConnection::GetForProcess()) 1171 if (MojoShellConnection::GetForProcess())
1168 WaitForMojoShellInitialize(); 1172 WaitForMojoShellInitialize();
1169 #endif 1173 #endif
1170 } 1174 }
1171 1175
(...skipping 20 matching lines...) Expand all
1192 bool always_uses_gpu = true; 1196 bool always_uses_gpu = true;
1193 bool established_gpu_channel = false; 1197 bool established_gpu_channel = false;
1194 #if defined(OS_ANDROID) 1198 #if defined(OS_ANDROID)
1195 // TODO(crbug.com/439322): This should be set to |true|. 1199 // TODO(crbug.com/439322): This should be set to |true|.
1196 established_gpu_channel = false; 1200 established_gpu_channel = false;
1197 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); 1201 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup();
1198 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1202 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1199 #elif defined(USE_AURA) || defined(OS_MACOSX) 1203 #elif defined(USE_AURA) || defined(OS_MACOSX)
1200 established_gpu_channel = true; 1204 established_gpu_channel = true;
1201 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || 1205 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
1202 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { 1206 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) ||
1207 shell::ShellIsRemote()) {
1203 established_gpu_channel = always_uses_gpu = false; 1208 established_gpu_channel = always_uses_gpu = false;
1204 } 1209 }
1205 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1210 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1206 ImageTransportFactory::Initialize(); 1211 ImageTransportFactory::Initialize();
1207 #if defined(USE_AURA) 1212 #if defined(USE_AURA)
1208 bool use_mus_in_renderer = false; 1213 bool use_mus_in_renderer = false;
1209 #if defined (MOJO_SHELL_CLIENT) 1214 #if defined (MOJO_SHELL_CLIENT)
1210 use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch( 1215 use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch(
1211 switches::kUseMusInRenderer); 1216 switches::kUseMusInRenderer);
1212 #endif // defined(MOJO_SHELL_CLIENT); 1217 #endif // defined(MOJO_SHELL_CLIENT);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 // On Windows, clipboards are also used on the FILE or IO threads. 1300 // On Windows, clipboards are also used on the FILE or IO threads.
1296 allowed_clipboard_threads.push_back(file_thread_->GetThreadId()); 1301 allowed_clipboard_threads.push_back(file_thread_->GetThreadId());
1297 allowed_clipboard_threads.push_back(io_thread_->GetThreadId()); 1302 allowed_clipboard_threads.push_back(io_thread_->GetThreadId());
1298 #endif 1303 #endif
1299 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); 1304 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads);
1300 1305
1301 // When running the GPU thread in-process, avoid optimistically starting it 1306 // When running the GPU thread in-process, avoid optimistically starting it
1302 // since creating the GPU thread races against creation of the one-and-only 1307 // since creating the GPU thread races against creation of the one-and-only
1303 // ChildProcess instance which is created by the renderer thread. 1308 // ChildProcess instance which is created by the renderer thread.
1304 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && 1309 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) &&
1305 !established_gpu_channel && 1310 !established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() &&
1306 always_uses_gpu && 1311 !shell::ShellIsRemote()) {
1307 !UsingInProcessGpu()) {
1308 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", 1312 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process",
1309 TRACE_EVENT_SCOPE_THREAD); 1313 TRACE_EVENT_SCOPE_THREAD);
1310 BrowserThread::PostTask( 1314 BrowserThread::PostTask(
1311 BrowserThread::IO, FROM_HERE, 1315 BrowserThread::IO, FROM_HERE,
1312 base::Bind(base::IgnoreResult(&GpuProcessHost::Get), 1316 base::Bind(base::IgnoreResult(&GpuProcessHost::Get),
1313 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 1317 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
1314 CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); 1318 CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP));
1315 } 1319 }
1316 1320
1317 #if defined(OS_MACOSX) 1321 #if defined(OS_MACOSX)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 std::move(worker_task_runner), 1501 std::move(worker_task_runner),
1498 MediaInternals::GetInstance()); 1502 MediaInternals::GetInstance());
1499 } 1503 }
1500 CHECK(audio_manager_); 1504 CHECK(audio_manager_);
1501 1505
1502 if (use_hang_monitor) 1506 if (use_hang_monitor)
1503 media::AudioManager::StartHangMonitor(io_thread_->task_runner()); 1507 media::AudioManager::StartHangMonitor(io_thread_->task_runner());
1504 } 1508 }
1505 1509
1506 } // namespace content 1510 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/compositor/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698