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" |
35 #include "base/task_scheduler/post_task.h" | |
36 #include "base/task_scheduler/task_traits.h" | |
34 #include "base/threading/sequenced_worker_pool.h" | 37 #include "base/threading/sequenced_worker_pool.h" |
35 #include "base/threading/thread_restrictions.h" | 38 #include "base/threading/thread_restrictions.h" |
36 #include "base/threading/thread_task_runner_handle.h" | 39 #include "base/threading/thread_task_runner_handle.h" |
37 #include "base/timer/hi_res_timer_manager.h" | 40 #include "base/timer/hi_res_timer_manager.h" |
38 #include "base/trace_event/memory_dump_manager.h" | 41 #include "base/trace_event/memory_dump_manager.h" |
39 #include "base/trace_event/trace_event.h" | 42 #include "base/trace_event/trace_event.h" |
40 #include "build/build_config.h" | 43 #include "build/build_config.h" |
41 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" | 44 #include "components/discardable_memory/service/discardable_shared_memory_manage r.h" |
42 #include "components/tracing/browser/trace_config_file.h" | 45 #include "components/tracing/browser/trace_config_file.h" |
43 #include "components/tracing/common/process_metrics_memory_dump_provider.h" | 46 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 | 299 |
297 // Disable optimizations for this block of functions so the compiler doesn't | 300 // Disable optimizations for this block of functions so the compiler doesn't |
298 // merge them all together. This makes it possible to tell what thread was | 301 // merge them all together. This makes it possible to tell what thread was |
299 // unresponsive by inspecting the callstack. | 302 // unresponsive by inspecting the callstack. |
300 MSVC_DISABLE_OPTIMIZE() | 303 MSVC_DISABLE_OPTIMIZE() |
301 MSVC_PUSH_DISABLE_WARNING(4748) | 304 MSVC_PUSH_DISABLE_WARNING(4748) |
302 | 305 |
303 NOINLINE void ResetThread_DB(std::unique_ptr<BrowserProcessSubThread> thread) { | 306 NOINLINE void ResetThread_DB(std::unique_ptr<BrowserProcessSubThread> thread) { |
304 volatile int inhibit_comdat = __LINE__; | 307 volatile int inhibit_comdat = __LINE__; |
305 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 308 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
306 thread.reset(); | 309 if (thread) { |
310 thread.reset(); | |
311 } else { | |
312 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::DB); | |
313 } | |
307 } | 314 } |
308 | 315 |
309 NOINLINE void ResetThread_FILE( | 316 NOINLINE void ResetThread_FILE( |
310 std::unique_ptr<BrowserProcessSubThread> thread) { | 317 std::unique_ptr<BrowserProcessSubThread> thread) { |
311 volatile int inhibit_comdat = __LINE__; | 318 volatile int inhibit_comdat = __LINE__; |
312 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 319 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
313 thread.reset(); | 320 if (thread) { |
321 thread.reset(); | |
322 } else { | |
323 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::FILE); | |
324 } | |
314 } | 325 } |
315 | 326 |
316 NOINLINE void ResetThread_FILE_USER_BLOCKING( | 327 NOINLINE void ResetThread_FILE_USER_BLOCKING( |
317 std::unique_ptr<BrowserProcessSubThread> thread) { | 328 std::unique_ptr<BrowserProcessSubThread> thread) { |
318 volatile int inhibit_comdat = __LINE__; | 329 volatile int inhibit_comdat = __LINE__; |
319 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 330 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
320 thread.reset(); | 331 if (thread) { |
332 thread.reset(); | |
333 } else { | |
334 BrowserThreadImpl::StopRedirectionOfThreadID( | |
335 BrowserThread::FILE_USER_BLOCKING); | |
336 } | |
321 } | 337 } |
322 | 338 |
323 NOINLINE void ResetThread_PROCESS_LAUNCHER( | 339 NOINLINE void ResetThread_PROCESS_LAUNCHER( |
324 std::unique_ptr<BrowserProcessSubThread> thread) { | 340 std::unique_ptr<BrowserProcessSubThread> thread) { |
325 volatile int inhibit_comdat = __LINE__; | 341 volatile int inhibit_comdat = __LINE__; |
326 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 342 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
327 thread.reset(); | 343 if (thread) { |
344 thread.reset(); | |
345 } else { | |
346 BrowserThreadImpl::StopRedirectionOfThreadID( | |
347 BrowserThread::PROCESS_LAUNCHER); | |
348 } | |
328 } | 349 } |
329 | 350 |
330 NOINLINE void ResetThread_CACHE( | 351 NOINLINE void ResetThread_CACHE( |
331 std::unique_ptr<BrowserProcessSubThread> thread) { | 352 std::unique_ptr<BrowserProcessSubThread> thread) { |
332 volatile int inhibit_comdat = __LINE__; | 353 volatile int inhibit_comdat = __LINE__; |
333 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 354 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
334 thread.reset(); | 355 if (thread) { |
356 thread.reset(); | |
357 } else { | |
358 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::CACHE); | |
359 } | |
335 } | 360 } |
336 | 361 |
337 NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { | 362 NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { |
338 volatile int inhibit_comdat = __LINE__; | 363 volatile int inhibit_comdat = __LINE__; |
339 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 364 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
340 thread.reset(); | 365 thread.reset(); |
341 } | 366 } |
342 | 367 |
343 NOINLINE void ResetThread_IndexedDb(std::unique_ptr<base::Thread> thread) { | 368 NOINLINE void ResetThread_IndexedDb(std::unique_ptr<base::Thread> thread) { |
344 volatile int inhibit_comdat = __LINE__; | 369 volatile int inhibit_comdat = __LINE__; |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
866 } | 891 } |
867 | 892 |
868 int BrowserMainLoop::CreateThreads() { | 893 int BrowserMainLoop::CreateThreads() { |
869 TRACE_EVENT0("startup,rail", "BrowserMainLoop::CreateThreads"); | 894 TRACE_EVENT0("startup,rail", "BrowserMainLoop::CreateThreads"); |
870 | 895 |
871 base::Thread::Options io_message_loop_options; | 896 base::Thread::Options io_message_loop_options; |
872 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; | 897 io_message_loop_options.message_loop_type = base::MessageLoop::TYPE_IO; |
873 base::Thread::Options ui_message_loop_options; | 898 base::Thread::Options ui_message_loop_options; |
874 ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; | 899 ui_message_loop_options.message_loop_type = base::MessageLoop::TYPE_UI; |
875 | 900 |
876 // Start threads in the order they occur in the BrowserThread::ID | 901 const bool redirect_nonUInonIO_browser_threads = |
877 // enumeration, except for BrowserThread::UI which is the main | 902 GetContentClient() |
878 // thread. | 903 ->browser() |
904 ->RedirectNonUINonIOBrowserThreadsToTaskScheduler(); | |
905 | |
906 // Start threads in the order they occur in the BrowserThread::ID enumeration, | |
907 // except for BrowserThread::UI which is the main thread. | |
879 // | 908 // |
880 // Must be size_t so we can increment it. | 909 // Must be size_t so we can increment it. |
881 for (size_t thread_id = BrowserThread::UI + 1; | 910 for (size_t thread_id = BrowserThread::UI + 1; |
882 thread_id < BrowserThread::ID_COUNT; | 911 thread_id < BrowserThread::ID_COUNT; |
883 ++thread_id) { | 912 ++thread_id) { |
884 std::unique_ptr<BrowserProcessSubThread>* thread_to_start = NULL; | 913 // If this thread ID is backed by a real thread, |thread_to_start| will be |
914 // set to the appropriate BrowserProcessSubThread*. And |options| can be | |
915 // updated away from its default. | |
916 std::unique_ptr<BrowserProcessSubThread>* thread_to_start = nullptr; | |
885 base::Thread::Options options; | 917 base::Thread::Options options; |
886 | 918 |
919 // Otherwise this thread ID will be backed by a SingleThreadTaskRunner using | |
920 // |non_ui_non_io_task_runner_traits| (which can be augmented below). | |
921 // TODO(gab): Existing non-UI/non-IO BrowserThreads allow waiting so the | |
922 // initial redirection will as well but they probably don't need to. | |
923 base::TaskTraits non_ui_non_io_task_runner_traits = | |
924 base::TaskTraits().WithFileIO().WithWait(); | |
925 | |
887 switch (thread_id) { | 926 switch (thread_id) { |
888 case BrowserThread::DB: | 927 case BrowserThread::DB: |
889 TRACE_EVENT_BEGIN1("startup", | 928 TRACE_EVENT_BEGIN1("startup", |
robliao
2016/12/08 01:57:17
Does it still make sense to do these TRACE_EVENT_B
fdoray
2016/12/08 14:51:46
Before, StartWithOptions blocked until the thread
gab
2016/12/08 18:49:41
Right, it should be short, but I don't think it hu
| |
890 "BrowserMainLoop::CreateThreads:start", | 929 "BrowserMainLoop::CreateThreads:start", |
891 "Thread", "BrowserThread::DB"); | 930 "Thread", "BrowserThread::DB"); |
892 thread_to_start = &db_thread_; | 931 if (redirect_nonUInonIO_browser_threads) { |
893 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 932 non_ui_non_io_task_runner_traits |
933 .WithPriority(base::TaskPriority::USER_VISIBLE) | |
934 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); | |
935 } else { | |
936 thread_to_start = &db_thread_; | |
937 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | |
938 } | |
894 break; | 939 break; |
895 case BrowserThread::FILE_USER_BLOCKING: | 940 case BrowserThread::FILE_USER_BLOCKING: |
896 TRACE_EVENT_BEGIN1("startup", | 941 TRACE_EVENT_BEGIN1("startup", |
897 "BrowserMainLoop::CreateThreads:start", | 942 "BrowserMainLoop::CreateThreads:start", |
898 "Thread", "BrowserThread::FILE_USER_BLOCKING"); | 943 "Thread", "BrowserThread::FILE_USER_BLOCKING"); |
899 thread_to_start = &file_user_blocking_thread_; | 944 if (redirect_nonUInonIO_browser_threads) { |
945 non_ui_non_io_task_runner_traits | |
946 .WithPriority(base::TaskPriority::USER_BLOCKING) | |
947 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); | |
948 } else { | |
949 thread_to_start = &file_user_blocking_thread_; | |
950 } | |
900 break; | 951 break; |
901 case BrowserThread::FILE: | 952 case BrowserThread::FILE: |
902 TRACE_EVENT_BEGIN1("startup", | 953 TRACE_EVENT_BEGIN1("startup", |
903 "BrowserMainLoop::CreateThreads:start", | 954 "BrowserMainLoop::CreateThreads:start", |
904 "Thread", "BrowserThread::FILE"); | 955 "Thread", "BrowserThread::FILE"); |
956 | |
957 #if defined(OS_WIN) | |
958 // On Windows, the FILE thread needs to be have a UI message loop which | |
fdoray
2016/12/08 14:51:46
needs to be have -> remove be
gab
2016/12/08 18:49:41
Done.
| |
959 // pumps messages in such a way that Google Update can communicate back | |
960 // to us. | |
961 // TODO(robliao): Need to support COM in TaskScheduler before | |
962 // redirecting the FILE thread on Windows. http://crbug.com/662122 | |
905 thread_to_start = &file_thread_; | 963 thread_to_start = &file_thread_; |
906 #if defined(OS_WIN) | |
907 // On Windows, the FILE thread needs to be have a UI message loop | |
908 // which pumps messages in such a way that Google Update can | |
909 // communicate back to us. | |
910 options = ui_message_loop_options; | 964 options = ui_message_loop_options; |
911 #else | 965 #else |
912 options = io_message_loop_options; | 966 if (redirect_nonUInonIO_browser_threads) { |
967 non_ui_non_io_task_runner_traits | |
968 .WithPriority(base::TaskPriority::BACKGROUND) | |
969 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); | |
970 } else { | |
971 thread_to_start = &file_thread_; | |
972 options = io_message_loop_options; | |
973 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | |
974 } | |
913 #endif | 975 #endif |
914 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | |
915 break; | 976 break; |
916 case BrowserThread::PROCESS_LAUNCHER: | 977 case BrowserThread::PROCESS_LAUNCHER: |
917 TRACE_EVENT_BEGIN1("startup", | 978 TRACE_EVENT_BEGIN1("startup", |
918 "BrowserMainLoop::CreateThreads:start", | 979 "BrowserMainLoop::CreateThreads:start", |
919 "Thread", "BrowserThread::PROCESS_LAUNCHER"); | 980 "Thread", "BrowserThread::PROCESS_LAUNCHER"); |
920 thread_to_start = &process_launcher_thread_; | 981 if (redirect_nonUInonIO_browser_threads) { |
921 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 982 non_ui_non_io_task_runner_traits |
983 .WithPriority(base::TaskPriority::USER_BLOCKING) | |
984 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); | |
985 } else { | |
986 thread_to_start = &process_launcher_thread_; | |
987 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | |
988 } | |
922 break; | 989 break; |
923 case BrowserThread::CACHE: | 990 case BrowserThread::CACHE: |
924 TRACE_EVENT_BEGIN1("startup", | 991 TRACE_EVENT_BEGIN1("startup", |
925 "BrowserMainLoop::CreateThreads:start", | 992 "BrowserMainLoop::CreateThreads:start", |
926 "Thread", "BrowserThread::CACHE"); | 993 "Thread", "BrowserThread::CACHE"); |
994 #if defined(OS_WIN) | |
995 // TaskScheduler doesn't support async I/O on Windows as CACHE thread is | |
996 // the only user and this use case is going away in | |
997 // https://codereview.chromium.org/2216583003/. | |
998 // TODO(gavinp): Remove this ifdef (and thus enable redirection of the | |
999 // CACHE thread on Windows) once that CL lands. | |
927 thread_to_start = &cache_thread_; | 1000 thread_to_start = &cache_thread_; |
928 #if defined(OS_WIN) | |
929 options = io_message_loop_options; | 1001 options = io_message_loop_options; |
930 #endif // defined(OS_WIN) | |
931 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 1002 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
1003 #else // OS_WIN | |
1004 if (redirect_nonUInonIO_browser_threads) { | |
1005 non_ui_non_io_task_runner_traits | |
1006 .WithPriority(base::TaskPriority::USER_BLOCKING) | |
1007 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN); | |
1008 } else { | |
1009 thread_to_start = &cache_thread_; | |
1010 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | |
1011 } | |
1012 #endif // OS_WIN | |
932 break; | 1013 break; |
933 case BrowserThread::IO: | 1014 case BrowserThread::IO: |
934 TRACE_EVENT_BEGIN1("startup", | 1015 TRACE_EVENT_BEGIN1("startup", |
935 "BrowserMainLoop::CreateThreads:start", | 1016 "BrowserMainLoop::CreateThreads:start", |
936 "Thread", "BrowserThread::IO"); | 1017 "Thread", "BrowserThread::IO"); |
937 thread_to_start = &io_thread_; | 1018 thread_to_start = &io_thread_; |
938 options = io_message_loop_options; | 1019 options = io_message_loop_options; |
939 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 1020 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
940 // Up the priority of the |io_thread_| as some of its IPCs relate to | 1021 // Up the priority of the |io_thread_| as some of its IPCs relate to |
941 // display tasks. | 1022 // display tasks. |
942 options.priority = base::ThreadPriority::DISPLAY; | 1023 options.priority = base::ThreadPriority::DISPLAY; |
943 #endif | 1024 #endif |
944 break; | 1025 break; |
945 case BrowserThread::UI: | 1026 case BrowserThread::UI: // Falls through. |
946 case BrowserThread::ID_COUNT: | 1027 case BrowserThread::ID_COUNT: // Falls through. |
947 default: | |
948 NOTREACHED(); | 1028 NOTREACHED(); |
949 break; | 1029 break; |
950 } | 1030 } |
951 | 1031 |
952 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); | 1032 BrowserThread::ID id = static_cast<BrowserThread::ID>(thread_id); |
953 | 1033 |
954 if (thread_to_start) { | 1034 if (thread_to_start) { |
955 (*thread_to_start).reset(new BrowserProcessSubThread(id)); | 1035 (*thread_to_start).reset(new BrowserProcessSubThread(id)); |
956 if (!(*thread_to_start)->StartWithOptions(options)) { | 1036 if (!(*thread_to_start)->StartWithOptions(options)) { |
957 LOG(FATAL) << "Failed to start the browser thread: id == " << id; | 1037 LOG(FATAL) << "Failed to start the browser thread: id == " << id; |
958 } | 1038 } |
959 } else { | 1039 } else { |
960 NOTREACHED(); | 1040 scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner = |
1041 base::CreateSingleThreadTaskRunnerWithTraits( | |
1042 non_ui_non_io_task_runner_traits); | |
1043 DCHECK(redirection_task_runner); | |
1044 BrowserThreadImpl::RedirectThreadIDToTaskRunner( | |
1045 id, std::move(redirection_task_runner)); | |
961 } | 1046 } |
962 | 1047 |
963 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); | 1048 TRACE_EVENT_END0("startup", "BrowserMainLoop::CreateThreads:start"); |
964 } | 1049 } |
965 created_threads_ = true; | 1050 created_threads_ = true; |
966 return result_code_; | 1051 return result_code_; |
967 } | 1052 } |
968 | 1053 |
969 int BrowserMainLoop::PreMainMessageLoopRun() { | 1054 int BrowserMainLoop::PreMainMessageLoopRun() { |
970 #if defined(OS_ANDROID) | 1055 #if defined(OS_ANDROID) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1106 // | 1191 // |
1107 // - (Not sure why DB stops last.) | 1192 // - (Not sure why DB stops last.) |
1108 switch (thread_id) { | 1193 switch (thread_id) { |
1109 case BrowserThread::DB: { | 1194 case BrowserThread::DB: { |
1110 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread"); | 1195 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread"); |
1111 ResetThread_DB(std::move(db_thread_)); | 1196 ResetThread_DB(std::move(db_thread_)); |
1112 break; | 1197 break; |
1113 } | 1198 } |
1114 case BrowserThread::FILE: { | 1199 case BrowserThread::FILE: { |
1115 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread"); | 1200 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread"); |
1116 // Clean up state that lives on or uses the file_thread_ before | 1201 // Clean up state that lives on or uses the FILE thread before it goes |
1117 // it goes away. | 1202 // away. |
1118 save_file_manager_->Shutdown(); | 1203 save_file_manager_->Shutdown(); |
1119 ResetThread_FILE(std::move(file_thread_)); | 1204 ResetThread_FILE(std::move(file_thread_)); |
1120 break; | 1205 break; |
1121 } | 1206 } |
1122 case BrowserThread::FILE_USER_BLOCKING: { | 1207 case BrowserThread::FILE_USER_BLOCKING: { |
1123 TRACE_EVENT0("shutdown", | 1208 TRACE_EVENT0("shutdown", |
1124 "BrowserMainLoop::Subsystem:FileUserBlockingThread"); | 1209 "BrowserMainLoop::Subsystem:FileUserBlockingThread"); |
1125 ResetThread_FILE_USER_BLOCKING(std::move(file_user_blocking_thread_)); | 1210 ResetThread_FILE_USER_BLOCKING(std::move(file_user_blocking_thread_)); |
1126 break; | 1211 break; |
1127 } | 1212 } |
1128 case BrowserThread::PROCESS_LAUNCHER: { | 1213 case BrowserThread::PROCESS_LAUNCHER: { |
1129 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); | 1214 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); |
1130 ResetThread_PROCESS_LAUNCHER(std::move(process_launcher_thread_)); | 1215 ResetThread_PROCESS_LAUNCHER(std::move(process_launcher_thread_)); |
1131 break; | 1216 break; |
1132 } | 1217 } |
1133 case BrowserThread::CACHE: { | 1218 case BrowserThread::CACHE: { |
1134 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread"); | 1219 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread"); |
1135 ResetThread_CACHE(std::move(cache_thread_)); | 1220 ResetThread_CACHE(std::move(cache_thread_)); |
1136 break; | 1221 break; |
1137 } | 1222 } |
1138 case BrowserThread::IO: { | 1223 case BrowserThread::IO: { |
1139 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); | 1224 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); |
1140 ResetThread_IO(std::move(io_thread_)); | 1225 ResetThread_IO(std::move(io_thread_)); |
1141 break; | 1226 break; |
1142 } | 1227 } |
1143 case BrowserThread::UI: | 1228 case BrowserThread::UI: |
1144 case BrowserThread::ID_COUNT: | 1229 case BrowserThread::ID_COUNT: |
1145 default: | |
1146 NOTREACHED(); | 1230 NOTREACHED(); |
1147 break; | 1231 break; |
1148 } | 1232 } |
1149 } | 1233 } |
1150 { | 1234 { |
1151 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); | 1235 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); |
1152 ResetThread_IndexedDb(std::move(indexed_db_thread_)); | 1236 ResetThread_IndexedDb(std::move(indexed_db_thread_)); |
1153 } | 1237 } |
1154 | 1238 |
1155 // Close the blocking I/O pool after the other threads. Other threads such | 1239 // Close the blocking I/O pool after the other threads. Other threads such |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1609 if (!audio_manager_) { | 1693 if (!audio_manager_) { |
1610 audio_thread_ = base::MakeUnique<AudioDeviceThread>(); | 1694 audio_thread_ = base::MakeUnique<AudioDeviceThread>(); |
1611 audio_manager_ = media::AudioManager::Create( | 1695 audio_manager_ = media::AudioManager::Create( |
1612 audio_thread_->GetTaskRunner(), audio_thread_->worker_task_runner(), | 1696 audio_thread_->GetTaskRunner(), audio_thread_->worker_task_runner(), |
1613 MediaInternals::GetInstance()); | 1697 MediaInternals::GetInstance()); |
1614 } | 1698 } |
1615 CHECK(audio_manager_); | 1699 CHECK(audio_manager_); |
1616 } | 1700 } |
1617 | 1701 |
1618 } // namespace content | 1702 } // namespace content |
OLD | NEW |