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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 // them before |system_monitor_| goes away. | 1048 // them before |system_monitor_| goes away. |
1049 // On Mac and windows, the monitor needs to be destroyed on the same thread | 1049 // On Mac and windows, the monitor needs to be destroyed on the same thread |
1050 // as they were created. On Linux, the monitor will be deleted when IO thread | 1050 // as they were created. On Linux, the monitor will be deleted when IO thread |
1051 // goes away. | 1051 // goes away. |
1052 #if defined(OS_WIN) | 1052 #if defined(OS_WIN) |
1053 system_message_window_.reset(); | 1053 system_message_window_.reset(); |
1054 #elif defined(OS_MACOSX) | 1054 #elif defined(OS_MACOSX) |
1055 device_monitor_mac_.reset(); | 1055 device_monitor_mac_.reset(); |
1056 #endif | 1056 #endif |
1057 | 1057 |
1058 // Shutdown Mojo shell and IPC. | 1058 // Shutdown the Service Manager and IPC. |
1059 service_manager_context_.reset(); | 1059 service_manager_context_.reset(); |
1060 mojo_ipc_support_.reset(); | 1060 mojo_ipc_support_.reset(); |
1061 | 1061 |
1062 // Must be size_t so we can subtract from it. | 1062 // Must be size_t so we can subtract from it. |
1063 for (size_t thread_id = BrowserThread::ID_COUNT - 1; | 1063 for (size_t thread_id = BrowserThread::ID_COUNT - 1; |
1064 thread_id >= (BrowserThread::UI + 1); | 1064 thread_id >= (BrowserThread::UI + 1); |
1065 --thread_id) { | 1065 --thread_id) { |
1066 // Find the thread object we want to stop. Looping over all valid | 1066 // Find the thread object we want to stop. Looping over all valid |
1067 // BrowserThread IDs and DCHECKing on a missing case in the switch | 1067 // BrowserThread IDs and DCHECKing on a missing case in the switch |
1068 // statement helps avoid a mismatch between this code and the | 1068 // statement helps avoid a mismatch between this code and the |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 base::PlatformThread::SetName("CrBrowserMain"); | 1187 base::PlatformThread::SetName("CrBrowserMain"); |
1188 | 1188 |
1189 // Register the main thread by instantiating it, but don't call any methods. | 1189 // Register the main thread by instantiating it, but don't call any methods. |
1190 main_thread_.reset( | 1190 main_thread_.reset( |
1191 new BrowserThreadImpl(BrowserThread::UI, base::MessageLoop::current())); | 1191 new BrowserThreadImpl(BrowserThread::UI, base::MessageLoop::current())); |
1192 } | 1192 } |
1193 | 1193 |
1194 int BrowserMainLoop::BrowserThreadsStarted() { | 1194 int BrowserMainLoop::BrowserThreadsStarted() { |
1195 TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted"); | 1195 TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted"); |
1196 | 1196 |
1197 // Bring up Mojo IPC and shell as early as possible. Initializaing mojo | 1197 // Bring up Mojo IPC and the embedded Service Manager as early as possible. |
1198 // requires the IO thread to have been initialized first. So this cannot | 1198 // Initializaing mojo requires the IO thread to have been initialized first, |
1199 // happen any earlier than this. | 1199 // so this cannot happen any earlier than now. |
1200 InitializeMojo(); | 1200 InitializeMojo(); |
1201 | 1201 |
1202 #if defined(USE_AURA) | 1202 #if defined(USE_AURA) |
1203 if (service_manager::ServiceManagerIsRemote()) { | 1203 if (service_manager::ServiceManagerIsRemote()) { |
1204 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1204 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
1205 switches::kIsRunningInMash); | 1205 switches::kIsRunningInMash); |
1206 } | 1206 } |
1207 #endif | 1207 #endif |
1208 | 1208 |
1209 indexed_db_thread_.reset(new base::Thread("IndexedDB")); | 1209 indexed_db_thread_.reset(new base::Thread("IndexedDB")); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = | 1577 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner = |
1578 audio_thread_->task_runner(); | 1578 audio_thread_->task_runner(); |
1579 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), | 1579 audio_manager_ = media::AudioManager::Create(std::move(audio_task_runner), |
1580 std::move(worker_task_runner), | 1580 std::move(worker_task_runner), |
1581 MediaInternals::GetInstance()); | 1581 MediaInternals::GetInstance()); |
1582 } | 1582 } |
1583 CHECK(audio_manager_); | 1583 CHECK(audio_manager_); |
1584 } | 1584 } |
1585 | 1585 |
1586 } // namespace content | 1586 } // namespace content |
OLD | NEW |