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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 702 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
703 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); | 703 sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); |
704 } | 704 } |
705 | 705 |
706 int BrowserMainLoop::PreCreateThreads() { | 706 int BrowserMainLoop::PreCreateThreads() { |
707 if (parts_) { | 707 if (parts_) { |
708 TRACE_EVENT0("startup", | 708 TRACE_EVENT0("startup", |
709 "BrowserMainLoop::CreateThreads:PreCreateThreads"); | 709 "BrowserMainLoop::CreateThreads:PreCreateThreads"); |
710 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::PreCreateThreads"); | 710 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::PreCreateThreads"); |
711 | 711 |
712 result_code_ = parts_->PreCreateThreads(); | 712 result_code_ = parts_->PreCreateThreadsBegin(); |
713 } | 713 } |
714 | 714 |
715 // Initialize an instance of FeatureList. This will be a no-op if an instance | 715 // Initialize an instance of FeatureList. This will be a no-op if an instance |
716 // was already set up by the embedder. | 716 // was already set up by the embedder. |
717 base::FeatureList::InitializeInstance(); | 717 base::FeatureList::InitializeInstance(); |
718 | 718 |
719 // TODO(chrisha): Abstract away this construction mess to a helper function, | 719 // TODO(chrisha): Abstract away this construction mess to a helper function, |
720 // once MemoryPressureMonitor is made a concrete class. | 720 // once MemoryPressureMonitor is made a concrete class. |
721 #if defined(OS_CHROMEOS) | 721 #if defined(OS_CHROMEOS) |
722 if (chromeos::switches::MemoryPressureHandlingEnabled()) { | 722 if (chromeos::switches::MemoryPressureHandlingEnabled()) { |
(...skipping 21 matching lines...) Expand all Loading... |
744 #if defined(OS_MACOSX) && !defined(OS_IOS) | 744 #if defined(OS_MACOSX) && !defined(OS_IOS) |
745 // The WindowResizeHelper allows the UI thread to wait on specific renderer | 745 // The WindowResizeHelper allows the UI thread to wait on specific renderer |
746 // and GPU messages from the IO thread. Initializing it before the IO thread | 746 // and GPU messages from the IO thread. Initializing it before the IO thread |
747 // starts ensures the affected IO thread messages always have somewhere to go. | 747 // starts ensures the affected IO thread messages always have somewhere to go. |
748 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); | 748 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); |
749 #endif | 749 #endif |
750 | 750 |
751 // 1) Need to initialize in-process GpuDataManager before creating threads. | 751 // 1) Need to initialize in-process GpuDataManager before creating threads. |
752 // It's unsafe to append the gpu command line switches to the global | 752 // It's unsafe to append the gpu command line switches to the global |
753 // CommandLine::ForCurrentProcess object after threads are created. | 753 // CommandLine::ForCurrentProcess object after threads are created. |
754 // 2) Must be after parts_->PreCreateThreads to pick up chrome://flags. | 754 // 2) Must be after parts_->PreCreateThreadsBegin to pick up chrome://flags. |
755 GpuDataManagerImpl::GetInstance()->Initialize(); | 755 GpuDataManagerImpl::GetInstance()->Initialize(); |
756 | 756 |
757 #if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) | 757 #if !defined(OS_IOS) && (!defined(GOOGLE_CHROME_BUILD) || defined(OS_ANDROID)) |
758 // Single-process is an unsupported and not fully tested mode, so | 758 // Single-process is an unsupported and not fully tested mode, so |
759 // don't enable it for official Chrome builds (except on Android). | 759 // don't enable it for official Chrome builds (except on Android). |
760 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) | 760 if (parsed_command_line_.HasSwitch(switches::kSingleProcess)) |
761 RenderProcessHost::SetRunRendererInProcess(true); | 761 RenderProcessHost::SetRunRendererInProcess(true); |
762 #endif | 762 #endif |
763 | 763 |
| 764 // parts may want to do some processing just before actually starting the |
| 765 // threads. |
| 766 if (parts_) |
| 767 parts_->PreCreateThreadsEnd(); |
| 768 |
764 return result_code_; | 769 return result_code_; |
765 } | 770 } |
766 | 771 |
767 void BrowserMainLoop::CreateStartupTasks() { | 772 void BrowserMainLoop::CreateStartupTasks() { |
768 TRACE_EVENT0("startup", "BrowserMainLoop::CreateStartupTasks"); | 773 TRACE_EVENT0("startup", "BrowserMainLoop::CreateStartupTasks"); |
769 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::CreateStartupTasks"); | 774 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::CreateStartupTasks"); |
770 | 775 |
771 // First time through, we really want to create all the tasks | 776 // First time through, we really want to create all the tasks |
772 if (!startup_task_runner_.get()) { | 777 if (!startup_task_runner_.get()) { |
773 #if defined(OS_ANDROID) | 778 #if defined(OS_ANDROID) |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 DCHECK(is_tracing_startup_for_duration_); | 1469 DCHECK(is_tracing_startup_for_duration_); |
1465 | 1470 |
1466 is_tracing_startup_for_duration_ = false; | 1471 is_tracing_startup_for_duration_ = false; |
1467 TracingController::GetInstance()->StopTracing( | 1472 TracingController::GetInstance()->StopTracing( |
1468 TracingController::CreateFileSink( | 1473 TracingController::CreateFileSink( |
1469 startup_trace_file_, | 1474 startup_trace_file_, |
1470 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1475 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1471 } | 1476 } |
1472 | 1477 |
1473 } // namespace content | 1478 } // namespace content |
OLD | NEW |