diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-29 22:46:55 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-29 22:46:55 +0000 |
commit | 35f2094cd0ac27018aff2646445f44c3f9ee8d36 (patch) | |
tree | 0f4892fb2f6bcf9d5f044e70c1cf1ed0d42bb882 /webkit/tools/test_shell/simple_appcache_system.h | |
parent | 6d38a7fc2594f14cbb87e28389c81965381b64e8 (diff) | |
download | chromium_src-35f2094cd0ac27018aff2646445f44c3f9ee8d36.zip chromium_src-35f2094cd0ac27018aff2646445f44c3f9ee8d36.tar.gz chromium_src-35f2094cd0ac27018aff2646445f44c3f9ee8d36.tar.bz2 |
AppCacheDatabase and SQL based AppCacheStorageImpl.
Still nothing is being written to disk with this CL,
in-memory SQLite and DiskCaches are being utilized.
Responses are not yet being removed from the DiskCasche
when the should be. Once that's done (in the next CL), we'll
start saving things on disk.
BUG=none
TEST=appcache_database_unittest.cc, appcache_storage_impl_unittest.cc
Review URL: http://codereview.chromium.org/518020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/simple_appcache_system.h')
-rw-r--r-- | webkit/tools/test_shell/simple_appcache_system.h | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/webkit/tools/test_shell/simple_appcache_system.h b/webkit/tools/test_shell/simple_appcache_system.h index adeedd6..0ea465a 100644 --- a/webkit/tools/test_shell/simple_appcache_system.h +++ b/webkit/tools/test_shell/simple_appcache_system.h @@ -73,16 +73,38 @@ class SimpleAppCacheSystem : public MessageLoop::DestructionObserver { instance_->GetExtraResponseBits(request, cache_id, manifest_url); } - private: - friend class SimpleBackendProxy; - friend class SimpleFrontendProxy; - friend class appcache::AppCacheThread; + // Some unittests create their own IO and DB threads. enum AppCacheThreadID { DB_THREAD_ID, IO_THREAD_ID, }; + class ThreadProvider { + public: + virtual ~ThreadProvider() {} + virtual bool PostTask( + int id, + const tracked_objects::Location& from_here, + Task* task) = 0; + virtual bool CurrentlyOn(int id) = 0; + }; + + static void set_thread_provider(ThreadProvider* provider) { + DCHECK(instance_); + DCHECK(!provider || !instance_->thread_provider_); + instance_->thread_provider_ = provider; + } + + static ThreadProvider* thread_provider() { + return instance_ ? instance_->thread_provider_ : NULL; + } + + private: + friend class SimpleBackendProxy; + friend class SimpleFrontendProxy; + friend class appcache::AppCacheThread; + // Instance methods called by our static public methods void InitOnUIThread(const FilePath& cache_directory); void InitOnIOThread(URLRequestContext* request_context); @@ -136,6 +158,9 @@ class SimpleAppCacheSystem : public MessageLoop::DestructionObserver { // We start a thread for use as the DB thread. base::Thread db_thread_; + // Some unittests create there own IO and DB threads. + ThreadProvider* thread_provider_; + // A low-tech singleton. static SimpleAppCacheSystem* instance_; }; |