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

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

Issue 2297273004: Revert "Revert of content: Fix Context creation logic in ContextProviderFactoryImpl. (patchset #10 … (Closed)
Patch Set: remove gpu process initialization failure Created 4 years, 3 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 | « no previous file | content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc » ('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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 // Teardown may start in PostMainMessageLoopRun, and during teardown we 969 // Teardown may start in PostMainMessageLoopRun, and during teardown we
970 // need to be able to perform IO. 970 // need to be able to perform IO.
971 base::ThreadRestrictions::SetIOAllowed(true); 971 base::ThreadRestrictions::SetIOAllowed(true);
972 BrowserThread::PostTask( 972 BrowserThread::PostTask(
973 BrowserThread::IO, FROM_HERE, 973 BrowserThread::IO, FROM_HERE,
974 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 974 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
975 true)); 975 true));
976 976
977 #if defined(OS_ANDROID) 977 #if defined(OS_ANDROID)
978 g_browser_main_loop_shutting_down = true; 978 g_browser_main_loop_shutting_down = true;
979 ui::ContextProviderFactory::SetInstance(nullptr);
980 #endif 979 #endif
981 980
982 if (RenderProcessHost::run_renderer_in_process()) 981 if (RenderProcessHost::run_renderer_in_process())
983 RenderProcessHostImpl::ShutDownInProcessRenderer(); 982 RenderProcessHostImpl::ShutDownInProcessRenderer();
984 983
985 if (parts_) { 984 if (parts_) {
986 TRACE_EVENT0("shutdown", 985 TRACE_EVENT0("shutdown",
987 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); 986 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun");
988 parts_->PostMainMessageLoopRun(); 987 parts_->PostMainMessageLoopRun();
989 } 988 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 // it here (which will block until required operations are complete) gives 1123 // it here (which will block until required operations are complete) gives
1125 // more head start for those operations to finish. 1124 // more head start for those operations to finish.
1126 { 1125 {
1127 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); 1126 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
1128 BrowserThreadImpl::ShutdownThreadPool(); 1127 BrowserThreadImpl::ShutdownThreadPool();
1129 } 1128 }
1130 // Must happen after the IO thread is shutdown since this may be accessed from 1129 // Must happen after the IO thread is shutdown since this may be accessed from
1131 // it. 1130 // it.
1132 { 1131 {
1133 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory"); 1132 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GPUChannelFactory");
1134 if (BrowserGpuChannelHostFactory::instance()) 1133 if (BrowserGpuChannelHostFactory::instance()) {
1134 #if defined(OS_ANDROID)
1135 // Clean up the references to the factory before terminating it.
1136 ui::ContextProviderFactory::SetInstance(nullptr);
1137 ContextProviderFactoryImpl::Terminate();
1138 #endif
1135 BrowserGpuChannelHostFactory::Terminate(); 1139 BrowserGpuChannelHostFactory::Terminate();
1140 }
1136 } 1141 }
1137 1142
1138 // Must happen after the I/O thread is shutdown since this class lives on the 1143 // Must happen after the I/O thread is shutdown since this class lives on the
1139 // I/O thread and isn't threadsafe. 1144 // I/O thread and isn't threadsafe.
1140 { 1145 {
1141 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService"); 1146 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:GamepadService");
1142 GamepadService::GetInstance()->Terminate(); 1147 GamepadService::GetInstance()->Terminate();
1143 } 1148 }
1144 { 1149 {
1145 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:SensorService"); 1150 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:SensorService");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 } 1211 }
1207 #endif 1212 #endif
1208 1213
1209 bool always_uses_gpu = true; 1214 bool always_uses_gpu = true;
1210 bool established_gpu_channel = false; 1215 bool established_gpu_channel = false;
1211 #if defined(OS_ANDROID) 1216 #if defined(OS_ANDROID)
1212 // TODO(crbug.com/439322): This should be set to |true|. 1217 // TODO(crbug.com/439322): This should be set to |true|.
1213 established_gpu_channel = false; 1218 established_gpu_channel = false;
1214 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup(); 1219 always_uses_gpu = ShouldStartGpuProcessOnBrowserStartup();
1215 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1220 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1221 ContextProviderFactoryImpl::Initialize(
1222 BrowserGpuChannelHostFactory::instance());
1216 ui::ContextProviderFactory::SetInstance( 1223 ui::ContextProviderFactory::SetInstance(
1217 ContextProviderFactoryImpl::GetInstance()); 1224 ContextProviderFactoryImpl::GetInstance());
1218 #elif defined(USE_AURA) || defined(OS_MACOSX) 1225 #elif defined(USE_AURA) || defined(OS_MACOSX)
1219 established_gpu_channel = true; 1226 established_gpu_channel = true;
1220 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || 1227 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
1221 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) || 1228 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit) ||
1222 shell::ShellIsRemote()) { 1229 shell::ShellIsRemote()) {
1223 established_gpu_channel = always_uses_gpu = false; 1230 established_gpu_channel = always_uses_gpu = false;
1224 } 1231 }
1225 gpu::GpuChannelEstablishFactory* factory = 1232 gpu::GpuChannelEstablishFactory* factory =
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = 1546 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner =
1540 audio_thread_->task_runner(); 1547 audio_thread_->task_runner();
1541 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), 1548 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner),
1542 std::move(worker_task_runner), 1549 std::move(worker_task_runner),
1543 MediaInternals::GetInstance()); 1550 MediaInternals::GetInstance());
1544 } 1551 }
1545 CHECK(audio_manager_); 1552 CHECK(audio_manager_);
1546 } 1553 }
1547 1554
1548 } // namespace content 1555 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698