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

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

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