Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 { | 608 { |
| 609 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); | 609 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); |
| 610 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 610 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 611 SurfaceTextureManager::SetInstance( | 611 SurfaceTextureManager::SetInstance( |
| 612 InProcessSurfaceTextureManager::GetInstance()); | 612 InProcessSurfaceTextureManager::GetInstance()); |
| 613 } else { | 613 } else { |
| 614 SurfaceTextureManager::SetInstance( | 614 SurfaceTextureManager::SetInstance( |
| 615 BrowserSurfaceTextureManager::GetInstance()); | 615 BrowserSurfaceTextureManager::GetInstance()); |
| 616 } | 616 } |
| 617 } | 617 } |
| 618 | 618 // TODO(mfomitchev): Screen Orientation APIs on Aura - crbug.com/546719. |
| 619 #if !defined(USE_AURA) | |
| 619 if (!parsed_command_line_.HasSwitch( | 620 if (!parsed_command_line_.HasSwitch( |
| 620 switches::kDisableScreenOrientationLock)) { | 621 switches::kDisableScreenOrientationLock)) { |
| 621 TRACE_EVENT0("startup", | 622 TRACE_EVENT0("startup", |
| 622 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); | 623 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); |
| 623 screen_orientation_delegate_.reset( | 624 screen_orientation_delegate_.reset( |
| 624 new ScreenOrientationDelegateAndroid()); | 625 new ScreenOrientationDelegateAndroid()); |
| 625 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); | 626 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); |
| 626 } | 627 } |
| 627 #endif | 628 #endif |
| 629 #endif | |
| 628 | 630 |
| 629 #if defined(OS_MACOSX) && !defined(OS_IOS) | 631 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 630 { | 632 { |
| 631 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:IOSurfaceManager"); | 633 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:IOSurfaceManager"); |
| 632 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 634 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 633 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); | 635 IOSurfaceManager::SetInstance(InProcessIOSurfaceManager::GetInstance()); |
| 634 } else { | 636 } else { |
| 635 IOSurfaceManager::SetInstance(BrowserIOSurfaceManager::GetInstance()); | 637 IOSurfaceManager::SetInstance(BrowserIOSurfaceManager::GetInstance()); |
| 636 } | 638 } |
| 637 } | 639 } |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1165 | 1167 |
| 1166 #if !defined(OS_IOS) | 1168 #if !defined(OS_IOS) |
| 1167 HistogramSynchronizer::GetInstance(); | 1169 HistogramSynchronizer::GetInstance(); |
| 1168 #if defined(OS_ANDROID) | 1170 #if defined(OS_ANDROID) |
| 1169 // Up the priority of the UI thread. | 1171 // Up the priority of the UI thread. |
| 1170 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 1172 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
| 1171 #endif | 1173 #endif |
| 1172 | 1174 |
| 1173 bool always_uses_gpu = true; | 1175 bool always_uses_gpu = true; |
| 1174 bool established_gpu_channel = false; | 1176 bool established_gpu_channel = false; |
| 1175 #if defined(OS_ANDROID) | 1177 // TODO(mfomitchev): Need ImageTransportFactory::Initialize on Android Aura, |
| 1178 // but figure out what to do with BrowserGpuChannelHostFactory. | |
|
no sievers
2015/11/02 22:27:15
i think you can remove the TODO.
mfomitchev
2015/11/03 22:23:19
Done.
| |
| 1179 #if defined(OS_ANDROID) && !defined(USE_AURA) | |
| 1176 // TODO(crbug.com/439322): This should be set to |true|. | 1180 // TODO(crbug.com/439322): This should be set to |true|. |
| 1177 established_gpu_channel = false; | 1181 established_gpu_channel = false; |
| 1178 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1182 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1179 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1183 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 1180 established_gpu_channel = true; | 1184 established_gpu_channel = true; |
| 1181 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1185 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
| 1182 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { | 1186 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { |
| 1183 established_gpu_channel = always_uses_gpu = false; | 1187 established_gpu_channel = always_uses_gpu = false; |
| 1184 } | 1188 } |
| 1185 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1189 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1367 if (command_line.HasSwitch(switches::kTraceStartup)) { | 1371 if (command_line.HasSwitch(switches::kTraceStartup)) { |
| 1368 trace_file = command_line.GetSwitchValuePath( | 1372 trace_file = command_line.GetSwitchValuePath( |
| 1369 switches::kTraceStartupFile); | 1373 switches::kTraceStartupFile); |
| 1370 // trace_file = "none" means that startup events will show up for the next | 1374 // trace_file = "none" means that startup events will show up for the next |
| 1371 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ | 1375 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ |
| 1372 // EndTracing, for example). | 1376 // EndTracing, for example). |
| 1373 if (trace_file == base::FilePath().AppendASCII("none")) | 1377 if (trace_file == base::FilePath().AppendASCII("none")) |
| 1374 return trace_file; | 1378 return trace_file; |
| 1375 | 1379 |
| 1376 if (trace_file.empty()) { | 1380 if (trace_file.empty()) { |
| 1377 #if defined(OS_ANDROID) | 1381 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1378 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1382 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1379 #else | 1383 #else |
| 1380 // Default to saving the startup trace into the current dir. | 1384 // Default to saving the startup trace into the current dir. |
| 1381 trace_file = base::FilePath().AppendASCII("chrometrace.log"); | 1385 trace_file = base::FilePath().AppendASCII("chrometrace.log"); |
| 1382 #endif | 1386 #endif |
| 1383 } | 1387 } |
| 1384 } else { | 1388 } else { |
| 1385 #if defined(OS_ANDROID) | 1389 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1386 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1390 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1387 #else | 1391 #else |
| 1388 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); | 1392 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); |
| 1389 #endif | 1393 #endif |
| 1390 } | 1394 } |
| 1391 | 1395 |
| 1392 return trace_file; | 1396 return trace_file; |
| 1393 } | 1397 } |
| 1394 | 1398 |
| 1395 void BrowserMainLoop::InitStartupTracingForDuration( | 1399 void BrowserMainLoop::InitStartupTracingForDuration( |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1424 DCHECK(is_tracing_startup_for_duration_); | 1428 DCHECK(is_tracing_startup_for_duration_); |
| 1425 | 1429 |
| 1426 is_tracing_startup_for_duration_ = false; | 1430 is_tracing_startup_for_duration_ = false; |
| 1427 TracingController::GetInstance()->DisableRecording( | 1431 TracingController::GetInstance()->DisableRecording( |
| 1428 TracingController::CreateFileSink( | 1432 TracingController::CreateFileSink( |
| 1429 startup_trace_file_, | 1433 startup_trace_file_, |
| 1430 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1434 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1431 } | 1435 } |
| 1432 | 1436 |
| 1433 } // namespace content | 1437 } // namespace content |
| OLD | NEW |