| 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 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1176 // TODO(crbug.com/439322): This should be set to |true|. | 1178 // TODO(crbug.com/439322): This should be set to |true|. |
| 1177 established_gpu_channel = false; | 1179 established_gpu_channel = false; |
| 1178 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1180 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1179 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1181 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 1180 established_gpu_channel = true; | 1182 established_gpu_channel = true; |
| 1181 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1183 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
| 1182 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { | 1184 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { |
| 1183 established_gpu_channel = always_uses_gpu = false; | 1185 established_gpu_channel = always_uses_gpu = false; |
| 1184 } | 1186 } |
| 1185 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1187 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)) { | 1369 if (command_line.HasSwitch(switches::kTraceStartup)) { |
| 1368 trace_file = command_line.GetSwitchValuePath( | 1370 trace_file = command_line.GetSwitchValuePath( |
| 1369 switches::kTraceStartupFile); | 1371 switches::kTraceStartupFile); |
| 1370 // trace_file = "none" means that startup events will show up for the next | 1372 // trace_file = "none" means that startup events will show up for the next |
| 1371 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ | 1373 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ |
| 1372 // EndTracing, for example). | 1374 // EndTracing, for example). |
| 1373 if (trace_file == base::FilePath().AppendASCII("none")) | 1375 if (trace_file == base::FilePath().AppendASCII("none")) |
| 1374 return trace_file; | 1376 return trace_file; |
| 1375 | 1377 |
| 1376 if (trace_file.empty()) { | 1378 if (trace_file.empty()) { |
| 1377 #if defined(OS_ANDROID) | 1379 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1378 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1380 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1379 #else | 1381 #else |
| 1380 // Default to saving the startup trace into the current dir. | 1382 // Default to saving the startup trace into the current dir. |
| 1381 trace_file = base::FilePath().AppendASCII("chrometrace.log"); | 1383 trace_file = base::FilePath().AppendASCII("chrometrace.log"); |
| 1382 #endif | 1384 #endif |
| 1383 } | 1385 } |
| 1384 } else { | 1386 } else { |
| 1385 #if defined(OS_ANDROID) | 1387 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1386 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1388 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1387 #else | 1389 #else |
| 1388 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); | 1390 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); |
| 1389 #endif | 1391 #endif |
| 1390 } | 1392 } |
| 1391 | 1393 |
| 1392 return trace_file; | 1394 return trace_file; |
| 1393 } | 1395 } |
| 1394 | 1396 |
| 1395 void BrowserMainLoop::InitStartupTracingForDuration( | 1397 void BrowserMainLoop::InitStartupTracingForDuration( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1424 DCHECK(is_tracing_startup_for_duration_); | 1426 DCHECK(is_tracing_startup_for_duration_); |
| 1425 | 1427 |
| 1426 is_tracing_startup_for_duration_ = false; | 1428 is_tracing_startup_for_duration_ = false; |
| 1427 TracingController::GetInstance()->DisableRecording( | 1429 TracingController::GetInstance()->DisableRecording( |
| 1428 TracingController::CreateFileSink( | 1430 TracingController::CreateFileSink( |
| 1429 startup_trace_file_, | 1431 startup_trace_file_, |
| 1430 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1432 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1431 } | 1433 } |
| 1432 | 1434 |
| 1433 } // namespace content | 1435 } // namespace content |
| OLD | NEW |