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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 #if !defined(OS_IOS) | 589 #if !defined(OS_IOS) |
590 // Start tracing to a file if needed. Only do this after starting the main | 590 // Start tracing to a file if needed. Only do this after starting the main |
591 // message loop to avoid calling MessagePumpForUI::ScheduleWork() before | 591 // message loop to avoid calling MessagePumpForUI::ScheduleWork() before |
592 // MessagePumpForUI::Start() as it will crash the browser. | 592 // MessagePumpForUI::Start() as it will crash the browser. |
593 if (is_tracing_startup_for_duration_) { | 593 if (is_tracing_startup_for_duration_) { |
594 TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracingForDuration"); | 594 TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracingForDuration"); |
595 InitStartupTracingForDuration(parsed_command_line_); | 595 InitStartupTracingForDuration(parsed_command_line_); |
596 } | 596 } |
597 #endif // !defined(OS_IOS) | 597 #endif // !defined(OS_IOS) |
598 | 598 |
599 #if defined(OS_ANDROID) | 599 #if defined(OS_ANDROID) && !defined(USE_AURA) |
no sievers
2015/10/22 20:55:40
revert this
mfomitchev
2015/11/02 21:51:15
Removed for SurfaceTextureManager, left for Screen
| |
600 { | 600 { |
601 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); | 601 TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SurfaceTextureManager"); |
602 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { | 602 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) { |
603 SurfaceTextureManager::SetInstance( | 603 SurfaceTextureManager::SetInstance( |
604 InProcessSurfaceTextureManager::GetInstance()); | 604 InProcessSurfaceTextureManager::GetInstance()); |
605 } else { | 605 } else { |
606 SurfaceTextureManager::SetInstance( | 606 SurfaceTextureManager::SetInstance( |
607 BrowserSurfaceTextureManager::GetInstance()); | 607 BrowserSurfaceTextureManager::GetInstance()); |
608 } | 608 } |
609 } | 609 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 startup_task_runner_->AddTask(create_threads); | 760 startup_task_runner_->AddTask(create_threads); |
761 | 761 |
762 StartupTask browser_thread_started = base::Bind( | 762 StartupTask browser_thread_started = base::Bind( |
763 &BrowserMainLoop::BrowserThreadsStarted, base::Unretained(this)); | 763 &BrowserMainLoop::BrowserThreadsStarted, base::Unretained(this)); |
764 startup_task_runner_->AddTask(browser_thread_started); | 764 startup_task_runner_->AddTask(browser_thread_started); |
765 | 765 |
766 StartupTask pre_main_message_loop_run = base::Bind( | 766 StartupTask pre_main_message_loop_run = base::Bind( |
767 &BrowserMainLoop::PreMainMessageLoopRun, base::Unretained(this)); | 767 &BrowserMainLoop::PreMainMessageLoopRun, base::Unretained(this)); |
768 startup_task_runner_->AddTask(pre_main_message_loop_run); | 768 startup_task_runner_->AddTask(pre_main_message_loop_run); |
769 | 769 |
770 #if defined(OS_ANDROID) | 770 #if defined(OS_ANDROID)// && !defined(USE_AURA) |
no sievers
2015/10/22 20:55:40
remove commented out code
mfomitchev
2015/11/02 21:51:15
Done.
| |
771 if (BrowserMayStartAsynchronously()) { | 771 if (BrowserMayStartAsynchronously()) { |
772 startup_task_runner_->StartRunningTasksAsync(); | 772 startup_task_runner_->StartRunningTasksAsync(); |
773 } | 773 } |
774 #endif | 774 #endif |
775 } | 775 } |
776 #if defined(OS_ANDROID) | 776 #if defined(OS_ANDROID)// && !defined(USE_AURA) |
777 if (!BrowserMayStartAsynchronously()) { | 777 if (!BrowserMayStartAsynchronously()) { |
no sievers
2015/10/22 20:55:40
remove commented out code
mfomitchev
2015/11/02 21:51:15
Done.
| |
778 // A second request for asynchronous startup can be ignored, so | 778 // A second request for asynchronous startup can be ignored, so |
779 // StartupRunningTasksAsync is only called first time through. If, however, | 779 // StartupRunningTasksAsync is only called first time through. If, however, |
780 // this is a request for synchronous startup then it must override any | 780 // this is a request for synchronous startup then it must override any |
781 // previous call for async startup, so we call RunAllTasksNow() | 781 // previous call for async startup, so we call RunAllTasksNow() |
782 // unconditionally. | 782 // unconditionally. |
783 startup_task_runner_->RunAllTasksNow(); | 783 startup_task_runner_->RunAllTasksNow(); |
784 } | 784 } |
785 #else | 785 #else |
786 startup_task_runner_->RunAllTasksNow(); | 786 startup_task_runner_->RunAllTasksNow(); |
787 #endif | 787 #endif |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1155 #if !defined(OS_IOS) | 1155 #if !defined(OS_IOS) |
1156 HistogramSynchronizer::GetInstance(); | 1156 HistogramSynchronizer::GetInstance(); |
1157 | 1157 |
1158 #if defined(OS_ANDROID) | 1158 #if defined(OS_ANDROID) |
1159 // Up the priority of the UI thread. | 1159 // Up the priority of the UI thread. |
1160 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 1160 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
1161 #endif | 1161 #endif |
1162 | 1162 |
1163 bool always_uses_gpu = true; | 1163 bool always_uses_gpu = true; |
1164 bool established_gpu_channel = false; | 1164 bool established_gpu_channel = false; |
1165 #if defined(OS_ANDROID) | 1165 // TODO(mfomitchev): Need ImageTransportFactory::Initialize on Android Aura, |
1166 // but figure out what to do with BrowserGpuChannelHostFactory. | |
no sievers
2015/10/22 20:55:40
remove these changes and TODO; it's ok to fall thr
mfomitchev
2015/11/02 21:51:15
What about set_context_factory below, don't we nee
| |
1167 #if defined(OS_ANDROID) && !defined(USE_AURA) | |
1166 // TODO(crbug.com/439322): This should be set to |true|. | 1168 // TODO(crbug.com/439322): This should be set to |true|. |
1167 established_gpu_channel = false; | 1169 established_gpu_channel = false; |
1168 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1170 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
1169 #elif defined(USE_AURA) || defined(OS_MACOSX) | 1171 #elif defined(USE_AURA) || defined(OS_MACOSX) |
1170 established_gpu_channel = true; | 1172 established_gpu_channel = true; |
1171 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || | 1173 if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor() || |
1172 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { | 1174 parsed_command_line_.HasSwitch(switches::kDisableGpuEarlyInit)) { |
1173 established_gpu_channel = always_uses_gpu = false; | 1175 established_gpu_channel = always_uses_gpu = false; |
1174 } | 1176 } |
1175 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); | 1177 BrowserGpuChannelHostFactory::Initialize(established_gpu_channel); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1351 if (command_line.HasSwitch(switches::kTraceStartup)) { | 1353 if (command_line.HasSwitch(switches::kTraceStartup)) { |
1352 trace_file = command_line.GetSwitchValuePath( | 1354 trace_file = command_line.GetSwitchValuePath( |
1353 switches::kTraceStartupFile); | 1355 switches::kTraceStartupFile); |
1354 // trace_file = "none" means that startup events will show up for the next | 1356 // trace_file = "none" means that startup events will show up for the next |
1355 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ | 1357 // begin/end tracing (via about:tracing or AutomationProxy::BeginTracing/ |
1356 // EndTracing, for example). | 1358 // EndTracing, for example). |
1357 if (trace_file == base::FilePath().AppendASCII("none")) | 1359 if (trace_file == base::FilePath().AppendASCII("none")) |
1358 return trace_file; | 1360 return trace_file; |
1359 | 1361 |
1360 if (trace_file.empty()) { | 1362 if (trace_file.empty()) { |
1361 #if defined(OS_ANDROID) | 1363 #if defined(OS_ANDROID) && !defined(USE_AURA) |
1362 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1364 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
1363 #else | 1365 #else |
1364 // Default to saving the startup trace into the current dir. | 1366 // Default to saving the startup trace into the current dir. |
1365 trace_file = base::FilePath().AppendASCII("chrometrace.log"); | 1367 trace_file = base::FilePath().AppendASCII("chrometrace.log"); |
1366 #endif | 1368 #endif |
1367 } | 1369 } |
1368 } else { | 1370 } else { |
1369 #if defined(OS_ANDROID) | 1371 #if defined(OS_ANDROID) && !defined(USE_AURA) |
1370 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); | 1372 TracingControllerAndroid::GenerateTracingFilePath(&trace_file); |
1371 #else | 1373 #else |
1372 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); | 1374 trace_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); |
1373 #endif | 1375 #endif |
1374 } | 1376 } |
1375 | 1377 |
1376 return trace_file; | 1378 return trace_file; |
1377 } | 1379 } |
1378 | 1380 |
1379 void BrowserMainLoop::InitStartupTracingForDuration( | 1381 void BrowserMainLoop::InitStartupTracingForDuration( |
(...skipping 28 matching lines...) Expand all Loading... | |
1408 DCHECK(is_tracing_startup_for_duration_); | 1410 DCHECK(is_tracing_startup_for_duration_); |
1409 | 1411 |
1410 is_tracing_startup_for_duration_ = false; | 1412 is_tracing_startup_for_duration_ = false; |
1411 TracingController::GetInstance()->DisableRecording( | 1413 TracingController::GetInstance()->DisableRecording( |
1412 TracingController::CreateFileSink( | 1414 TracingController::CreateFileSink( |
1413 startup_trace_file_, | 1415 startup_trace_file_, |
1414 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1416 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1415 } | 1417 } |
1416 | 1418 |
1417 } // namespace content | 1419 } // namespace content |
OLD | NEW |