| 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 18 matching lines...) Expand all Loading... |
| 29 #include "base/power_monitor/power_monitor_device_source.h" | 29 #include "base/power_monitor/power_monitor_device_source.h" |
| 30 #include "base/process/process_metrics.h" | 30 #include "base/process/process_metrics.h" |
| 31 #include "base/run_loop.h" | 31 #include "base/run_loop.h" |
| 32 #include "base/single_thread_task_runner.h" | 32 #include "base/single_thread_task_runner.h" |
| 33 #include "base/strings/string_number_conversions.h" | 33 #include "base/strings/string_number_conversions.h" |
| 34 #include "base/strings/string_split.h" | 34 #include "base/strings/string_split.h" |
| 35 #include "base/synchronization/waitable_event.h" | 35 #include "base/synchronization/waitable_event.h" |
| 36 #include "base/system_monitor/system_monitor.h" | 36 #include "base/system_monitor/system_monitor.h" |
| 37 #include "base/task_scheduler/initialization_util.h" | 37 #include "base/task_scheduler/initialization_util.h" |
| 38 #include "base/task_scheduler/post_task.h" | 38 #include "base/task_scheduler/post_task.h" |
| 39 #include "base/task_scheduler/single_thread_task_runner_thread_mode.h" |
| 39 #include "base/task_scheduler/task_scheduler.h" | 40 #include "base/task_scheduler/task_scheduler.h" |
| 40 #include "base/task_scheduler/task_traits.h" | 41 #include "base/task_scheduler/task_traits.h" |
| 41 #include "base/threading/sequenced_worker_pool.h" | 42 #include "base/threading/sequenced_worker_pool.h" |
| 42 #include "base/threading/thread_restrictions.h" | 43 #include "base/threading/thread_restrictions.h" |
| 43 #include "base/threading/thread_task_runner_handle.h" | 44 #include "base/threading/thread_task_runner_handle.h" |
| 44 #include "base/time/time.h" | 45 #include "base/time/time.h" |
| 45 #include "base/timer/hi_res_timer_manager.h" | 46 #include "base/timer/hi_res_timer_manager.h" |
| 46 #include "base/trace_event/memory_dump_manager.h" | 47 #include "base/trace_event/memory_dump_manager.h" |
| 47 #include "base/trace_event/trace_event.h" | 48 #include "base/trace_event/trace_event.h" |
| 48 #include "build/build_config.h" | 49 #include "build/build_config.h" |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 LOG(FATAL) << "Failed to start the browser thread: id == " << id; | 1130 LOG(FATAL) << "Failed to start the browser thread: id == " << id; |
| 1130 } else { | 1131 } else { |
| 1131 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner; | 1132 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner; |
| 1132 #if defined(OS_WIN) | 1133 #if defined(OS_WIN) |
| 1133 // On Windows, the FILE thread needs to have a UI message loop which | 1134 // On Windows, the FILE thread needs to have a UI message loop which |
| 1134 // pumps messages in such a way that Google Update can communicate back | 1135 // pumps messages in such a way that Google Update can communicate back |
| 1135 // to us. The COM STA task runner provides this service. | 1136 // to us. The COM STA task runner provides this service. |
| 1136 redirection_task_runner = | 1137 redirection_task_runner = |
| 1137 (thread_id == BrowserThread::FILE) | 1138 (thread_id == BrowserThread::FILE) |
| 1138 ? base::CreateCOMSTATaskRunnerWithTraits( | 1139 ? base::CreateCOMSTATaskRunnerWithTraits( |
| 1139 non_ui_non_io_task_runner_traits) | 1140 non_ui_non_io_task_runner_traits, |
| 1141 base::SingleThreadTaskRunnerThreadMode::DEDICATED) |
| 1140 : base::CreateSingleThreadTaskRunnerWithTraits( | 1142 : base::CreateSingleThreadTaskRunnerWithTraits( |
| 1141 non_ui_non_io_task_runner_traits); | 1143 non_ui_non_io_task_runner_traits, |
| 1144 base::SingleThreadTaskRunnerThreadMode::DEDICATED); |
| 1142 #else // defined(OS_WIN) | 1145 #else // defined(OS_WIN) |
| 1143 redirection_task_runner = base::CreateSingleThreadTaskRunnerWithTraits( | 1146 redirection_task_runner = base::CreateSingleThreadTaskRunnerWithTraits( |
| 1144 non_ui_non_io_task_runner_traits); | 1147 non_ui_non_io_task_runner_traits, |
| 1148 base::SingleThreadTaskRunnerThreadMode::DEDICATED); |
| 1145 #endif // defined(OS_WIN) | 1149 #endif // defined(OS_WIN) |
| 1146 DCHECK(redirection_task_runner); | 1150 DCHECK(redirection_task_runner); |
| 1147 BrowserThreadImpl::RedirectThreadIDToTaskRunner( | 1151 BrowserThreadImpl::RedirectThreadIDToTaskRunner( |
| 1148 id, std::move(redirection_task_runner)); | 1152 id, std::move(redirection_task_runner)); |
| 1149 } | 1153 } |
| 1150 | 1154 |
| 1151 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 1155 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
| 1152 } | 1156 } |
| 1153 created_threads_ = true; | 1157 created_threads_ = true; |
| 1154 return result_code_; | 1158 return result_code_; |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 1779 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), |
| 1776 MediaInternals::GetInstance()); | 1780 MediaInternals::GetInstance()); |
| 1777 } | 1781 } |
| 1778 CHECK(audio_manager_); | 1782 CHECK(audio_manager_); |
| 1779 | 1783 |
| 1780 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1784 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1781 CHECK(audio_system_); | 1785 CHECK(audio_system_); |
| 1782 } | 1786 } |
| 1783 | 1787 |
| 1784 } // namespace content | 1788 } // namespace content |
| OLD | NEW |