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

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

Issue 1297173003: Revert of aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/browser_main_loop.h ('k') | content/public/test/unittest_test_suite.h » ('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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 RenderProcessHostImpl::ShutDownInProcessRenderer(); 915 RenderProcessHostImpl::ShutDownInProcessRenderer();
916 #endif 916 #endif
917 917
918 if (parts_) { 918 if (parts_) {
919 TRACE_EVENT0("shutdown", 919 TRACE_EVENT0("shutdown",
920 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun"); 920 "BrowserMainLoop::Subsystem:PostMainMessageLoopRun");
921 parts_->PostMainMessageLoopRun(); 921 parts_->PostMainMessageLoopRun();
922 } 922 }
923 923
924 #if defined(USE_AURA) 924 #if defined(USE_AURA)
925 env_.reset(); 925 aura::Env::DeleteInstance();
926 #endif 926 #endif
927 927
928 trace_memory_controller_.reset(); 928 trace_memory_controller_.reset();
929 system_stats_monitor_.reset(); 929 system_stats_monitor_.reset();
930 930
931 #if !defined(OS_IOS) 931 #if !defined(OS_IOS)
932 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to 932 // Destroying the GpuProcessHostUIShims on the UI thread posts a task to
933 // delete related objects on the GPU thread. This must be done before 933 // delete related objects on the GPU thread. This must be done before
934 // stopping the GPU thread. The GPU thread will close IPC channels to renderer 934 // stopping the GPU thread. The GPU thread will close IPC channels to renderer
935 // processes so this has to happen before stopping the IO thread. 935 // processes so this has to happen before stopping the IO thread.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1134 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1135 #elif defined(USE_AURA) || defined(OS_MACOSX) 1135 #elif defined(USE_AURA) || defined(OS_MACOSX)
1136 established_gpu_channel = true; 1136 established_gpu_channel = true;
1137 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || 1137 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() ||
1138 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { 1138 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) {
1139 established_gpu_channel = always_uses_gpu = false; 1139 established_gpu_channel = always_uses_gpu = false;
1140 } 1140 }
1141 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); 1141 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel);
1142 ImageTransportFactory::Initialize(); 1142 ImageTransportFactory::Initialize();
1143 #if defined(USE_AURA) 1143 #if defined(USE_AURA)
1144 env_->set_context_factory(GetContextFactory()); 1144 if (aura::Env::GetInstance()) {
1145 aura::Env::GetInstance()->set_context_factory(GetContextFactory());
1146 }
1145 #endif // defined(USE_AURA) 1147 #endif // defined(USE_AURA)
1146 #endif // defined(OS_ANDROID) 1148 #endif // defined(OS_ANDROID)
1147 1149
1148 // Enable the GpuMemoryBuffer dump provider with IO thread affinity. Note that 1150 // Enable the GpuMemoryBuffer dump provider with IO thread affinity. Note that
1149 // unregistration happens on the IO thread (See 1151 // unregistration happens on the IO thread (See
1150 // BrowserProcessSubThread::IOThreadPreCleanUp). 1152 // BrowserProcessSubThread::IOThreadPreCleanUp).
1151 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 1153 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
1152 BrowserGpuMemoryBufferManager::current(), io_thread_->task_runner()); 1154 BrowserGpuMemoryBufferManager::current(), io_thread_->task_runner());
1153 1155
1154 { 1156 {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 1281
1280 #if defined(USE_AURA) 1282 #if defined(USE_AURA)
1281 1283
1282 #if defined(USE_X11) 1284 #if defined(USE_X11)
1283 if (!gfx::GetXDisplay()) 1285 if (!gfx::GetXDisplay())
1284 return false; 1286 return false;
1285 #endif 1287 #endif
1286 1288
1287 // Env creates the compositor. Aura widgets need the compositor to be created 1289 // Env creates the compositor. Aura widgets need the compositor to be created
1288 // before they can be initialized by the browser. 1290 // before they can be initialized by the browser.
1289 env_ = aura::Env::CreateInstance(); 1291 aura::Env::CreateInstance(true);
1290 #endif // defined(USE_AURA) 1292 #endif // defined(USE_AURA)
1291 1293
1292 if (parts_) 1294 if (parts_)
1293 parts_->ToolkitInitialized(); 1295 parts_->ToolkitInitialized();
1294 1296
1295 return true; 1297 return true;
1296 } 1298 }
1297 1299
1298 void BrowserMainLoop::MainMessageLoopRun() { 1300 void BrowserMainLoop::MainMessageLoopRun() {
1299 #if defined(OS_ANDROID) 1301 #if defined(OS_ANDROID)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 DCHECK(is_tracing_startup_); 1360 DCHECK(is_tracing_startup_);
1359 1361
1360 is_tracing_startup_ = false; 1362 is_tracing_startup_ = false;
1361 TracingController::GetInstance()->DisableRecording( 1363 TracingController::GetInstance()->DisableRecording(
1362 TracingController::CreateFileSink( 1364 TracingController::CreateFileSink(
1363 startup_trace_file_, 1365 startup_trace_file_,
1364 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1366 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1365 } 1367 }
1366 1368
1367 } // namespace content 1369 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/public/test/unittest_test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698