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