| 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 12 matching lines...) Expand all Loading... |
| 23 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
| 24 #include "base/metrics/user_metrics.h" | 24 #include "base/metrics/user_metrics.h" |
| 25 #include "base/pending_task.h" | 25 #include "base/pending_task.h" |
| 26 #include "base/power_monitor/power_monitor.h" | 26 #include "base/power_monitor/power_monitor.h" |
| 27 #include "base/power_monitor/power_monitor_device_source.h" | 27 #include "base/power_monitor/power_monitor_device_source.h" |
| 28 #include "base/process/process_metrics.h" | 28 #include "base/process/process_metrics.h" |
| 29 #include "base/run_loop.h" | 29 #include "base/run_loop.h" |
| 30 #include "base/single_thread_task_runner.h" | 30 #include "base/single_thread_task_runner.h" |
| 31 #include "base/strings/string_number_conversions.h" | 31 #include "base/strings/string_number_conversions.h" |
| 32 #include "base/strings/string_split.h" | 32 #include "base/strings/string_split.h" |
| 33 #include "base/synchronization/waitable_event.h" |
| 33 #include "base/system_monitor/system_monitor.h" | 34 #include "base/system_monitor/system_monitor.h" |
| 34 #include "base/task_scheduler/initialization_util.h" | 35 #include "base/task_scheduler/initialization_util.h" |
| 36 #include "base/task_scheduler/post_task.h" |
| 35 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 37 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
| 36 #include "base/task_scheduler/task_scheduler.h" | 38 #include "base/task_scheduler/task_scheduler.h" |
| 37 #include "base/task_scheduler/task_traits.h" | 39 #include "base/task_scheduler/task_traits.h" |
| 38 #include "base/threading/sequenced_worker_pool.h" | 40 #include "base/threading/sequenced_worker_pool.h" |
| 39 #include "base/threading/thread_restrictions.h" | 41 #include "base/threading/thread_restrictions.h" |
| 40 #include "base/threading/thread_task_runner_handle.h" | 42 #include "base/threading/thread_task_runner_handle.h" |
| 41 #include "base/time/time.h" | 43 #include "base/time/time.h" |
| 42 #include "base/timer/hi_res_timer_manager.h" | 44 #include "base/timer/hi_res_timer_manager.h" |
| 43 #include "base/trace_event/memory_dump_manager.h" | 45 #include "base/trace_event/memory_dump_manager.h" |
| 44 #include "base/trace_event/trace_event.h" | 46 #include "base/trace_event/trace_event.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 304 |
| 303 // Disable optimizations for this block of functions so the compiler doesn't | 305 // Disable optimizations for this block of functions so the compiler doesn't |
| 304 // merge them all together. This makes it possible to tell what thread was | 306 // merge them all together. This makes it possible to tell what thread was |
| 305 // unresponsive by inspecting the callstack. | 307 // unresponsive by inspecting the callstack. |
| 306 MSVC_DISABLE_OPTIMIZE() | 308 MSVC_DISABLE_OPTIMIZE() |
| 307 MSVC_PUSH_DISABLE_WARNING(4748) | 309 MSVC_PUSH_DISABLE_WARNING(4748) |
| 308 | 310 |
| 309 NOINLINE void ResetThread_DB(std::unique_ptr<BrowserProcessSubThread> thread) { | 311 NOINLINE void ResetThread_DB(std::unique_ptr<BrowserProcessSubThread> thread) { |
| 310 volatile int inhibit_comdat = __LINE__; | 312 volatile int inhibit_comdat = __LINE__; |
| 311 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 313 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 312 thread.reset(); | 314 if (thread) { |
| 315 thread.reset(); |
| 316 } else { |
| 317 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::DB); |
| 318 } |
| 313 } | 319 } |
| 314 | 320 |
| 315 NOINLINE void ResetThread_FILE( | 321 NOINLINE void ResetThread_FILE( |
| 316 std::unique_ptr<BrowserProcessSubThread> thread) { | 322 std::unique_ptr<BrowserProcessSubThread> thread) { |
| 317 volatile int inhibit_comdat = __LINE__; | 323 volatile int inhibit_comdat = __LINE__; |
| 318 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 324 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 319 thread.reset(); | 325 if (thread) { |
| 326 thread.reset(); |
| 327 } else { |
| 328 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::FILE); |
| 329 } |
| 320 } | 330 } |
| 321 | 331 |
| 322 NOINLINE void ResetThread_FILE_USER_BLOCKING( | 332 NOINLINE void ResetThread_FILE_USER_BLOCKING( |
| 323 std::unique_ptr<BrowserProcessSubThread> thread) { | 333 std::unique_ptr<BrowserProcessSubThread> thread) { |
| 324 volatile int inhibit_comdat = __LINE__; | 334 volatile int inhibit_comdat = __LINE__; |
| 325 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 335 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 326 thread.reset(); | 336 if (thread) { |
| 337 thread.reset(); |
| 338 } else { |
| 339 BrowserThreadImpl::StopRedirectionOfThreadID( |
| 340 BrowserThread::FILE_USER_BLOCKING); |
| 341 } |
| 327 } | 342 } |
| 328 | 343 |
| 329 NOINLINE void ResetThread_PROCESS_LAUNCHER( | 344 NOINLINE void ResetThread_PROCESS_LAUNCHER( |
| 330 std::unique_ptr<BrowserProcessSubThread> thread) { | 345 std::unique_ptr<BrowserProcessSubThread> thread) { |
| 331 volatile int inhibit_comdat = __LINE__; | 346 volatile int inhibit_comdat = __LINE__; |
| 332 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 347 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 333 thread.reset(); | 348 if (thread) { |
| 349 thread.reset(); |
| 350 } else { |
| 351 BrowserThreadImpl::StopRedirectionOfThreadID( |
| 352 BrowserThread::PROCESS_LAUNCHER); |
| 353 } |
| 334 } | 354 } |
| 335 | 355 |
| 336 NOINLINE void ResetThread_CACHE( | 356 NOINLINE void ResetThread_CACHE( |
| 337 std::unique_ptr<BrowserProcessSubThread> thread) { | 357 std::unique_ptr<BrowserProcessSubThread> thread) { |
| 338 volatile int inhibit_comdat = __LINE__; | 358 volatile int inhibit_comdat = __LINE__; |
| 339 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 359 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 340 thread.reset(); | 360 if (thread) { |
| 361 thread.reset(); |
| 362 } else { |
| 363 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::CACHE); |
| 364 } |
| 341 } | 365 } |
| 342 | 366 |
| 343 NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { | 367 NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { |
| 344 volatile int inhibit_comdat = __LINE__; | 368 volatile int inhibit_comdat = __LINE__; |
| 345 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 369 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 346 thread.reset(); | 370 thread.reset(); |
| 347 } | 371 } |
| 348 | 372 |
| 349 NOINLINE void ResetThread_IndexedDb(std::unique_ptr<base::Thread> thread) { | 373 NOINLINE void ResetThread_IndexedDb(std::unique_ptr<base::Thread> thread) { |
| 350 volatile int inhibit_comdat = __LINE__; | 374 volatile int inhibit_comdat = __LINE__; |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 base::TaskScheduler::CreateAndSetDefaultTaskScheduler( | 980 base::TaskScheduler::CreateAndSetDefaultTaskScheduler( |
| 957 params_vector, index_to_traits_callback); | 981 params_vector, index_to_traits_callback); |
| 958 | 982 |
| 959 GetContentClient()->browser()->PerformExperimentalTaskSchedulerRedirections(); | 983 GetContentClient()->browser()->PerformExperimentalTaskSchedulerRedirections(); |
| 960 | 984 |
| 961 base::Thread::Options io_message_loop_options; | 985 base::Thread::Options io_message_loop_options; |
| 962 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; | 986 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 963 base::Thread::Options ui_message_loop_options; | 987 base::Thread::Options ui_message_loop_options; |
| 964 ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; | 988 ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; |
| 965 | 989 |
| 966 // Start threads in the order they occur in the BrowserThread::ID | 990 const bool redirect_nonUInonIO_browser_threads = |
| 967 // enumeration, except for BrowserThread::UI which is the main | 991 GetContentClient() |
| 968 // thread. | 992 ->browser() |
| 993 ->RedirectNonUINonIOBrowserThreadsToTaskScheduler(); |
| 994 |
| 995 // Start threads in the order they occur in the BrowserThread::ID enumeration, |
| 996 // except for BrowserThread::UI which is the main thread. |
| 969 // | 997 // |
| 970 // Must be size_t so we can increment it. | 998 // Must be size_t so we can increment it. |
| 971 for (size_t thread_id = BrowserThread::UI + 1; | 999 for (size_t thread_id = BrowserThread::UI + 1; |
| 972 thread_id < BrowserThread::ID_COUNT; | 1000 thread_id < BrowserThread::ID_COUNT; |
| 973 ++thread_id) { | 1001 ++thread_id) { |
| 974 std::unique_ptr<BrowserProcessSubThread>* thread_to_start = NULL; | 1002 // If this thread ID is backed by a real thread, |thread_to_start| will be |
| 1003 // set to the appropriate BrowserProcessSubThread*. And |options| can be |
| 1004 // updated away from its default. |
| 1005 std::unique_ptr<BrowserProcessSubThread>* thread_to_start = nullptr; |
| 975 base::Thread::Options options; | 1006 base::Thread::Options options; |
| 976 | 1007 |
| 1008 // Otherwise this thread ID will be backed by a SingleThreadTaskRunner using |
| 1009 // |non_ui_non_io_task_runner_traits| (which can be augmented below). |
| 1010 // TODO(gab): Existing non-UI/non-IO BrowserThreads allow waiting so the |
| 1011 // initial redirection will as well but they probably don't need to. |
| 1012 base::TaskTraits non_ui_non_io_task_runner_traits = |
| 1013 base::TaskTraits().WithFileIO().WithWait(); |
| 1014 |
| 977 switch (thread_id) { | 1015 switch (thread_id) { |
| 978 case BrowserThread::DB: | 1016 case BrowserThread::DB: |
| 979 TRACE_EVENT_BEGIN1("startup", | 1017 TRACE_EVENT_BEGIN1("startup", |
| 980 "BrowserMainLoop::CreateThreads:start", | 1018 "BrowserMainLoop::CreateThreads:start", |
| 981 "Thread", "BrowserThread::DB"); | 1019 "Thread", "BrowserThread::DB"); |
| 982 thread_to_start = &db_thread_; | 1020 if (redirect_nonUInonIO_browser_threads) { |
| 983 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 1021 non_ui_non_io_task_runner_traits |
| 1022 .WithPriority(base::TaskPriority::USER_VISIBLE) |
| 1023 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); |
| 1024 } else { |
| 1025 thread_to_start = &db_thread_; |
| 1026 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 1027 } |
| 984 break; | 1028 break; |
| 985 case BrowserThread::FILE_USER_BLOCKING: | 1029 case BrowserThread::FILE_USER_BLOCKING: |
| 986 TRACE_EVENT_BEGIN1("startup", | 1030 TRACE_EVENT_BEGIN1("startup", |
| 987 "BrowserMainLoop::CreateThreads:start", | 1031 "BrowserMainLoop::CreateThreads:start", |
| 988 "Thread", "BrowserThread::FILE_USER_BLOCKING"); | 1032 "Thread", "BrowserThread::FILE_USER_BLOCKING"); |
| 989 thread_to_start = &file_user_blocking_thread_; | 1033 if (redirect_nonUInonIO_browser_threads) { |
| 1034 non_ui_non_io_task_runner_traits |
| 1035 .WithPriority(base::TaskPriority::USER_BLOCKING) |
| 1036 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); |
| 1037 } else { |
| 1038 thread_to_start = &file_user_blocking_thread_; |
| 1039 } |
| 990 break; | 1040 break; |
| 991 case BrowserThread::FILE: | 1041 case BrowserThread::FILE: |
| 992 TRACE_EVENT_BEGIN1("startup", | 1042 TRACE_EVENT_BEGIN1("startup", |
| 993 "BrowserMainLoop::CreateThreads:start", | 1043 "BrowserMainLoop::CreateThreads:start", |
| 994 "Thread", "BrowserThread::FILE"); | 1044 "Thread", "BrowserThread::FILE"); |
| 1045 |
| 1046 #if defined(OS_WIN) |
| 1047 // On Windows, the FILE thread needs to have a UI message loop which |
| 1048 // pumps messages in such a way that Google Update can communicate back |
| 1049 // to us. |
| 1050 // TODO(robliao): Need to support COM in TaskScheduler before |
| 1051 // redirecting the FILE thread on Windows. http://crbug.com/662122 |
| 995 thread_to_start = &file_thread_; | 1052 thread_to_start = &file_thread_; |
| 996 #if defined(OS_WIN) | |
| 997 // On Windows, the FILE thread needs to be have a UI message loop | |
| 998 // which pumps messages in such a way that Google Update can | |
| 999 // communicate back to us. | |
| 1000 options = ui_message_loop_options; | 1053 options = ui_message_loop_options; |
| 1001 #else | 1054 #else |
| 1002 options = io_message_loop_options; | 1055 if (redirect_nonUInonIO_browser_threads) { |
| 1056 non_ui_non_io_task_runner_traits |
| 1057 .WithPriority(base::TaskPriority::BACKGROUND) |
| 1058 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); |
| 1059 } else { |
| 1060 thread_to_start = &file_thread_; |
| 1061 options = io_message_loop_options; |
| 1062 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 1063 } |
| 1003 #endif | 1064 #endif |
| 1004 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | |
| 1005 break; | 1065 break; |
| 1006 case BrowserThread::PROCESS_LAUNCHER: | 1066 case BrowserThread::PROCESS_LAUNCHER: |
| 1007 TRACE_EVENT_BEGIN1("startup", | 1067 TRACE_EVENT_BEGIN1("startup", |
| 1008 "BrowserMainLoop::CreateThreads:start", | 1068 "BrowserMainLoop::CreateThreads:start", |
| 1009 "Thread", "BrowserThread::PROCESS_LAUNCHER"); | 1069 "Thread", "BrowserThread::PROCESS_LAUNCHER"); |
| 1010 thread_to_start = &process_launcher_thread_; | 1070 if (redirect_nonUInonIO_browser_threads) { |
| 1011 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 1071 non_ui_non_io_task_runner_traits |
| 1072 .WithPriority(base::TaskPriority::USER_BLOCKING) |
| 1073 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); |
| 1074 } else { |
| 1075 thread_to_start = &process_launcher_thread_; |
| 1076 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 1077 } |
| 1012 break; | 1078 break; |
| 1013 case BrowserThread::CACHE: | 1079 case BrowserThread::CACHE: |
| 1014 TRACE_EVENT_BEGIN1("startup", | 1080 TRACE_EVENT_BEGIN1("startup", |
| 1015 "BrowserMainLoop::CreateThreads:start", | 1081 "BrowserMainLoop::CreateThreads:start", |
| 1016 "Thread", "BrowserThread::CACHE"); | 1082 "Thread", "BrowserThread::CACHE"); |
| 1083 #if defined(OS_WIN) |
| 1084 // TaskScheduler doesn't support async I/O on Windows as CACHE thread is |
| 1085 // the only user and this use case is going away in |
| 1086 // https://codereview.chromium.org/2216583003/. |
| 1087 // TODO(gavinp): Remove this ifdef (and thus enable redirection of the |
| 1088 // CACHE thread on Windows) once that CL lands. |
| 1017 thread_to_start = &cache_thread_; | 1089 thread_to_start = &cache_thread_; |
| 1018 #if defined(OS_WIN) | |
| 1019 options = io_message_loop_options; | 1090 options = io_message_loop_options; |
| 1020 #endif // defined(OS_WIN) | |
| 1021 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 1091 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 1092 #else // OS_WIN |
| 1093 if (redirect_nonUInonIO_browser_threads) { |
| 1094 non_ui_non_io_task_runner_traits |
| 1095 .WithPriority(base::TaskPriority::USER_BLOCKING) |
| 1096 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); |
| 1097 } else { |
| 1098 thread_to_start = &cache_thread_; |
| 1099 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 1100 } |
| 1101 #endif // OS_WIN |
| 1022 break; | 1102 break; |
| 1023 case BrowserThread::IO: | 1103 case BrowserThread::IO: |
| 1024 TRACE_EVENT_BEGIN1("startup", | 1104 TRACE_EVENT_BEGIN1("startup", |
| 1025 "BrowserMainLoop::CreateThreads:start", | 1105 "BrowserMainLoop::CreateThreads:start", |
| 1026 "Thread", "BrowserThread::IO"); | 1106 "Thread", "BrowserThread::IO"); |
| 1027 thread_to_start = &io_thread_; | 1107 thread_to_start = &io_thread_; |
| 1028 options = io_message_loop_options; | 1108 options = io_message_loop_options; |
| 1029 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 1109 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 1030 // Up the priority of the |io_thread_| as some of its IPCs relate to | 1110 // Up the priority of the |io_thread_| as some of its IPCs relate to |
| 1031 // display tasks. | 1111 // display tasks. |
| 1032 options.priority = base::ThreadPriority::DISPLAY; | 1112 options.priority = base::ThreadPriority::DISPLAY; |
| 1033 #endif | 1113 #endif |
| 1034 break; | 1114 break; |
| 1035 case BrowserThread::UI: | 1115 case BrowserThread::UI: // Falls through. |
| 1036 case BrowserThread::ID_COUNT: | 1116 case BrowserThread::ID_COUNT: // Falls through. |
| 1037 default: | |
| 1038 NOTREACHED(); | 1117 NOTREACHED(); |
| 1039 break; | 1118 break; |
| 1040 } | 1119 } |
| 1041 | 1120 |
| 1042 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 1121 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
| 1043 | 1122 |
| 1044 if (thread_to_start) { | 1123 if (thread_to_start) { |
| 1045 (*thread_to_start).reset(new BrowserProcessSubThread(id)); | 1124 (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
| 1046 if (!(*thread_to_start)->StartWithOptions(options)) { | 1125 if (!(*thread_to_start)->StartWithOptions(options)) |
| 1047 LOG(FATAL) << "Failed to start the browser thread: id == " << id; | 1126 LOG(FATAL) << "Failed to start the browser thread: id == " << id; |
| 1048 } | |
| 1049 } else { | 1127 } else { |
| 1050 NOTREACHED(); | 1128 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner = |
| 1129 base::CreateSingleThreadTaskRunnerWithTraits( |
| 1130 non_ui_non_io_task_runner_traits); |
| 1131 DCHECK(redirection_task_runner); |
| 1132 BrowserThreadImpl::RedirectThreadIDToTaskRunner( |
| 1133 id, std::move(redirection_task_runner)); |
| 1051 } | 1134 } |
| 1052 | 1135 |
| 1053 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 1136 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
| 1054 } | 1137 } |
| 1055 created_threads_ = true; | 1138 created_threads_ = true; |
| 1056 return result_code_; | 1139 return result_code_; |
| 1057 } | 1140 } |
| 1058 | 1141 |
| 1059 int BrowserMainLoop::PreMainMessageLoopRun() { | 1142 int BrowserMainLoop::PreMainMessageLoopRun() { |
| 1060 #if defined(OS_ANDROID) | 1143 #if defined(OS_ANDROID) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 // | 1279 // |
| 1197 // - (Not sure why DB stops last.) | 1280 // - (Not sure why DB stops last.) |
| 1198 switch (thread_id) { | 1281 switch (thread_id) { |
| 1199 case BrowserThread::DB: { | 1282 case BrowserThread::DB: { |
| 1200 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread"); | 1283 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread"); |
| 1201 ResetThread_DB(std::move(db_thread_)); | 1284 ResetThread_DB(std::move(db_thread_)); |
| 1202 break; | 1285 break; |
| 1203 } | 1286 } |
| 1204 case BrowserThread::FILE: { | 1287 case BrowserThread::FILE: { |
| 1205 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread"); | 1288 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread"); |
| 1206 // Clean up state that lives on or uses the file_thread_ before | 1289 // Clean up state that lives on or uses the FILE thread before it goes |
| 1207 // it goes away. | 1290 // away. |
| 1208 save_file_manager_->Shutdown(); | 1291 save_file_manager_->Shutdown(); |
| 1209 ResetThread_FILE(std::move(file_thread_)); | 1292 ResetThread_FILE(std::move(file_thread_)); |
| 1210 break; | 1293 break; |
| 1211 } | 1294 } |
| 1212 case BrowserThread::FILE_USER_BLOCKING: { | 1295 case BrowserThread::FILE_USER_BLOCKING: { |
| 1213 TRACE_EVENT0("shutdown", | 1296 TRACE_EVENT0("shutdown", |
| 1214 "BrowserMainLoop::Subsystem:FileUserBlockingThread"); | 1297 "BrowserMainLoop::Subsystem:FileUserBlockingThread"); |
| 1215 ResetThread_FILE_USER_BLOCKING(std::move(file_user_blocking_thread_)); | 1298 ResetThread_FILE_USER_BLOCKING(std::move(file_user_blocking_thread_)); |
| 1216 break; | 1299 break; |
| 1217 } | 1300 } |
| 1218 case BrowserThread::PROCESS_LAUNCHER: { | 1301 case BrowserThread::PROCESS_LAUNCHER: { |
| 1219 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); | 1302 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); |
| 1220 ResetThread_PROCESS_LAUNCHER(std::move(process_launcher_thread_)); | 1303 ResetThread_PROCESS_LAUNCHER(std::move(process_launcher_thread_)); |
| 1221 break; | 1304 break; |
| 1222 } | 1305 } |
| 1223 case BrowserThread::CACHE: { | 1306 case BrowserThread::CACHE: { |
| 1224 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread"); | 1307 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread"); |
| 1225 ResetThread_CACHE(std::move(cache_thread_)); | 1308 ResetThread_CACHE(std::move(cache_thread_)); |
| 1226 break; | 1309 break; |
| 1227 } | 1310 } |
| 1228 case BrowserThread::IO: { | 1311 case BrowserThread::IO: { |
| 1229 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); | 1312 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); |
| 1230 ResetThread_IO(std::move(io_thread_)); | 1313 ResetThread_IO(std::move(io_thread_)); |
| 1231 break; | 1314 break; |
| 1232 } | 1315 } |
| 1233 case BrowserThread::UI: | 1316 case BrowserThread::UI: |
| 1234 case BrowserThread::ID_COUNT: | 1317 case BrowserThread::ID_COUNT: |
| 1235 default: | |
| 1236 NOTREACHED(); | 1318 NOTREACHED(); |
| 1237 break; | 1319 break; |
| 1238 } | 1320 } |
| 1239 } | 1321 } |
| 1240 { | 1322 { |
| 1241 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); | 1323 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); |
| 1242 ResetThread_IndexedDb(std::move(indexed_db_thread_)); | 1324 ResetThread_IndexedDb(std::move(indexed_db_thread_)); |
| 1243 } | 1325 } |
| 1244 | 1326 |
| 1245 // Close the blocking I/O pool after the other threads. Other threads such | 1327 // Close the blocking I/O pool after the other threads. Other threads such |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 if (!audio_manager_) { | 1789 if (!audio_manager_) { |
| 1708 audio_thread_ = base::MakeUnique<AudioManagerThread>(); | 1790 audio_thread_ = base::MakeUnique<AudioManagerThread>(); |
| 1709 audio_manager_ = media::AudioManager::Create( | 1791 audio_manager_ = media::AudioManager::Create( |
| 1710 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), | 1792 audio_thread_->task_runner(), audio_thread_->worker_task_runner(), |
| 1711 MediaInternals::GetInstance()); | 1793 MediaInternals::GetInstance()); |
| 1712 } | 1794 } |
| 1713 CHECK(audio_manager_); | 1795 CHECK(audio_manager_); |
| 1714 } | 1796 } |
| 1715 | 1797 |
| 1716 } // namespace content | 1798 } // namespace content |
| OLD | NEW |