summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 22:34:24 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 22:34:24 +0000
commitd2896ea20748e43560e4b38a3fcb33154a5da23b (patch)
treeb712b98bcb80dda24aaf758c08a9ed8413d1d8a0
parent30bf9fd6ad27d43208f8b48a927fa713ac6bd285 (diff)
downloadchromium_src-d2896ea20748e43560e4b38a3fcb33154a5da23b.zip
chromium_src-d2896ea20748e43560e4b38a3fcb33154a5da23b.tar.gz
chromium_src-d2896ea20748e43560e4b38a3fcb33154a5da23b.tar.bz2
Plumbing for providing a cache thread MessageLoop to the DiskCache backend.
BUG=26730 TEST=none Review URL: http://codereview.chromium.org/1115002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42014 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/appcache/chrome_appcache_service.cc3
-rw-r--r--webkit/appcache/appcache_thread.cc1
-rw-r--r--webkit/appcache/appcache_thread.h11
-rw-r--r--webkit/tools/test_shell/simple_appcache_system.cc3
4 files changed, 14 insertions, 4 deletions
diff --git a/chrome/browser/appcache/chrome_appcache_service.cc b/chrome/browser/appcache/chrome_appcache_service.cc
index 8a5160a..2fb7772 100644
--- a/chrome/browser/appcache/chrome_appcache_service.cc
+++ b/chrome/browser/appcache/chrome_appcache_service.cc
@@ -23,7 +23,8 @@ ChromeAppCacheService::ChromeAppCacheService(
if (!has_initialized_thread_ids) {
has_initialized_thread_ids = true;
- appcache::AppCacheThread::InitIDs(ChromeThread::DB, ChromeThread::IO);
+ appcache::AppCacheThread::Init(ChromeThread::DB, ChromeThread::IO,
+ NULL); // TODO(michaeln): cache_thread
}
host_contents_settings_map_ = request_context->host_content_settings_map();
diff --git a/webkit/appcache/appcache_thread.cc b/webkit/appcache/appcache_thread.cc
index 579cb53..56a34e6 100644
--- a/webkit/appcache/appcache_thread.cc
+++ b/webkit/appcache/appcache_thread.cc
@@ -9,5 +9,6 @@ namespace appcache {
// static
int AppCacheThread::db_;
int AppCacheThread::io_;
+MessageLoop* AppCacheThread::disk_cache_thread_;
} // namespace appcache
diff --git a/webkit/appcache/appcache_thread.h b/webkit/appcache/appcache_thread.h
index 7224d23..7a0a70c 100644
--- a/webkit/appcache/appcache_thread.h
+++ b/webkit/appcache/appcache_thread.h
@@ -11,21 +11,27 @@ namespace tracked_objects {
class Location;
}
+class MessageLoop;
+
namespace appcache {
// The appcache system uses two threads, an IO thread and a DB thread.
// It does not create these threads, the embedder is responsible for
// providing them to the appcache library by providing a concrete
// implementation of the PostTask and CurrentlyOn methods declared here,
-// and by calling the InitIDs method prior to using the appcache library.
+// and by calling the Init method prior to using the appcache library.
+// The disk_cache also requires the embedder to provide a thread message
+// loop.
class AppCacheThread {
public:
- static void InitIDs(int db, int io) {
+ static void Init(int db, int io, MessageLoop* disk_cache_thread) {
db_ = db;
io_ = io;
+ disk_cache_thread_ = disk_cache_thread;
}
static int db() { return db_; }
static int io() { return io_; }
+ static MessageLoop* disk_cache_thread() { return disk_cache_thread_; }
static bool PostTask(int id,
const tracked_objects::Location& from_here,
@@ -45,6 +51,7 @@ class AppCacheThread {
static int db_;
static int io_;
+ static MessageLoop* disk_cache_thread_;
};
} // namespace appcache
diff --git a/webkit/tools/test_shell/simple_appcache_system.cc b/webkit/tools/test_shell/simple_appcache_system.cc
index b07313a..8627b66 100644
--- a/webkit/tools/test_shell/simple_appcache_system.cc
+++ b/webkit/tools/test_shell/simple_appcache_system.cc
@@ -303,7 +303,8 @@ SimpleAppCacheSystem::~SimpleAppCacheSystem() {
void SimpleAppCacheSystem::InitOnUIThread(
const FilePath& cache_directory) {
DCHECK(!ui_message_loop_);
- AppCacheThread::InitIDs(DB_THREAD_ID, IO_THREAD_ID);
+ // TODO(michaeln): provide a cache_thread message loop
+ AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID, NULL);
ui_message_loop_ = MessageLoop::current();
cache_directory_ = cache_directory;
}