summaryrefslogtreecommitdiffstats
path: root/chrome/worker/worker_thread.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-08 00:32:44 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-08 00:32:44 +0000
commit07331d79c72e07472722ed527ddfb3ac7f0b2c15 (patch)
tree51093c3e27efb1140d93282fa087723a01d23619 /chrome/worker/worker_thread.cc
parenta0c7147644ac9b90c1730916bdab70d602a40fc9 (diff)
downloadchromium_src-07331d79c72e07472722ed527ddfb3ac7f0b2c15.zip
chromium_src-07331d79c72e07472722ed527ddfb3ac7f0b2c15.tar.gz
chromium_src-07331d79c72e07472722ed527ddfb3ac7f0b2c15.tar.bz2
Add some more IPC plumbing and scaffolding to support having appcache work in workers. Everything is still stubbed out at runtime (runtime feature is still disabled in the worker process, and the values in the IPC messages are all zero'd out).
* Widen the CreateWorker IPC message sent from the browser to the worker process to contain additional data needed to initialize an appcache for that worker. * Add a new worker specific WorkerWebApplicationCacheHostImpl class and instantiate one with the initialization data received in the IPC. * Give the WorkerThread an AppCacheDispatcher. * Propagate the cmd-line argument to disable the appcache to the worker process. * Fixup DEPs to show that chrome/workers depends on webkit/appcache BUG=39368 TEST=thinking about what tests to put together for this CL Review URL: http://codereview.chromium.org/1719007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/worker/worker_thread.cc')
-rw-r--r--chrome/worker/worker_thread.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/chrome/worker/worker_thread.cc b/chrome/worker/worker_thread.cc
index 8f32a6a..3e4a1d1 100644
--- a/chrome/worker/worker_thread.cc
+++ b/chrome/worker/worker_thread.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/thread_local.h"
+#include "chrome/common/appcache/appcache_dispatcher.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/db_message_filter.h"
#include "chrome/common/web_database_observer_impl.h"
@@ -29,16 +30,22 @@ WorkerThread::WorkerThread() {
webkit_client_.reset(new WorkerWebKitClientImpl);
WebKit::initialize(webkit_client_.get());
+ appcache_dispatcher_.reset(new AppCacheDispatcher(this));
+
web_database_observer_impl_.reset(new WebDatabaseObserverImpl(this));
WebKit::WebDatabase::setObserver(web_database_observer_impl_.get());
+ db_message_filter_ = new DBMessageFilter();
+ channel()->AddFilter(db_message_filter_.get());
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
WebKit::WebRuntimeFeatures::enableDatabase(
!command_line.HasSwitch(switches::kDisableDatabases));
- db_message_filter_ = new DBMessageFilter();
- channel()->AddFilter(db_message_filter_.get());
+ // TODO(michaeln): Enable once the browser process is ready to receive
+ // the appcache messages.
+ WebKit::WebRuntimeFeatures::enableApplicationCache(false &&
+ !command_line.HasSwitch(switches::kDisableApplicationCache));
#if defined(OS_WIN)
// We don't yet support notifications on non-Windows, so hide it from pages.
@@ -64,20 +71,27 @@ WorkerThread* WorkerThread::current() {
}
void WorkerThread::OnControlMessageReceived(const IPC::Message& msg) {
+ // Appcache messages are handled by a delegate.
+ if (appcache_dispatcher_->OnMessageReceived(msg))
+ return;
+
IPC_BEGIN_MESSAGE_MAP(WorkerThread, msg)
IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateWorker)
IPC_END_MESSAGE_MAP()
}
-void WorkerThread::OnCreateWorker(const GURL& url,
- bool is_shared,
- const string16& name,
- int route_id) {
+void WorkerThread::OnCreateWorker(
+ const WorkerProcessMsg_CreateWorker_Params& params) {
+ WorkerAppCacheInitInfo appcache_init_info(
+ params.is_shared, params.creator_process_id,
+ params.creator_appcache_host_id,
+ params.shared_worker_appcache_id);
+
// WebWorkerStub and WebSharedWorkerStub own themselves.
- if (is_shared)
- new WebSharedWorkerStub(name, route_id);
+ if (params.is_shared)
+ new WebSharedWorkerStub(params.name, params.route_id, appcache_init_info);
else
- new WebWorkerStub(url, route_id);
+ new WebWorkerStub(params.url, params.route_id, appcache_init_info);
}
// The browser process is likely dead. Terminate all workers.