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

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

Issue 2096843002: mus+ash: Enable Chrome HW rendering in mus+ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 5 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
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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 // data during shutdown, so the blocking pool needs to be available. There 1103 // data during shutdown, so the blocking pool needs to be available. There
1104 // may also be slow operations pending that will blcok shutdown, so closing 1104 // may also be slow operations pending that will blcok shutdown, so closing
1105 // it here (which will block until required operations are complete) gives 1105 // it here (which will block until required operations are complete) gives
1106 // more head start for those operations to finish. 1106 // more head start for those operations to finish.
1107 { 1107 {
1108 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); 1108 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
1109 BrowserThreadImpl::ShutdownThreadPool(); 1109 BrowserThreadImpl::ShutdownThreadPool();
1110 } 1110 }
1111 // Must happen after the IO thread is shutdown since this may be accessed from 1111 // Must happen after the IO thread is shutdown since this may be accessed from
1112 // it. 1112 // it.
1113 { 1113 if (!shell::ShellIsRemote()) {
1114 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); 1114 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory");
1115 if (BrowserGpuChannelHostFactory::instance()) 1115 if (BrowserGpuChannelHostFactory::instance())
1116 BrowserGpuChannelHostFactory::Terminate(); 1116 BrowserGpuChannelHostFactory::Terminate();
1117 } 1117 }
1118 1118
1119 // Must happen after the I/O thread is shutdown since this class lives on the 1119 // Must happen after the I/O thread is shutdown since this class lives on the
1120 // I/O thread and isn't threadsafe. 1120 // I/O thread and isn't threadsafe.
1121 { 1121 {
1122 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); 1122 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService");
1123 GamepadService::GetInstance()->Terminate(); 1123 GamepadService::GetInstance()->Terminate();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED, &sync_call_allowed); 1167 MOJO_PROPERTY_TYPE_SYNC_CALL_ALLOWED, &sync_call_allowed);
1168 DCHECK_EQ(MOJO_RESULT_OK, result); 1168 DCHECK_EQ(MOJO_RESULT_OK, result);
1169 1169
1170 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport( 1170 mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport(
1171 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO) 1171 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO)
1172 ->task_runner())); 1172 ->task_runner()));
1173 1173
1174 mojo_shell_context_.reset(new MojoShellContext); 1174 mojo_shell_context_.reset(new MojoShellContext);
1175 if (shell::ShellIsRemote()) { 1175 if (shell::ShellIsRemote()) {
1176 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) 1176 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA)
1177 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1178 switches::kIsRunningInMash);
1177 // TODO(rockot): Remove the blocking wait for init. 1179 // TODO(rockot): Remove the blocking wait for init.
1178 // http://crbug.com/594852. 1180 // http://crbug.com/594852.
1179 auto connection = MojoShellConnection::GetForProcess(); 1181 auto connection = MojoShellConnection::GetForProcess();
1180 if (connection) { 1182 if (connection) {
1181 WaitForMojoShellInitialize(); 1183 WaitForMojoShellInitialize();
1182 mus::GpuService::Initialize(connection->GetConnector()); 1184 mus::GpuService::Initialize(connection->GetConnector());
1183 } 1185 }
1184 #endif 1186 #endif
1185 } 1187 }
1186 1188
(...skipping 20 matching lines...) Expand all
1207 bool always_uses_gpu = true; 1209 bool always_uses_gpu = true;
1208 bool established_gpu_channel = false; 1210 bool established_gpu_channel = false;
1209 #if defined(OS_ANDROID) 1211 #if defined(OS_ANDROID)
1210 // TODO(crbug.com/439322): This should be set to |true|. 1212 // TODO(crbug.com/439322): This should be set to |true|.
1211 established_gpu_channel = false; 1213 established_gpu_channel = false;
1212 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); 1214 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup();
1213 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1215 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1214 #elif defined(USE_AURA) || defined(OS_MACOSX) 1216 #elif defined(USE_AURA) || defined(OS_MACOSX)
1215 established_gpu_channel = true; 1217 established_gpu_channel = true;
1216 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || 1218 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
1217 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { 1219 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) ||
1220 shell::ShellIsRemote()) {
1218 established_gpu_channel = always_uses_gpu = false; 1221 established_gpu_channel = always_uses_gpu = false;
1219 } 1222 }
1220 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1223 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1221 ImageTransportFactory::Initialize(); 1224 ImageTransportFactory::Initialize();
1222 #if defined(USE_AURA) 1225 #if defined(USE_AURA)
1223 bool use_mus_in_renderer = false; 1226 bool use_mus_in_renderer = false;
1224 #if defined (MOJO_SHELL_CLIENT) 1227 #if defined (MOJO_SHELL_CLIENT)
1225 use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch( 1228 use_mus_in_renderer = base::CommandLine::ForCurrentProcess()->HasSwitch(
1226 switches::kUseMusInRenderer); 1229 switches::kUseMusInRenderer);
1227 #endif // defined(MOJO_SHELL_CLIENT); 1230 #endif // defined(MOJO_SHELL_CLIENT);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 // On Windows, clipboards are also used on the FILE or IO threads. 1313 // On Windows, clipboards are also used on the FILE or IO threads.
1311 allowed_clipboard_threads.push_back(file_thread_->GetThreadId()); 1314 allowed_clipboard_threads.push_back(file_thread_->GetThreadId());
1312 allowed_clipboard_threads.push_back(io_thread_->GetThreadId()); 1315 allowed_clipboard_threads.push_back(io_thread_->GetThreadId());
1313 #endif 1316 #endif
1314 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads); 1317 ui::Clipboard::SetAllowedThreads(allowed_clipboard_threads);
1315 1318
1316 // When running the GPU thread in-process, avoid optimistically starting it 1319 // When running the GPU thread in-process, avoid optimistically starting it
1317 // since creating the GPU thread races against creation of the one-and-only 1320 // since creating the GPU thread races against creation of the one-and-only
1318 // ChildProcess instance which is created by the renderer thread. 1321 // ChildProcess instance which is created by the renderer thread.
1319 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) && 1322 if (GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL) &&
1320 !established_gpu_channel && 1323 !established_gpu_channel && always_uses_gpu && !UsingInProcessGpu() &&
1321 always_uses_gpu && 1324 !shell::ShellIsRemote()) {
1322 !UsingInProcessGpu()) {
1323 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process", 1325 TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process",
1324 TRACE_EVENT_SCOPE_THREAD); 1326 TRACE_EVENT_SCOPE_THREAD);
1325 BrowserThread::PostTask( 1327 BrowserThread::PostTask(
1326 BrowserThread::IO, FROM_HERE, 1328 BrowserThread::IO, FROM_HERE,
1327 base::Bind(base::IgnoreResult(&GpuProcessHost::Get), 1329 base::Bind(base::IgnoreResult(&GpuProcessHost::Get),
1328 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, 1330 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
1329 CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP)); 1331 CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP));
1330 } 1332 }
1331 1333
1332 #if defined(OS_MACOSX) 1334 #if defined(OS_MACOSX)
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 std::move(worker_task_runner), 1514 std::move(worker_task_runner),
1513 MediaInternals::GetInstance()); 1515 MediaInternals::GetInstance());
1514 } 1516 }
1515 CHECK(audio_manager_); 1517 CHECK(audio_manager_);
1516 1518
1517 if (use_hang_monitor) 1519 if (use_hang_monitor)
1518 media::AudioManager::StartHangMonitor(io_thread_->task_runner()); 1520 media::AudioManager::StartHangMonitor(io_thread_->task_runner());
1519 } 1521 }
1520 1522
1521 } // namespace content 1523 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698