Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 1504033007: Move Indexed DB from dedicated thread to task scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timer
Patch Set: Update to TaskScheduler, modern sequence goodness Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); 1296 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread");
1303 ResetThread_IO(std::move(io_thread_)); 1297 ResetThread_IO(std::move(io_thread_));
1304 break; 1298 break;
1305 } 1299 }
1306 case BrowserThread::UI: 1300 case BrowserThread::UI:
1307 case BrowserThread::ID_COUNT: 1301 case BrowserThread::ID_COUNT:
1308 NOTREACHED(); 1302 NOTREACHED();
1309 break; 1303 break;
1310 } 1304 }
1311 } 1305 }
1312 {
1313 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread");
1314 ResetThread_IndexedDb(std::move(indexed_db_thread_));
1315 }
1316 1306
1317 // Close the blocking I/O pool after the other threads. Other threads such 1307 // Close the blocking I/O pool after the other threads. Other threads such
1318 // as the I/O thread may need to schedule work like closing files or 1308 // as the I/O thread may need to schedule work like closing files or
1319 // flushing data during shutdown, so the blocking pool needs to be 1309 // flushing data during shutdown, so the blocking pool needs to be
1320 // available. There may also be slow operations pending that will blcok 1310 // available. There may also be slow operations pending that will blcok
1321 // shutdown, so closing it here (which will block until required operations 1311 // shutdown, so closing it here (which will block until required operations
1322 // are complete) gives more head start for those operations to finish. 1312 // are complete) gives more head start for those operations to finish.
1323 { 1313 {
1324 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool"); 1314 TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:ThreadPool");
1325 BrowserThreadImpl::ShutdownThreadPool(); 1315 BrowserThreadImpl::ShutdownThreadPool();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 true /* initialize_memory_dump_manager */, 1380 true /* initialize_memory_dump_manager */,
1391 content::ServiceManagerConnection::GetForProcess()->GetConnector()); 1381 content::ServiceManagerConnection::GetForProcess()->GetConnector());
1392 1382
1393 #if defined(USE_AURA) 1383 #if defined(USE_AURA)
1394 if (service_manager::ServiceManagerIsRemote()) { 1384 if (service_manager::ServiceManagerIsRemote()) {
1395 base::CommandLine::ForCurrentProcess()->AppendSwitch( 1385 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1396 switches::kIsRunningInMash); 1386 switches::kIsRunningInMash);
1397 } 1387 }
1398 #endif 1388 #endif
1399 1389
1400 indexed_db_thread_.reset(new base::Thread("IndexedDB"));
1401 indexed_db_thread_->Start();
1402
1403 HistogramSynchronizer::GetInstance(); 1390 HistogramSynchronizer::GetInstance();
1404 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 1391 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
1405 // Up the priority of the UI thread. 1392 // Up the priority of the UI thread.
1406 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY); 1393 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::DISPLAY);
1407 #endif 1394 #endif
1408 1395
1409 #if BUILDFLAG(ENABLE_VULKAN) 1396 #if BUILDFLAG(ENABLE_VULKAN)
1410 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1397 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
1411 switches::kEnableVulkan)) { 1398 switches::kEnableVulkan)) {
1412 gpu::InitializeVulkan(); 1399 gpu::InitializeVulkan();
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 base::MakeUnique<media::AudioThreadImpl>(), 1752 base::MakeUnique<media::AudioThreadImpl>(),
1766 MediaInternals::GetInstance()); 1753 MediaInternals::GetInstance());
1767 } 1754 }
1768 CHECK(audio_manager_); 1755 CHECK(audio_manager_);
1769 1756
1770 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); 1757 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get());
1771 CHECK(audio_system_); 1758 CHECK(audio_system_);
1772 } 1759 }
1773 1760
1774 } // namespace content 1761 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698