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

Unified Diff: content/browser/shared_worker/shared_worker_message_filter.cc

Issue 2650783004: SharedWorker: Remove unnecessary indirection in SharedWorkerMessageFilter (Closed)
Patch Set: Created 3 years, 11 months 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: content/browser/shared_worker/shared_worker_message_filter.cc
diff --git a/content/browser/shared_worker/shared_worker_message_filter.cc b/content/browser/shared_worker/shared_worker_message_filter.cc
index ddc37450225a12d47870ba7631e4580083d367ec..375cf1ad154ea64b6d4448d0cfbaa8ef8016f309 100644
--- a/content/browser/shared_worker/shared_worker_message_filter.cc
+++ b/content/browser/shared_worker/shared_worker_message_filter.cc
@@ -47,25 +47,35 @@ void SharedWorkerMessageFilter::OnChannelClosing() {
bool SharedWorkerMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(SharedWorkerMessageFilter, message)
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(SharedWorkerMessageFilter, message, this)
// Only sent from renderer for now, until we have nested workers.
IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWorker, OnCreateWorker)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ConnectToWorker, OnConnectToWorker)
+ IPC_MESSAGE_FORWARD(ViewHostMsg_ConnectToWorker,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::ConnectToWorker)
// Only sent from renderer.
- IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentDetached, OnDocumentDetached)
+ IPC_MESSAGE_FORWARD(ViewHostMsg_DocumentDetached,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::DocumentDetached)
// Only sent from SharedWorker in renderer.
- IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed,
- OnWorkerContextClosed)
- IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed,
- OnWorkerContextDestroyed)
- IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerReadyForInspection,
- OnWorkerReadyForInspection)
- IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded,
- OnWorkerScriptLoaded)
- IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed,
- OnWorkerScriptLoadFailed)
- IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected,
- OnWorkerConnected)
+ IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextClosed,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::WorkerContextClosed)
+ IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::WorkerContextDestroyed)
+ IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerReadyForInspection,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::WorkerReadyForInspection)
+ IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerScriptLoaded,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::WorkerScriptLoaded)
+ IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerScriptLoadFailed,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::WorkerScriptLoadFailed)
+ IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerConnected,
+ SharedWorkerServiceImpl::GetInstance(),
+ SharedWorkerServiceImpl::WorkerConnected)
IPC_MESSAGE_HANDLER_DELAY_REPLY(
WorkerProcessHostMsg_RequestFileSystemAccessSync,
OnRequestFileSystemAccess)
@@ -88,70 +98,20 @@ void SharedWorkerMessageFilter::OnCreateWorker(
WorkerStoragePartitionId(partition_));
}
-void SharedWorkerMessageFilter::OnConnectToWorker(int route_id,
- int sent_message_port_id) {
- SharedWorkerServiceImpl::GetInstance()->ConnectToWorker(
- route_id, sent_message_port_id, this);
-}
-
-void SharedWorkerMessageFilter::OnDocumentDetached(
- unsigned long long document_id) {
- SharedWorkerServiceImpl::GetInstance()->DocumentDetached(document_id, this);
-}
-
-void SharedWorkerMessageFilter::OnWorkerContextClosed(int worker_route_id) {
- SharedWorkerServiceImpl::GetInstance()->WorkerContextClosed(worker_route_id,
- this);
-}
-
-void SharedWorkerMessageFilter::OnWorkerContextDestroyed(int worker_route_id) {
- SharedWorkerServiceImpl::GetInstance()->WorkerContextDestroyed(
- worker_route_id,
- this);
-}
-
-void SharedWorkerMessageFilter::OnWorkerReadyForInspection(
- int worker_route_id) {
- SharedWorkerServiceImpl::GetInstance()->WorkerReadyForInspection(
- worker_route_id, this);
-}
-
-void SharedWorkerMessageFilter::OnWorkerScriptLoaded(int worker_route_id) {
- SharedWorkerServiceImpl::GetInstance()->WorkerScriptLoaded(worker_route_id,
- this);
-}
-
-void SharedWorkerMessageFilter::OnWorkerScriptLoadFailed(int worker_route_id) {
- SharedWorkerServiceImpl::GetInstance()->WorkerScriptLoadFailed(
- worker_route_id,
- this);
-}
-
-void SharedWorkerMessageFilter::OnWorkerConnected(int message_port_id,
- int worker_route_id) {
- SharedWorkerServiceImpl::GetInstance()->WorkerConnected(
- message_port_id,
- worker_route_id,
- this);
-}
-
void SharedWorkerMessageFilter::OnRequestFileSystemAccess(
int worker_route_id,
const GURL& url,
IPC::Message* reply_msg) {
- SharedWorkerServiceImpl::GetInstance()->AllowFileSystem(
- worker_route_id, url, reply_msg, this);
+ SharedWorkerServiceImpl::GetInstance()->AllowFileSystem(this, worker_route_id,
+ url, reply_msg);
}
void SharedWorkerMessageFilter::OnAllowIndexedDB(int worker_route_id,
const GURL& url,
const base::string16& name,
bool* result) {
- SharedWorkerServiceImpl::GetInstance()->AllowIndexedDB(worker_route_id,
- url,
- name,
- result,
- this);
+ SharedWorkerServiceImpl::GetInstance()->AllowIndexedDB(this, worker_route_id,
+ url, name, result);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698