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 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 result_code_(RESULT_CODE_NORMAL_EXIT), | 525 result_code_(RESULT_CODE_NORMAL_EXIT), |
526 created_threads_(false), | 526 created_threads_(false), |
527 // ContentMainRunner should have enabled tracing of the browser process | 527 // ContentMainRunner should have enabled tracing of the browser process |
528 // when kTraceStartup or kTraceConfigFile is in the command line. | 528 // when kTraceStartup or kTraceConfigFile is in the command line. |
529 is_tracing_startup_for_duration_( | 529 is_tracing_startup_for_duration_( |
530 parameters.command_line.HasSwitch(switches::kTraceStartup) || | 530 parameters.command_line.HasSwitch(switches::kTraceStartup) || |
531 (tracing::TraceConfigFile::GetInstance()->IsEnabled() && | 531 (tracing::TraceConfigFile::GetInstance()->IsEnabled() && |
532 tracing::TraceConfigFile::GetInstance()->GetStartupDuration() > 0)) { | 532 tracing::TraceConfigFile::GetInstance()->GetStartupDuration() > 0)) { |
533 DCHECK(!g_current_browser_main_loop); | 533 DCHECK(!g_current_browser_main_loop); |
534 g_current_browser_main_loop = this; | 534 g_current_browser_main_loop = this; |
535 | |
536 base::TaskScheduler::Create(""); | |
robliao
2017/04/24 18:15:54
Should we be more aggressive about the creation po
gab
2017/04/25 15:29:15
Agreed for ASAP but this is essentially the same l
robliao
2017/04/25 17:21:30
I think this change is fine for now, but given tha
| |
535 } | 537 } |
536 | 538 |
robliao
2017/04/25 17:21:30
Document the use of "".
| |
537 BrowserMainLoop::~BrowserMainLoop() { | 539 BrowserMainLoop::~BrowserMainLoop() { |
538 DCHECK_EQ(this, g_current_browser_main_loop); | 540 DCHECK_EQ(this, g_current_browser_main_loop); |
539 ui::Clipboard::DestroyClipboardForCurrentThread(); | 541 ui::Clipboard::DestroyClipboardForCurrentThread(); |
540 g_current_browser_main_loop = NULL; | 542 g_current_browser_main_loop = NULL; |
541 } | 543 } |
542 | 544 |
543 void BrowserMainLoop::Init() { | 545 void BrowserMainLoop::Init() { |
544 TRACE_EVENT0("startup", "BrowserMainLoop::Init"); | 546 TRACE_EVENT0("startup", "BrowserMainLoop::Init"); |
545 | 547 |
546 parts_.reset( | 548 parts_.reset( |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
945 startup_task_runner_->RunAllTasksNow(); | 947 startup_task_runner_->RunAllTasksNow(); |
946 } | 948 } |
947 #else | 949 #else |
948 startup_task_runner_->RunAllTasksNow(); | 950 startup_task_runner_->RunAllTasksNow(); |
949 #endif | 951 #endif |
950 } | 952 } |
951 | 953 |
952 int BrowserMainLoop::CreateThreads() { | 954 int BrowserMainLoop::CreateThreads() { |
953 TRACE_EVENT0("startup,rail", "BrowserMainLoop::CreateThreads"); | 955 TRACE_EVENT0("startup,rail", "BrowserMainLoop::CreateThreads"); |
954 | 956 |
955 auto task_scheduler_init_params = | 957 { |
956 GetContentClient()->browser()->GetTaskSchedulerInitParams(); | 958 auto task_scheduler_init_params = |
957 if (!task_scheduler_init_params) | 959 GetContentClient()->browser()->GetTaskSchedulerInitParams(); |
958 task_scheduler_init_params = GetDefaultTaskSchedulerInitParams(); | 960 if (!task_scheduler_init_params) |
959 DCHECK(task_scheduler_init_params); | 961 task_scheduler_init_params = GetDefaultTaskSchedulerInitParams(); |
960 | 962 DCHECK(task_scheduler_init_params); |
961 base::TaskScheduler::CreateAndSetDefaultTaskScheduler( | 963 base::TaskScheduler::GetInstance()->Start( |
962 "", *task_scheduler_init_params.get()); | 964 *task_scheduler_init_params.get()); |
965 } | |
963 | 966 |
964 GetContentClient()->browser()->PerformExperimentalTaskSchedulerRedirections(); | 967 GetContentClient()->browser()->PerformExperimentalTaskSchedulerRedirections(); |
965 | 968 |
966 base::Thread::Options io_message_loop_options; | 969 base::Thread::Options io_message_loop_options; |
967 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; | 970 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; |
968 base::Thread::Options ui_message_loop_options; | 971 base::Thread::Options ui_message_loop_options; |
969 ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; | 972 ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; |
970 | 973 |
971 const bool redirect_nonUInonIO_browser_threads = | 974 const bool redirect_nonUInonIO_browser_threads = |
972 GetContentClient() | 975 GetContentClient() |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1752 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 1755 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
1753 MediaInternals::GetInstance()); | 1756 MediaInternals::GetInstance()); |
1754 } | 1757 } |
1755 CHECK(audio_manager_); | 1758 CHECK(audio_manager_); |
1756 | 1759 |
1757 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1760 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
1758 CHECK(audio_system_); | 1761 CHECK(audio_system_); |
1759 } | 1762 } |
1760 | 1763 |
1761 } // namespace content | 1764 } // namespace content |
OLD | NEW |