diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-20 23:28:40 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-20 23:28:40 +0000 |
commit | 04175ff64af678efbae16b61ed37e0854076e285 (patch) | |
tree | 5e41584369f54cb203630f90df0940dcff0a6d12 /webkit | |
parent | 0d37507e17cb2c83ab752eecdfe08781bb4aecd0 (diff) | |
download | chromium_src-04175ff64af678efbae16b61ed37e0854076e285.zip chromium_src-04175ff64af678efbae16b61ed37e0854076e285.tar.gz chromium_src-04175ff64af678efbae16b61ed37e0854076e285.tar.bz2 |
Test shell: create a dedicated thread for the cache.
BUG=26729
TEST=none
Review URL: http://codereview.chromium.org/2110014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/test_shell/test_shell_request_context.cc | 10 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_request_context.h | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc index 25cf877..a53e349 100644 --- a/webkit/tools/test_shell/test_shell_request_context.cc +++ b/webkit/tools/test_shell/test_shell_request_context.cc @@ -24,14 +24,14 @@ #endif #include "webkit/glue/webkit_glue.h" -TestShellRequestContext::TestShellRequestContext() { +TestShellRequestContext::TestShellRequestContext() : cache_thread_("cache") { Init(FilePath(), net::HttpCache::NORMAL, false); } TestShellRequestContext::TestShellRequestContext( const FilePath& cache_path, net::HttpCache::Mode cache_mode, - bool no_proxy) { + bool no_proxy) : cache_thread_("cache") { Init(cache_path, cache_mode, no_proxy); } @@ -78,9 +78,13 @@ void TestShellRequestContext::Init( base::EnsureNSPRInit(); #endif + if (!cache_path.empty()) + CHECK(cache_thread_.StartWithOptions( + base::Thread::Options(MessageLoop::TYPE_IO, 0))); + net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, - cache_path, 0, NULL); + cache_path, 0, cache_thread_.message_loop_proxy()); net::HttpCache* cache = new net::HttpCache(NULL, host_resolver_, proxy_service_, diff --git a/webkit/tools/test_shell/test_shell_request_context.h b/webkit/tools/test_shell/test_shell_request_context.h index 2a1a241..1bba2f0 100644 --- a/webkit/tools/test_shell/test_shell_request_context.h +++ b/webkit/tools/test_shell/test_shell_request_context.h @@ -5,6 +5,7 @@ #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_REQUEST_CONTEXT_H__ #define WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_REQUEST_CONTEXT_H__ +#include "base/thread.h" #include "net/http/http_cache.h" #include "net/url_request/url_request_context.h" @@ -29,6 +30,8 @@ class TestShellRequestContext : public URLRequestContext { void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode, bool no_proxy); + + base::Thread cache_thread_; }; #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_SHELL_REQUEST_CONTEXT_H__ |