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

Unified Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 2249005: AppCache: Use a dedicated thread for the disk cache. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Bound to IO thread Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/test_shell/simple_resource_loader_bridge.h ('k') | webkit/tools/test_shell/test_shell.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/simple_resource_loader_bridge.cc
===================================================================
--- webkit/tools/test_shell/simple_resource_loader_bridge.cc (revision 48989)
+++ webkit/tools/test_shell/simple_resource_loader_bridge.cc (working copy)
@@ -86,6 +86,7 @@
TestShellRequestContextParams* g_request_context_params = NULL;
URLRequestContext* g_request_context = NULL;
+base::Thread* g_cache_thread = NULL;
//-----------------------------------------------------------------------------
@@ -733,6 +734,10 @@
delete g_io_thread;
g_io_thread = NULL;
+ DCHECK(g_cache_thread);
+ delete g_cache_thread;
+ g_cache_thread = NULL;
+
DCHECK(!g_request_context) << "should have been nulled by thread dtor";
} else {
delete g_request_context_params;
@@ -788,6 +793,13 @@
base::EnsureNSPRInit();
#endif
+ // Create the cache thread. We want the cache thread to outlive the IO thread,
+ // so its lifetime is bonded to the IO thread lifetime.
+ DCHECK(!g_cache_thread);
+ g_cache_thread = new base::Thread("cache");
+ CHECK(g_cache_thread->StartWithOptions(
+ base::Thread::Options(MessageLoop::TYPE_IO, 0)));
+
g_io_thread = new IOThread();
base::Thread::Options options;
options.message_loop_type = MessageLoop::TYPE_IO;
@@ -804,3 +816,9 @@
g_io_thread->SetAcceptAllCookies(accept_all_cookies);
}
}
+
+// static
+scoped_refptr<base::MessageLoopProxy>
+ SimpleResourceLoaderBridge::GetCacheThread() {
+ return g_cache_thread->message_loop_proxy();
+}
« no previous file with comments | « webkit/tools/test_shell/simple_resource_loader_bridge.h ('k') | webkit/tools/test_shell/test_shell.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698