Commit 31dbf9db authored by michaeln@google.com's avatar michaeln@google.com

Create a secondary file thread, FILE_USER_BLOCKING, for tasks requiring file...

Create a secondary file thread, FILE_USER_BLOCKING, for tasks requiring file IO which have user waiting for the results. Process appcache background tasks on that thread.

BUG=68894,78359
Review URL: http://codereview.chromium.org/8366020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113317 0039d316-1c4b-4281-b951-d872f2087c98
parent acc32d12
...@@ -387,6 +387,7 @@ ExtensionServiceTestBase::ExtensionServiceTestBase() ...@@ -387,6 +387,7 @@ ExtensionServiceTestBase::ExtensionServiceTestBase()
db_thread_(BrowserThread::DB, &loop_), db_thread_(BrowserThread::DB, &loop_),
webkit_thread_(BrowserThread::WEBKIT, &loop_), webkit_thread_(BrowserThread::WEBKIT, &loop_),
file_thread_(BrowserThread::FILE, &loop_), file_thread_(BrowserThread::FILE, &loop_),
file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, &loop_),
io_thread_(BrowserThread::IO, &loop_) { io_thread_(BrowserThread::IO, &loop_) {
FilePath test_data_dir; FilePath test_data_dir;
if (!PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)) { if (!PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)) {
......
...@@ -62,6 +62,7 @@ class ExtensionServiceTestBase : public testing::Test { ...@@ -62,6 +62,7 @@ class ExtensionServiceTestBase : public testing::Test {
content::TestBrowserThread db_thread_; content::TestBrowserThread db_thread_;
content::TestBrowserThread webkit_thread_; content::TestBrowserThread webkit_thread_;
content::TestBrowserThread file_thread_; content::TestBrowserThread file_thread_;
content::TestBrowserThread file_user_blocking_thread_;
content::TestBrowserThread io_thread_; content::TestBrowserThread io_thread_;
}; };
......
...@@ -55,6 +55,10 @@ void ThreadUnresponsive_FILE() { ...@@ -55,6 +55,10 @@ void ThreadUnresponsive_FILE() {
CHECK(false); CHECK(false);
} }
void ThreadUnresponsive_FILE_USER_BLOCKING() {
CHECK(false);
}
void ThreadUnresponsive_PROCESS_LAUNCHER() { void ThreadUnresponsive_PROCESS_LAUNCHER() {
CHECK(false); CHECK(false);
} }
...@@ -88,6 +92,8 @@ void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) { ...@@ -88,6 +92,8 @@ void CrashBecauseThreadWasUnresponsive(BrowserThread::ID thread_id) {
return ThreadUnresponsive_WEBKIT(); return ThreadUnresponsive_WEBKIT();
case BrowserThread::FILE: case BrowserThread::FILE:
return ThreadUnresponsive_FILE(); return ThreadUnresponsive_FILE();
case BrowserThread::FILE_USER_BLOCKING:
return ThreadUnresponsive_FILE_USER_BLOCKING();
case BrowserThread::PROCESS_LAUNCHER: case BrowserThread::PROCESS_LAUNCHER:
return ThreadUnresponsive_PROCESS_LAUNCHER(); return ThreadUnresponsive_PROCESS_LAUNCHER();
case BrowserThread::CACHE: case BrowserThread::CACHE:
...@@ -583,6 +589,10 @@ void ThreadWatcherList::InitializeAndStartWatching( ...@@ -583,6 +589,10 @@ void ThreadWatcherList::InitializeAndStartWatching(
StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime, StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_thread_names, unresponsive_threshold, crash_on_hang_thread_names,
live_threads_threshold); live_threads_threshold);
StartWatching(BrowserThread::FILE_USER_BLOCKING, "FILE_USER_BLOCKING",
kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_thread_names,
live_threads_threshold);
StartWatching(BrowserThread::CACHE, "CACHE", kSleepTime, kUnresponsiveTime, StartWatching(BrowserThread::CACHE, "CACHE", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_thread_names, unresponsive_threshold, crash_on_hang_thread_names,
live_threads_threshold); live_threads_threshold);
......
...@@ -33,9 +33,11 @@ void ChromeAppCacheService::InitializeOnIOThread( ...@@ -33,9 +33,11 @@ void ChromeAppCacheService::InitializeOnIOThread(
content::NotificationService::AllSources()); content::NotificationService::AllSources());
// Init our base class. // Init our base class.
Initialize(cache_path_, Initialize(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), cache_path_,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); BrowserThread::GetMessageLoopProxyForThread(
BrowserThread::FILE_USER_BLOCKING),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
set_appcache_policy(this); set_appcache_policy(this);
set_special_storage_policy(special_storage_policy); set_special_storage_policy(special_storage_policy);
} }
......
...@@ -40,8 +40,9 @@ class ChromeAppCacheServiceTest : public testing::Test { ...@@ -40,8 +40,9 @@ class ChromeAppCacheServiceTest : public testing::Test {
kProtectedManifestURL(kProtectedManifest), kProtectedManifestURL(kProtectedManifest),
kNormalManifestURL(kNormalManifest), kNormalManifestURL(kNormalManifest),
kSessionOnlyManifestURL(kSessionOnlyManifest), kSessionOnlyManifestURL(kSessionOnlyManifest),
db_thread_(BrowserThread::DB, &message_loop_),
file_thread_(BrowserThread::FILE, &message_loop_), file_thread_(BrowserThread::FILE, &message_loop_),
file_user_blocking_thread_(
BrowserThread::FILE_USER_BLOCKING, &message_loop_),
cache_thread_(BrowserThread::CACHE, &message_loop_), cache_thread_(BrowserThread::CACHE, &message_loop_),
io_thread_(BrowserThread::IO, &message_loop_) { io_thread_(BrowserThread::IO, &message_loop_) {
} }
...@@ -59,8 +60,8 @@ class ChromeAppCacheServiceTest : public testing::Test { ...@@ -59,8 +60,8 @@ class ChromeAppCacheServiceTest : public testing::Test {
const GURL kSessionOnlyManifestURL; const GURL kSessionOnlyManifestURL;
private: private:
BrowserThreadImpl db_thread_;
BrowserThreadImpl file_thread_; BrowserThreadImpl file_thread_;
BrowserThreadImpl file_user_blocking_thread_;
BrowserThreadImpl cache_thread_; BrowserThreadImpl cache_thread_;
BrowserThreadImpl io_thread_; BrowserThreadImpl io_thread_;
}; };
......
...@@ -322,6 +322,9 @@ void BrowserMainLoop::RunMainMessageLoopParts( ...@@ -322,6 +322,9 @@ void BrowserMainLoop::RunMainMessageLoopParts(
// Special case as WebKitThread is a separate // Special case as WebKitThread is a separate
// type. |thread_to_start| is not used in this case. // type. |thread_to_start| is not used in this case.
break; break;
case BrowserThread::FILE_USER_BLOCKING:
thread_to_start = &file_user_blocking_thread_;
break;
case BrowserThread::FILE: case BrowserThread::FILE:
thread_to_start = &file_thread_; thread_to_start = &file_thread_;
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -448,6 +451,9 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { ...@@ -448,6 +451,9 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() {
// Special case as WebKitThread is a separate // Special case as WebKitThread is a separate
// type. |thread_to_stop| is not used in this case. // type. |thread_to_stop| is not used in this case.
break; break;
case BrowserThread::FILE_USER_BLOCKING:
thread_to_stop = &file_user_blocking_thread_;
break;
case BrowserThread::FILE: case BrowserThread::FILE:
thread_to_stop = &file_thread_; thread_to_stop = &file_thread_;
break; break;
......
...@@ -81,6 +81,7 @@ class BrowserMainLoop { ...@@ -81,6 +81,7 @@ class BrowserMainLoop {
scoped_ptr<BrowserThreadImpl> main_thread_; scoped_ptr<BrowserThreadImpl> main_thread_;
scoped_ptr<BrowserProcessSubThread> db_thread_; scoped_ptr<BrowserProcessSubThread> db_thread_;
scoped_ptr<WebKitThread> webkit_thread_; scoped_ptr<WebKitThread> webkit_thread_;
scoped_ptr<BrowserProcessSubThread> file_user_blocking_thread_;
scoped_ptr<BrowserProcessSubThread> file_thread_; scoped_ptr<BrowserProcessSubThread> file_thread_;
scoped_ptr<BrowserProcessSubThread> process_launcher_thread_; scoped_ptr<BrowserProcessSubThread> process_launcher_thread_;
scoped_ptr<BrowserProcessSubThread> cache_thread_; scoped_ptr<BrowserProcessSubThread> cache_thread_;
......
...@@ -21,6 +21,7 @@ static const char* g_browser_thread_names[BrowserThread::ID_COUNT] = { ...@@ -21,6 +21,7 @@ static const char* g_browser_thread_names[BrowserThread::ID_COUNT] = {
"Chrome_DBThread", // DB "Chrome_DBThread", // DB
"Chrome_WebKitThread", // WEBKIT "Chrome_WebKitThread", // WEBKIT
"Chrome_FileThread", // FILE "Chrome_FileThread", // FILE
"Chrome_FileUserBlockingThread", // FILE_USER_BLOCKING
"Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER "Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER
"Chrome_CacheThread", // CACHE "Chrome_CacheThread", // CACHE
"Chrome_IOThread", // IO "Chrome_IOThread", // IO
......
...@@ -69,6 +69,10 @@ class CONTENT_EXPORT BrowserThread { ...@@ -69,6 +69,10 @@ class CONTENT_EXPORT BrowserThread {
// This is the thread that interacts with the file system. // This is the thread that interacts with the file system.
FILE, FILE,
// Used for file system operations that block user interactions.
// Responsiveness of this thread affect users.
FILE_USER_BLOCKING,
// Used to launch and terminate Chrome processes. // Used to launch and terminate Chrome processes.
PROCESS_LAUNCHER, PROCESS_LAUNCHER,
......
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