| 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/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 { | 609 { |
| 610 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); | 610 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); |
| 611 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 611 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 612 SurfaceTextureManager::SetInstance( | 612 SurfaceTextureManager::SetInstance( |
| 613 InProcessSurfaceTextureManager::GetInstance()); | 613 InProcessSurfaceTextureManager::GetInstance()); |
| 614 } else { | 614 } else { |
| 615 SurfaceTextureManager::SetInstance( | 615 SurfaceTextureManager::SetInstance( |
| 616 BrowserSurfaceTextureManager::GetInstance()); | 616 BrowserSurfaceTextureManager::GetInstance()); |
| 617 } | 617 } |
| 618 } | 618 } |
| 619 | 619 // TODO(mfomitchev): Screen Orientation APIs on Aura - crbug.com/546719. |
| 620 #if !defined(USE_AURA) |
| 620 if (!parsed_command_line_.HasSwitch( | 621 if (!parsed_command_line_.HasSwitch( |
| 621 switches::kDisableScreenOrientationLock)) { | 622 switches::kDisableScreenOrientationLock)) { |
| 622 TRACE_EVENT0("startup", | 623 TRACE_EVENT0("startup", |
| 623 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); | 624 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); |
| 624 screen_orientation_delegate_.reset( | 625 screen_orientation_delegate_.reset( |
| 625 new ScreenOrientationDelegateAndroid()); | 626 new ScreenOrientationDelegateAndroid()); |
| 626 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); | 627 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); |
| 627 } | 628 } |
| 628 #endif | 629 #endif |
| 630 #endif |
| 629 | 631 |
| 630 #if defined(OS_MACOSX) && !defined(OS_IOS) | 632 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 631 { | 633 { |
| 632 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:IOSurfaceManager"); | 634 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:IOSurfaceManager"); |
| 633 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 635 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 634 gfx::IOSurfaceManager::SetInstance( | 636 gfx::IOSurfaceManager::SetInstance( |
| 635 InProcessIOSurfaceManager::GetInstance()); | 637 InProcessIOSurfaceManager::GetInstance()); |
| 636 } else { | 638 } else { |
| 637 gfx::IOSurfaceManager::SetInstance( | 639 gfx::IOSurfaceManager::SetInstance( |
| 638 BrowserIOSurfaceManager::GetInstance()); | 640 BrowserIOSurfaceManager::GetInstance()); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 | 1174 |
| 1173 #if !defined(OS_IOS) | 1175 #if !defined(OS_IOS) |
| 1174 HistogramSynchronizer::GetInstance(); | 1176 HistogramSynchronizer::GetInstance(); |
| 1175 #if defined(OS_ANDROID) | 1177 #if defined(OS_ANDROID) |
| 1176 // Up the priority of the UI thread. | 1178 // Up the priority of the UI thread. |
| 1177 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 1179 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
| 1178 #endif | 1180 #endif |
| 1179 | 1181 |
| 1180 bool always_uses_gpu = true; | 1182 bool always_uses_gpu = true; |
| 1181 bool established_gpu_channel = false; | 1183 bool established_gpu_channel = false; |
| 1182 #if defined(OS_ANDROID) | 1184 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1183 // TODO(crbug.com/439322): This should be set to |true|. | 1185 // TODO(crbug.com/439322): This should be set to |true|. |
| 1184 established_gpu_channel = false; | 1186 established_gpu_channel = false; |
| 1185 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1187 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1186 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1188 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 1187 established_gpu_channel = true; | 1189 established_gpu_channel = true; |
| 1188 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1190 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
| 1189 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { | 1191 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { |
| 1190 established_gpu_channel = always_uses_gpu = false; | 1192 established_gpu_channel = always_uses_gpu = false; |
| 1191 } | 1193 } |
| 1192 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1194 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 if (command_line.HasSwitch(switches::kTraceStartup)) { | 1376 if (command_line.HasSwitch(switches::kTraceStartup)) { |
| 1375 trace_file = command_line.GetSwitchValuePath( | 1377 trace_file = command_line.GetSwitchValuePath( |
| 1376 switches::kTraceStartupFile); | 1378 switches::kTraceStartupFile); |
| 1377 // trace_file = "none" means that startup events will show up for the next | 1379 // trace_file = "none" means that startup events will show up for the next |
| 1378 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ | 1380 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ |
| 1379 // EndTracing, for example). | 1381 // EndTracing, for example). |
| 1380 if (trace_file == base::FilePath().AppendASCII("none")) | 1382 if (trace_file == base::FilePath().AppendASCII("none")) |
| 1381 return trace_file; | 1383 return trace_file; |
| 1382 | 1384 |
| 1383 if (trace_file.empty()) { | 1385 if (trace_file.empty()) { |
| 1384 #if defined(OS_ANDROID) | 1386 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1385 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1387 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1386 #else | 1388 #else |
| 1387 // Default to saving the startup trace into the current dir. | 1389 // Default to saving the startup trace into the current dir. |
| 1388 trace_file = base::FilePath().AppendASCII("chrometrace.log"); | 1390 trace_file = base::FilePath().AppendASCII("chrometrace.log"); |
| 1389 #endif | 1391 #endif |
| 1390 } | 1392 } |
| 1391 } else { | 1393 } else { |
| 1392 #if defined(OS_ANDROID) | 1394 #if defined(OS_ANDROID) && !defined(USE_AURA) |
| 1393 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1395 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1394 #else | 1396 #else |
| 1395 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); | 1397 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); |
| 1396 #endif | 1398 #endif |
| 1397 } | 1399 } |
| 1398 | 1400 |
| 1399 return trace_file; | 1401 return trace_file; |
| 1400 } | 1402 } |
| 1401 | 1403 |
| 1402 void BrowserMainLoop::InitStartupTracingForDuration( | 1404 void BrowserMainLoop::InitStartupTracingForDuration( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1431 DCHECK(is_tracing_startup_for_duration_); | 1433 DCHECK(is_tracing_startup_for_duration_); |
| 1432 | 1434 |
| 1433 is_tracing_startup_for_duration_ = false; | 1435 is_tracing_startup_for_duration_ = false; |
| 1434 TracingController::GetInstance()->DisableRecording( | 1436 TracingController::GetInstance()->DisableRecording( |
| 1435 TracingController::CreateFileSink( | 1437 TracingController::CreateFileSink( |
| 1436 startup_trace_file_, | 1438 startup_trace_file_, |
| 1437 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1439 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1438 } | 1440 } |
| 1439 | 1441 |
| 1440 } // namespace content | 1442 } // namespace content |
| OLD | NEW |