| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 { | 646 { |
| 647 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); | 647 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); |
| 648 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 648 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
| 649 SurfaceTextureManager::SetInstance( | 649 SurfaceTextureManager::SetInstance( |
| 650 InProcessSurfaceTextureManager::GetInstance()); | 650 InProcessSurfaceTextureManager::GetInstance()); |
| 651 } else { | 651 } else { |
| 652 SurfaceTextureManager::SetInstance( | 652 SurfaceTextureManager::SetInstance( |
| 653 BrowserSurfaceTextureManager::GetInstance()); | 653 BrowserSurfaceTextureManager::GetInstance()); |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 #if !defined(USE_AURA) | 656 |
| 657 if (!parsed_command_line_.HasSwitch( | 657 if (!parsed_command_line_.HasSwitch( |
| 658 switches::kDisableScreenOrientationLock)) { | 658 switches::kDisableScreenOrientationLock)) { |
| 659 TRACE_EVENT0("startup", | 659 TRACE_EVENT0("startup", |
| 660 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); | 660 "BrowserMainLoop::Subsystem:ScreenOrientationProvider"); |
| 661 screen_orientation_delegate_.reset( | 661 screen_orientation_delegate_.reset( |
| 662 new ScreenOrientationDelegateAndroid()); | 662 new ScreenOrientationDelegateAndroid()); |
| 663 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); | 663 ScreenOrientationProvider::SetDelegate(screen_orientation_delegate_.get()); |
| 664 } | 664 } |
| 665 #endif | 665 #endif |
| 666 #endif | |
| 667 | 666 |
| 668 #if defined(OS_MACOSX) && !defined(OS_IOS) | 667 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 669 if (BootstrapSandboxManager::ShouldEnable()) { | 668 if (BootstrapSandboxManager::ShouldEnable()) { |
| 670 TRACE_EVENT0("startup", | 669 TRACE_EVENT0("startup", |
| 671 "BrowserMainLoop::Subsystem:BootstrapSandbox"); | 670 "BrowserMainLoop::Subsystem:BootstrapSandbox"); |
| 672 CHECK(BootstrapSandboxManager::GetInstance()); | 671 CHECK(BootstrapSandboxManager::GetInstance()); |
| 673 } | 672 } |
| 674 #endif | 673 #endif |
| 675 | 674 |
| 676 #if defined(USE_OZONE) | 675 #if defined(USE_OZONE) |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 | 1192 |
| 1194 #if !defined(OS_IOS) | 1193 #if !defined(OS_IOS) |
| 1195 HistogramSynchronizer::GetInstance(); | 1194 HistogramSynchronizer::GetInstance(); |
| 1196 #if defined(OS_ANDROID) | 1195 #if defined(OS_ANDROID) |
| 1197 // Up the priority of the UI thread. | 1196 // Up the priority of the UI thread. |
| 1198 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 1197 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
| 1199 #endif | 1198 #endif |
| 1200 | 1199 |
| 1201 bool always_uses_gpu = true; | 1200 bool always_uses_gpu = true; |
| 1202 bool established_gpu_channel = false; | 1201 bool established_gpu_channel = false; |
| 1203 #if defined(OS_ANDROID) && !defined(USE_AURA) | 1202 #if defined(OS_ANDROID) |
| 1204 // TODO(crbug.com/439322): This should be set to |true|. | 1203 // TODO(crbug.com/439322): This should be set to |true|. |
| 1205 established_gpu_channel = false; | 1204 established_gpu_channel = false; |
| 1206 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1205 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| 1207 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1206 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 1208 established_gpu_channel = true; | 1207 established_gpu_channel = true; |
| 1209 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1208 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
| 1210 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { | 1209 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { |
| 1211 established_gpu_channel = always_uses_gpu = false; | 1210 established_gpu_channel = always_uses_gpu = false; |
| 1212 } | 1211 } |
| 1213 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1212 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 if (command_line.HasSwitch(switches::kTraceStartup)) { | 1410 if (command_line.HasSwitch(switches::kTraceStartup)) { |
| 1412 trace_file = command_line.GetSwitchValuePath( | 1411 trace_file = command_line.GetSwitchValuePath( |
| 1413 switches::kTraceStartupFile); | 1412 switches::kTraceStartupFile); |
| 1414 // trace_file = "none" means that startup events will show up for the next | 1413 // trace_file = "none" means that startup events will show up for the next |
| 1415 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ | 1414 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ |
| 1416 // EndTracing, for example). | 1415 // EndTracing, for example). |
| 1417 if (trace_file == base::FilePath().AppendASCII("none")) | 1416 if (trace_file == base::FilePath().AppendASCII("none")) |
| 1418 return trace_file; | 1417 return trace_file; |
| 1419 | 1418 |
| 1420 if (trace_file.empty()) { | 1419 if (trace_file.empty()) { |
| 1421 #if defined(OS_ANDROID) && !defined(USE_AURA) | 1420 #if defined(OS_ANDROID) |
| 1422 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1421 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1423 #else | 1422 #else |
| 1424 // Default to saving the startup trace into the current dir. | 1423 // Default to saving the startup trace into the current dir. |
| 1425 trace_file = base::FilePath().AppendASCII("chrometrace.log"); | 1424 trace_file = base::FilePath().AppendASCII("chrometrace.log"); |
| 1426 #endif | 1425 #endif |
| 1427 } | 1426 } |
| 1428 } else { | 1427 } else { |
| 1429 #if defined(OS_ANDROID) && !defined(USE_AURA) | 1428 #if defined(OS_ANDROID) |
| 1430 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1429 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
| 1431 #else | 1430 #else |
| 1432 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); | 1431 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); |
| 1433 #endif | 1432 #endif |
| 1434 } | 1433 } |
| 1435 | 1434 |
| 1436 return trace_file; | 1435 return trace_file; |
| 1437 } | 1436 } |
| 1438 | 1437 |
| 1439 void BrowserMainLoop::InitStartupTracingForDuration( | 1438 void BrowserMainLoop::InitStartupTracingForDuration( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1465 DCHECK(is_tracing_startup_for_duration_); | 1464 DCHECK(is_tracing_startup_for_duration_); |
| 1466 | 1465 |
| 1467 is_tracing_startup_for_duration_ = false; | 1466 is_tracing_startup_for_duration_ = false; |
| 1468 TracingController::GetInstance()->StopTracing( | 1467 TracingController::GetInstance()->StopTracing( |
| 1469 TracingController::CreateFileSink( | 1468 TracingController::CreateFileSink( |
| 1470 startup_trace_file_, | 1469 startup_trace_file_, |
| 1471 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1470 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
| 1472 } | 1471 } |
| 1473 | 1472 |
| 1474 } // namespace content | 1473 } // namespace content |
| OLD | NEW |