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