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

Unified Diff: chrome/browser/worker_host/worker_process_host.cc

Issue 5625003: Make the AppCacheDispatcherHost be a MessageFilter so that ResourceMessageFil... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix dependency issue in AppCacheDispatcherHost Created 10 years 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
Index: chrome/browser/worker_host/worker_process_host.cc
===================================================================
--- chrome/browser/worker_host/worker_process_host.cc (revision 68122)
+++ chrome/browser/worker_host/worker_process_host.cc (working copy)
@@ -69,8 +69,6 @@
ChromeURLRequestContext *request_context)
: BrowserChildProcessHost(WORKER_PROCESS, resource_dispatcher_host),
request_context_(request_context),
- appcache_dispatcher_host_(
- new AppCacheDispatcherHost(request_context)),
ALLOW_THIS_IN_INITIALIZER_LIST(blob_dispatcher_host_(
new BlobDispatcherHost(
this->id(), request_context->blob_storage_context()))),
@@ -85,10 +83,14 @@
db_dispatcher_host_ = new DatabaseDispatcherHost(
request_context->database_tracker(), this,
request_context_->host_content_settings_map());
- appcache_dispatcher_host_->Initialize(this);
}
WorkerProcessHost::~WorkerProcessHost() {
+ for (size_t i = 0; i < filters_.size(); ++i) {
+ filters_[i]->OnChannelClosing();
+ filters_[i]->OnFilterRemoved();
+ }
+
// Shut down the database dispatcher host.
db_dispatcher_host_->Shutdown();
@@ -215,9 +217,18 @@
base::PLATFORM_FILE_WRITE_ATTRIBUTES);
}
+ CreateMessageFilters();
+
return true;
}
+void WorkerProcessHost::CreateMessageFilters() {
+ filters_.push_back(new AppCacheDispatcherHost(request_context_, id()));
jennb 2010/12/04 00:31:51 I'm guessing you're switching the other dispatcher
+
+ for (size_t i = 0; i < filters_.size(); ++i)
+ filters_[i]->OnFilterAdded(channel());
+}
+
void WorkerProcessHost::CreateWorker(const WorkerInstance& instance) {
ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL(
id(), instance.url());
@@ -280,9 +291,13 @@
}
void WorkerProcessHost::OnMessageReceived(const IPC::Message& message) {
+ for (size_t i = 0; i < filters_.size(); ++i) {
+ if (filters_[i]->OnMessageReceived(message))
+ return;
+ }
+
bool msg_is_ok = true;
bool handled =
- appcache_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
db_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
jennb 2010/12/04 00:31:51 Will all these also become filters eventually?
blob_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
file_system_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
@@ -336,6 +351,16 @@
}
}
+void WorkerProcessHost::OnChannelConnected(int32 peer_pid) {
+ for (size_t i = 0; i < filters_.size(); ++i)
+ filters_[i]->OnChannelConnected(peer_pid);
+}
+
+void WorkerProcessHost::OnChannelError() {
+ for (size_t i = 0; i < filters_.size(); ++i)
+ filters_[i]->OnChannelError();
+}
+
void WorkerProcessHost::OnProcessLaunched() {
db_dispatcher_host_->Init(handle());
file_system_dispatcher_host_->Init(handle());

Powered by Google App Engine
This is Rietveld 408576698