| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::CACHE); | 356 BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::CACHE); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { | 360 NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { |
| 361 volatile int inhibit_comdat = __LINE__; | 361 volatile int inhibit_comdat = __LINE__; |
| 362 ALLOW_UNUSED_LOCAL(inhibit_comdat); | 362 ALLOW_UNUSED_LOCAL(inhibit_comdat); |
| 363 thread.reset(); | 363 thread.reset(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 NOINLINE void ResetThread_IndexedDb(std::unique_ptr<base::Thread> thread) { | |
| 367 volatile int inhibit_comdat = __LINE__; | |
| 368 ALLOW_UNUSED_LOCAL(inhibit_comdat); | |
| 369 thread.reset(); | |
| 370 } | |
| 371 | |
| 372 MSVC_POP_WARNING() | 366 MSVC_POP_WARNING() |
| 373 MSVC_ENABLE_OPTIMIZE(); | 367 MSVC_ENABLE_OPTIMIZE(); |
| 374 | 368 |
| 375 #if defined(OS_WIN) | 369 #if defined(OS_WIN) |
| 376 // Creates a memory pressure monitor using automatic thresholds, or those | 370 // Creates a memory pressure monitor using automatic thresholds, or those |
| 377 // specified on the command-line. Ownership is passed to the caller. | 371 // specified on the command-line. Ownership is passed to the caller. |
| 378 std::unique_ptr<base::win::MemoryPressureMonitor> | 372 std::unique_ptr<base::win::MemoryPressureMonitor> |
| 379 CreateWinMemoryPressureMonitor(const base::CommandLine& parsed_command_line) { | 373 CreateWinMemoryPressureMonitor(const base::CommandLine& parsed_command_line) { |
| 380 std::vector<std::string> thresholds = | 374 std::vector<std::string> thresholds = |
| 381 base::SplitString(parsed_command_line.GetSwitchValueASCII( | 375 base::SplitString(parsed_command_line.GetSwitchValueASCII( |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); | 1301 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); |
| 1308 ResetThread_IO(std::move(io_thread_)); | 1302 ResetThread_IO(std::move(io_thread_)); |
| 1309 break; | 1303 break; |
| 1310 } | 1304 } |
| 1311 case BrowserThread::UI: | 1305 case BrowserThread::UI: |
| 1312 case BrowserThread::ID_COUNT: | 1306 case BrowserThread::ID_COUNT: |
| 1313 NOTREACHED(); | 1307 NOTREACHED(); |
| 1314 break; | 1308 break; |
| 1315 } | 1309 } |
| 1316 } | 1310 } |
| 1317 { | |
| 1318 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); | |
| 1319 ResetThread_IndexedDb(std::move(indexed_db_thread_)); | |
| 1320 } | |
| 1321 | 1311 |
| 1322 // Close the blocking I/O pool after the other threads. Other threads such | 1312 // Close the blocking I/O pool after the other threads. Other threads such |
| 1323 // as the I/O thread may need to schedule work like closing files or | 1313 // as the I/O thread may need to schedule work like closing files or |
| 1324 // flushing data during shutdown, so the blocking pool needs to be | 1314 // flushing data during shutdown, so the blocking pool needs to be |
| 1325 // available. There may also be slow operations pending that will blcok | 1315 // available. There may also be slow operations pending that will blcok |
| 1326 // shutdown, so closing it here (which will block until required operations | 1316 // shutdown, so closing it here (which will block until required operations |
| 1327 // are complete) gives more head start for those operations to finish. | 1317 // are complete) gives more head start for those operations to finish. |
| 1328 { | 1318 { |
| 1329 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); | 1319 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); |
| 1330 BrowserThreadImpl::ShutdownThreadPool(); | 1320 BrowserThreadImpl::ShutdownThreadPool(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 true /* initialize_memory_dump_manager */, | 1385 true /* initialize_memory_dump_manager */, |
| 1396 content::ServiceManagerConnection::GetForProcess()->GetConnector()); | 1386 content::ServiceManagerConnection::GetForProcess()->GetConnector()); |
| 1397 | 1387 |
| 1398 #if defined(USE_AURA) | 1388 #if defined(USE_AURA) |
| 1399 if (service_manager::ServiceManagerIsRemote()) { | 1389 if (service_manager::ServiceManagerIsRemote()) { |
| 1400 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1390 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1401 switches::kIsRunningInMash); | 1391 switches::kIsRunningInMash); |
| 1402 } | 1392 } |
| 1403 #endif | 1393 #endif |
| 1404 | 1394 |
| 1405 indexed_db_thread_.reset(new base::Thread("IndexedDB")); | |
| 1406 indexed_db_thread_->Start(); | |
| 1407 | |
| 1408 HistogramSynchronizer::GetInstance(); | 1395 HistogramSynchronizer::GetInstance(); |
| 1409 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 1396 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 1410 // Up the priority of the UI thread. | 1397 // Up the priority of the UI thread. |
| 1411 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); | 1398 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); |
| 1412 #endif | 1399 #endif |
| 1413 | 1400 |
| 1414 #if BUILDFLAG(ENABLE_VULKAN) | 1401 #if BUILDFLAG(ENABLE_VULKAN) |
| 1415 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1402 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1416 switches::kEnableVulkan)) { | 1403 switches::kEnableVulkan)) { |
| 1417 gpu::InitializeVulkan(); | 1404 gpu::InitializeVulkan(); |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 base::MakeUnique<media::AudioThreadImpl>(), | 1757 base::MakeUnique<media::AudioThreadImpl>(), |
| 1771 MediaInternals::GetInstance()); | 1758 MediaInternals::GetInstance()); |
| 1772 } | 1759 } |
| 1773 CHECK(audio_manager_); | 1760 CHECK(audio_manager_); |
| 1774 | 1761 |
| 1775 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 1762 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
| 1776 CHECK(audio_system_); | 1763 CHECK(audio_system_); |
| 1777 } | 1764 } |
| 1778 | 1765 |
| 1779 } // namespace content | 1766 } // namespace content |
| OLD | NEW |