Commit dc4e108d authored by Francois Doray's avatar Francois Doray Committed by Commit Bot

Revert "Remove BrowserThread::FILE_USER_BLOCKING/CACHE/DB."

This reverts commit abd57f32.

Reason for revert: Will reland similar CL once the FILE thread is also deprecated (we prefer to deprecate all browser threads at once).

Original change's description:
> Remove BrowserThread::FILE_USER_BLOCKING/CACHE/DB.
> 
> These threads are deprecated and no longer used.
> 
> NOPRESUBMIT=true
> 
> Bug: 689520
> Change-Id: I55b05b70626f91c8a71d56642c851bb786dbfcaa
> Reviewed-on: https://chromium-review.googlesource.com/660597
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Commit-Queue: Francois Doray <fdoray@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#501245}

TBR=jam@chromium.org,fdoray@chromium.org

Change-Id: I4a0605974792092af8780595fcccef5a6dda3d87
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 689520
Reviewed-on: https://chromium-review.googlesource.com/663598Reviewed-by: default avatarFrancois Doray <fdoray@chromium.org>
Commit-Queue: Francois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501263}
parent 579f1f6e
...@@ -552,8 +552,12 @@ void ThreadWatcherList::InitializeAndStartWatching( ...@@ -552,8 +552,12 @@ void ThreadWatcherList::InitializeAndStartWatching(
unresponsive_threshold, crash_on_hang_threads); unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime, StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads); unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::DB, "DB", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime, StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads); unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::CACHE, "CACHE", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads);
} }
// static // static
......
...@@ -328,12 +328,25 @@ void OnStoppedStartupTracing(const base::FilePath& trace_file) { ...@@ -328,12 +328,25 @@ void OnStoppedStartupTracing(const base::FilePath& trace_file) {
MSVC_DISABLE_OPTIMIZE() MSVC_DISABLE_OPTIMIZE()
MSVC_PUSH_DISABLE_WARNING(4748) MSVC_PUSH_DISABLE_WARNING(4748)
NOINLINE void ResetThread_DB() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::DB);
}
NOINLINE void ResetThread_FILE() { NOINLINE void ResetThread_FILE() {
volatile int inhibit_comdat = __LINE__; volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat); ALLOW_UNUSED_LOCAL(inhibit_comdat);
BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::FILE); BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::FILE);
} }
NOINLINE void ResetThread_FILE_USER_BLOCKING() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
BrowserThreadImpl::StopRedirectionOfThreadID(
BrowserThread::FILE_USER_BLOCKING);
}
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
NOINLINE void ResetThread_PROCESS_LAUNCHER( NOINLINE void ResetThread_PROCESS_LAUNCHER(
std::unique_ptr<BrowserProcessSubThread> thread) { std::unique_ptr<BrowserProcessSubThread> thread) {
...@@ -349,6 +362,21 @@ NOINLINE void ResetThread_PROCESS_LAUNCHER() { ...@@ -349,6 +362,21 @@ NOINLINE void ResetThread_PROCESS_LAUNCHER() {
} }
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
#if defined(OS_WIN)
NOINLINE void ResetThread_CACHE(
std::unique_ptr<BrowserProcessSubThread> thread) {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
thread.reset();
}
#else // defined(OS_WIN)
NOINLINE void ResetThread_CACHE() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
BrowserThreadImpl::StopRedirectionOfThreadID(BrowserThread::CACHE);
}
#endif // defined(OS_WIN)
NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) { NOINLINE void ResetThread_IO(std::unique_ptr<BrowserProcessSubThread> thread) {
volatile int inhibit_comdat = __LINE__; volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat); ALLOW_UNUSED_LOCAL(inhibit_comdat);
...@@ -1031,6 +1059,18 @@ int BrowserMainLoop::CreateThreads() { ...@@ -1031,6 +1059,18 @@ int BrowserMainLoop::CreateThreads() {
base::TaskShutdownBehavior::BLOCK_SHUTDOWN}; base::TaskShutdownBehavior::BLOCK_SHUTDOWN};
switch (thread_id) { switch (thread_id) {
case BrowserThread::DB:
TRACE_EVENT_BEGIN1("startup",
"BrowserMainLoop::CreateThreads:start",
"Thread", "BrowserThread::DB");
non_ui_non_io_task_runner_traits = kUserVisibleTraits;
break;
case BrowserThread::FILE_USER_BLOCKING:
TRACE_EVENT_BEGIN1("startup",
"BrowserMainLoop::CreateThreads:start",
"Thread", "BrowserThread::FILE_USER_BLOCKING");
non_ui_non_io_task_runner_traits = kUserBlockingTraits;
break;
case BrowserThread::FILE: case BrowserThread::FILE:
TRACE_EVENT_BEGIN1("startup", TRACE_EVENT_BEGIN1("startup",
"BrowserMainLoop::CreateThreads:start", "BrowserMainLoop::CreateThreads:start",
...@@ -1052,6 +1092,23 @@ int BrowserMainLoop::CreateThreads() { ...@@ -1052,6 +1092,23 @@ int BrowserMainLoop::CreateThreads() {
non_ui_non_io_task_runner_traits = kUserBlockingTraits; non_ui_non_io_task_runner_traits = kUserBlockingTraits;
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
break; break;
case BrowserThread::CACHE:
TRACE_EVENT_BEGIN1("startup",
"BrowserMainLoop::CreateThreads:start",
"Thread", "BrowserThread::CACHE");
#if defined(OS_WIN)
// TaskScheduler doesn't support async I/O on Windows as CACHE thread is
// the only user and this use case is going away in
// https://codereview.chromium.org/2216583003/.
// TODO(gavinp): Remove this ifdef (and thus enable redirection of the
// CACHE thread on Windows) once that CL lands.
thread_to_start = &cache_thread_;
options = io_message_loop_options;
options.timer_slack = base::TIMER_SLACK_MAXIMUM;
#else // OS_WIN
non_ui_non_io_task_runner_traits = kUserBlockingTraits;
#endif // OS_WIN
break;
case BrowserThread::IO: case BrowserThread::IO:
TRACE_EVENT_BEGIN1("startup", TRACE_EVENT_BEGIN1("startup",
"BrowserMainLoop::CreateThreads:start", "BrowserMainLoop::CreateThreads:start",
...@@ -1249,7 +1306,14 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1249,7 +1306,14 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
// - The PROCESS_LAUNCHER thread must be stopped after IO in case // - The PROCESS_LAUNCHER thread must be stopped after IO in case
// the IO thread posted a task to terminate a process on the // the IO thread posted a task to terminate a process on the
// process launcher thread. // process launcher thread.
//
// - (Not sure why DB stops last.)
switch (thread_id) { switch (thread_id) {
case BrowserThread::DB: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread");
ResetThread_DB();
break;
}
case BrowserThread::FILE: { case BrowserThread::FILE: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread"); TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileThread");
// Clean up state that lives on or uses the FILE thread before it goes // Clean up state that lives on or uses the FILE thread before it goes
...@@ -1259,6 +1323,12 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1259,6 +1323,12 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
ResetThread_FILE(); ResetThread_FILE();
break; break;
} }
case BrowserThread::FILE_USER_BLOCKING: {
TRACE_EVENT0("shutdown",
"BrowserMainLoop::Subsystem:FileUserBlockingThread");
ResetThread_FILE_USER_BLOCKING();
break;
}
case BrowserThread::PROCESS_LAUNCHER: { case BrowserThread::PROCESS_LAUNCHER: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread");
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -1268,6 +1338,15 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -1268,6 +1338,15 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
break; break;
} }
case BrowserThread::CACHE: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread");
#if defined(OS_WIN)
ResetThread_CACHE(std::move(cache_thread_));
#else // defined(OS_WIN)
ResetThread_CACHE();
#endif // defined(OS_WIN)
break;
}
case BrowserThread::IO: { case BrowserThread::IO: {
TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread");
ResetThread_IO(std::move(io_thread_)); ResetThread_IO(std::move(io_thread_));
......
...@@ -316,6 +316,13 @@ class CONTENT_EXPORT BrowserMainLoop { ...@@ -316,6 +316,13 @@ class CONTENT_EXPORT BrowserMainLoop {
// On Android, the PROCESS_LAUNCHER thread is handled by Java, // On Android, the PROCESS_LAUNCHER thread is handled by Java,
// |process_launcher_thread_| is merely a proxy to the real message loop. // |process_launcher_thread_| is merely a proxy to the real message loop.
std::unique_ptr<BrowserProcessSubThread> process_launcher_thread_; std::unique_ptr<BrowserProcessSubThread> process_launcher_thread_;
#elif defined(OS_WIN)
// TaskScheduler doesn't support async I/O on Windows as CACHE thread is
// the only user and this use case is going away in
// https://codereview.chromium.org/2216583003/.
// TODO(gavinp): Remove this (and thus enable redirection of the CACHE thread
// on Windows) once that CL lands.
std::unique_ptr<BrowserProcessSubThread> cache_thread_;
#endif #endif
// Members initialized in |BrowserThreadsStarted()| -------------------------- // Members initialized in |BrowserThreadsStarted()| --------------------------
......
...@@ -34,8 +34,11 @@ namespace { ...@@ -34,8 +34,11 @@ namespace {
// Friendly names for the well-known threads. // Friendly names for the well-known threads.
static const char* const g_browser_thread_names[BrowserThread::ID_COUNT] = { static const char* const g_browser_thread_names[BrowserThread::ID_COUNT] = {
"", // UI (name assembled in browser_main.cc). "", // UI (name assembled in browser_main.cc).
"Chrome_DBThread", // DB
"Chrome_FileThread", // FILE "Chrome_FileThread", // FILE
"Chrome_FileUserBlockingThread", // FILE_USER_BLOCKING
"Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER "Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER
"Chrome_CacheThread", // CACHE
"Chrome_IOThread", // IO "Chrome_IOThread", // IO
}; };
...@@ -208,8 +211,11 @@ void BrowserThreadImpl::Init() { ...@@ -208,8 +211,11 @@ void BrowserThreadImpl::Init() {
} }
#endif // DCHECK_IS_ON() #endif // DCHECK_IS_ON()
if (identifier_ == BrowserThread::FILE || if (identifier_ == BrowserThread::DB ||
identifier_ == BrowserThread::PROCESS_LAUNCHER) { identifier_ == BrowserThread::FILE ||
identifier_ == BrowserThread::FILE_USER_BLOCKING ||
identifier_ == BrowserThread::PROCESS_LAUNCHER ||
identifier_ == BrowserThread::CACHE) {
// Nesting and task observers are not allowed on redirected threads. // Nesting and task observers are not allowed on redirected threads.
base::RunLoop::DisallowNestingOnCurrentThread(); base::RunLoop::DisallowNestingOnCurrentThread();
message_loop()->DisallowTaskObservers(); message_loop()->DisallowTaskObservers();
...@@ -234,12 +240,25 @@ NOINLINE void BrowserThreadImpl::UIThreadRun(base::RunLoop* run_loop) { ...@@ -234,12 +240,25 @@ NOINLINE void BrowserThreadImpl::UIThreadRun(base::RunLoop* run_loop) {
CHECK_GT(line_number, 0); CHECK_GT(line_number, 0);
} }
NOINLINE void BrowserThreadImpl::DBThreadRun(base::RunLoop* run_loop) {
volatile int line_number = __LINE__;
Thread::Run(run_loop);
CHECK_GT(line_number, 0);
}
NOINLINE void BrowserThreadImpl::FileThreadRun(base::RunLoop* run_loop) { NOINLINE void BrowserThreadImpl::FileThreadRun(base::RunLoop* run_loop) {
volatile int line_number = __LINE__; volatile int line_number = __LINE__;
Thread::Run(run_loop); Thread::Run(run_loop);
CHECK_GT(line_number, 0); CHECK_GT(line_number, 0);
} }
NOINLINE void BrowserThreadImpl::FileUserBlockingThreadRun(
base::RunLoop* run_loop) {
volatile int line_number = __LINE__;
Thread::Run(run_loop);
CHECK_GT(line_number, 0);
}
NOINLINE void BrowserThreadImpl::ProcessLauncherThreadRun( NOINLINE void BrowserThreadImpl::ProcessLauncherThreadRun(
base::RunLoop* run_loop) { base::RunLoop* run_loop) {
volatile int line_number = __LINE__; volatile int line_number = __LINE__;
...@@ -247,6 +266,12 @@ NOINLINE void BrowserThreadImpl::ProcessLauncherThreadRun( ...@@ -247,6 +266,12 @@ NOINLINE void BrowserThreadImpl::ProcessLauncherThreadRun(
CHECK_GT(line_number, 0); CHECK_GT(line_number, 0);
} }
NOINLINE void BrowserThreadImpl::CacheThreadRun(base::RunLoop* run_loop) {
volatile int line_number = __LINE__;
Thread::Run(run_loop);
CHECK_GT(line_number, 0);
}
NOINLINE void BrowserThreadImpl::IOThreadRun(base::RunLoop* run_loop) { NOINLINE void BrowserThreadImpl::IOThreadRun(base::RunLoop* run_loop) {
volatile int line_number = __LINE__; volatile int line_number = __LINE__;
Thread::Run(run_loop); Thread::Run(run_loop);
...@@ -273,10 +298,16 @@ void BrowserThreadImpl::Run(base::RunLoop* run_loop) { ...@@ -273,10 +298,16 @@ void BrowserThreadImpl::Run(base::RunLoop* run_loop) {
switch (identifier_) { switch (identifier_) {
case BrowserThread::UI: case BrowserThread::UI:
return UIThreadRun(run_loop); return UIThreadRun(run_loop);
case BrowserThread::DB:
return DBThreadRun(run_loop);
case BrowserThread::FILE: case BrowserThread::FILE:
return FileThreadRun(run_loop); return FileThreadRun(run_loop);
case BrowserThread::FILE_USER_BLOCKING:
return FileUserBlockingThreadRun(run_loop);
case BrowserThread::PROCESS_LAUNCHER: case BrowserThread::PROCESS_LAUNCHER:
return ProcessLauncherThreadRun(run_loop); return ProcessLauncherThreadRun(run_loop);
case BrowserThread::CACHE:
return CacheThreadRun(run_loop);
case BrowserThread::IO: case BrowserThread::IO:
return IOThreadRun(run_loop); return IOThreadRun(run_loop);
case BrowserThread::ID_COUNT: case BrowserThread::ID_COUNT:
......
...@@ -78,8 +78,11 @@ class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread, ...@@ -78,8 +78,11 @@ class CONTENT_EXPORT BrowserThreadImpl : public BrowserThread,
// The following are unique function names that makes it possible to tell // The following are unique function names that makes it possible to tell
// the thread id from the callstack alone in crash dumps. // the thread id from the callstack alone in crash dumps.
void UIThreadRun(base::RunLoop* run_loop); void UIThreadRun(base::RunLoop* run_loop);
void DBThreadRun(base::RunLoop* run_loop);
void FileThreadRun(base::RunLoop* run_loop); void FileThreadRun(base::RunLoop* run_loop);
void FileUserBlockingThreadRun(base::RunLoop* run_loop);
void ProcessLauncherThreadRun(base::RunLoop* run_loop); void ProcessLauncherThreadRun(base::RunLoop* run_loop);
void CacheThreadRun(base::RunLoop* run_loop);
void IOThreadRun(base::RunLoop* run_loop); void IOThreadRun(base::RunLoop* run_loop);
static bool PostTaskHelper(BrowserThread::ID identifier, static bool PostTaskHelper(BrowserThread::ID identifier,
......
...@@ -68,6 +68,9 @@ class CONTENT_EXPORT BrowserThread { ...@@ -68,6 +68,9 @@ class CONTENT_EXPORT BrowserThread {
// The main thread in the browser. // The main thread in the browser.
UI, UI,
// This is the thread that interacts with the database.
DB,
// This is the thread that interacts with the file system. // This is the thread that interacts with the file system.
// DEPRECATED: prefer base/task_scheduler/post_task.h for new classes // DEPRECATED: prefer base/task_scheduler/post_task.h for new classes
// requiring a background file I/O task runner, i.e.: // requiring a background file I/O task runner, i.e.:
...@@ -78,11 +81,23 @@ class CONTENT_EXPORT BrowserThread { ...@@ -78,11 +81,23 @@ class CONTENT_EXPORT BrowserThread {
// is visible but non-blocking to the user. // is visible but non-blocking to the user.
FILE, FILE,
// Used for file system operations that block user interactions.
// Responsiveness of this thread affect users.
// DEPRECATED: prefer base/task_scheduler/post_task.h for new classes
// requiring a user-blocking file I/O task runner, i.e.:
// base::CreateSequencedTaskRunnerWithTraits(
// {base::MayBlock(), base::TaskPriority::USER_BLOCKING})
FILE_USER_BLOCKING,
// Used to launch and terminate Chrome processes. // Used to launch and terminate Chrome processes.
PROCESS_LAUNCHER, PROCESS_LAUNCHER,
// This is the thread to handle slow HTTP cache operations.
CACHE,
// This is the thread that processes non-blocking IO, i.e. IPC and network. // This is the thread that processes non-blocking IO, i.e. IPC and network.
// Blocking IO should happen in TaskScheduler. // Blocking IO should happen on other threads like DB, FILE,
// FILE_USER_BLOCKING and CACHE depending on the usage.
IO, IO,
// NOTE: do not add new threads here that are only used by a small number of // NOTE: do not add new threads here that are only used by a small number of
...@@ -306,6 +321,7 @@ class CONTENT_EXPORT BrowserThread { ...@@ -306,6 +321,7 @@ class CONTENT_EXPORT BrowserThread {
struct DeleteOnUIThread : public DeleteOnThread<UI> { }; struct DeleteOnUIThread : public DeleteOnThread<UI> { };
struct DeleteOnIOThread : public DeleteOnThread<IO> { }; struct DeleteOnIOThread : public DeleteOnThread<IO> { };
struct DeleteOnFileThread : public DeleteOnThread<FILE> { }; struct DeleteOnFileThread : public DeleteOnThread<FILE> { };
struct DeleteOnDBThread : public DeleteOnThread<DB> { };
// Returns an appropriate error message for when DCHECK_CURRENTLY_ON() fails. // Returns an appropriate error message for when DCHECK_CURRENTLY_ON() fails.
static std::string GetDCheckCurrentlyOnErrorMessage(ID expected); static std::string GetDCheckCurrentlyOnErrorMessage(ID expected);
......
...@@ -45,10 +45,16 @@ TestBrowserThreadBundle::~TestBrowserThreadBundle() { ...@@ -45,10 +45,16 @@ TestBrowserThreadBundle::~TestBrowserThreadBundle() {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
io_thread_->Stop(); io_thread_->Stop();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
cache_thread_->Stop();
base::RunLoop().RunUntilIdle();
process_launcher_thread_->Stop(); process_launcher_thread_->Stop();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
file_user_blocking_thread_->Stop();
base::RunLoop().RunUntilIdle();
file_thread_->Stop(); file_thread_->Stop();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
db_thread_->Stop();
base::RunLoop().RunUntilIdle();
// This is the point at which we normally shut down the thread pool. So flush // This is the point at which we normally shut down the thread pool. So flush
// it again in case any shutdown tasks have been posted to the pool from the // it again in case any shutdown tasks have been posted to the pool from the
// threads above. // threads above.
...@@ -129,6 +135,14 @@ void TestBrowserThreadBundle::Init() { ...@@ -129,6 +135,14 @@ void TestBrowserThreadBundle::Init() {
void TestBrowserThreadBundle::CreateBrowserThreads() { void TestBrowserThreadBundle::CreateBrowserThreads() {
CHECK(!threads_created_); CHECK(!threads_created_);
if (options_ & REAL_DB_THREAD) {
db_thread_ = base::MakeUnique<TestBrowserThread>(BrowserThread::DB);
db_thread_->Start();
} else {
db_thread_ = base::MakeUnique<TestBrowserThread>(
BrowserThread::DB, base::MessageLoop::current());
}
if (options_ & REAL_FILE_THREAD) { if (options_ & REAL_FILE_THREAD) {
file_thread_ = base::MakeUnique<TestBrowserThread>(BrowserThread::FILE); file_thread_ = base::MakeUnique<TestBrowserThread>(BrowserThread::FILE);
file_thread_->Start(); file_thread_->Start();
...@@ -137,8 +151,12 @@ void TestBrowserThreadBundle::CreateBrowserThreads() { ...@@ -137,8 +151,12 @@ void TestBrowserThreadBundle::CreateBrowserThreads() {
BrowserThread::FILE, base::MessageLoop::current()); BrowserThread::FILE, base::MessageLoop::current());
} }
file_user_blocking_thread_ = base::MakeUnique<TestBrowserThread>(
BrowserThread::FILE_USER_BLOCKING, base::MessageLoop::current());
process_launcher_thread_ = base::MakeUnique<TestBrowserThread>( process_launcher_thread_ = base::MakeUnique<TestBrowserThread>(
BrowserThread::PROCESS_LAUNCHER, base::MessageLoop::current()); BrowserThread::PROCESS_LAUNCHER, base::MessageLoop::current());
cache_thread_ = base::MakeUnique<TestBrowserThread>(
BrowserThread::CACHE, base::MessageLoop::current());
if (options_ & REAL_IO_THREAD) { if (options_ & REAL_IO_THREAD) {
io_thread_ = base::MakeUnique<TestBrowserThread>(BrowserThread::IO); io_thread_ = base::MakeUnique<TestBrowserThread>(BrowserThread::IO);
......
...@@ -113,9 +113,10 @@ class TestBrowserThreadBundle { ...@@ -113,9 +113,10 @@ class TestBrowserThreadBundle {
enum Options { enum Options {
DEFAULT = 0, DEFAULT = 0,
IO_MAINLOOP = 1 << 0, IO_MAINLOOP = 1 << 0,
REAL_FILE_THREAD = 1 << 1, REAL_DB_THREAD = 1 << 1,
REAL_IO_THREAD = 1 << 2, REAL_FILE_THREAD = 1 << 2,
DONT_CREATE_BROWSER_THREADS = 1 << 3, REAL_IO_THREAD = 1 << 3,
DONT_CREATE_BROWSER_THREADS = 1 << 4,
}; };
TestBrowserThreadBundle(); TestBrowserThreadBundle();
...@@ -132,8 +133,11 @@ class TestBrowserThreadBundle { ...@@ -132,8 +133,11 @@ class TestBrowserThreadBundle {
std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_; std::unique_ptr<base::test::ScopedTaskEnvironment> scoped_task_environment_;
std::unique_ptr<TestBrowserThread> ui_thread_; std::unique_ptr<TestBrowserThread> ui_thread_;
std::unique_ptr<TestBrowserThread> db_thread_;
std::unique_ptr<TestBrowserThread> file_thread_; std::unique_ptr<TestBrowserThread> file_thread_;
std::unique_ptr<TestBrowserThread> file_user_blocking_thread_;
std::unique_ptr<TestBrowserThread> process_launcher_thread_; std::unique_ptr<TestBrowserThread> process_launcher_thread_;
std::unique_ptr<TestBrowserThread> cache_thread_;
std::unique_ptr<TestBrowserThread> io_thread_; std::unique_ptr<TestBrowserThread> io_thread_;
int options_; int options_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment