summaryrefslogtreecommitdiffstats
path: root/content/common/service_worker
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-22 10:34:41 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-22 10:34:41 +0000
commite5f77dce153f6515f2a91ec5554869432a675539 (patch)
treeab7312609bd164057e00b2ec46f86217f99d78e4 /content/common/service_worker
parent2518ca22cdc205dd725650bc6ccbfa7a0a9aa6ed (diff)
downloadchromium_src-e5f77dce153f6515f2a91ec5554869432a675539.zip
chromium_src-e5f77dce153f6515f2a91ec5554869432a675539.tar.gz
chromium_src-e5f77dce153f6515f2a91ec5554869432a675539.tar.bz2
Adding slightly clearer separation between SW and EmbeddedWorker (still incomplete)
I'm still a bit unsure about bringing separation here is a good thing, but this patch adds slightly clearer separation between them. * EmbeddedWorkerInstance now has generic SendMessage() and OnMessageReceived() observer method (instead of SendFetchRequest etc) * ServiceWorker's script context messages are sent and dispatched from/to ServiceWorkerVersion to/from ServiceWorkerScriptContext via EW layer. * EW/SW separation in blink and dispatcher_host is not made yet (and no plan to add it for now) BUG=313530 TBR=avi Review URL: https://codereview.chromium.org/140893002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246276 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/service_worker')
-rw-r--r--content/common/service_worker/embedded_worker_messages.h18
-rw-r--r--content/common/service_worker/service_worker_messages.h11
2 files changed, 20 insertions, 9 deletions
diff --git a/content/common/service_worker/embedded_worker_messages.h b/content/common/service_worker/embedded_worker_messages.h
index 9f904ee..d38e91f 100644
--- a/content/common/service_worker/embedded_worker_messages.h
+++ b/content/common/service_worker/embedded_worker_messages.h
@@ -6,7 +6,7 @@
#include <string>
-#include "content/common/service_worker/service_worker_types.h"
+#include "ipc/ipc_message.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "url/gurl.h"
@@ -14,12 +14,6 @@
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
- IPC_STRUCT_TRAITS_MEMBER(url)
- IPC_STRUCT_TRAITS_MEMBER(method)
- IPC_STRUCT_TRAITS_MEMBER(headers)
-IPC_STRUCT_TRAITS_END()
-
#define IPC_MESSAGE_START EmbeddedWorkerMsgStart
// Browser -> Renderer message to create a new embedded worker context.
@@ -41,6 +35,11 @@ IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_WorkerStarted,
IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerStopped,
int /* embedded_worker_id */)
+// Renderer ->Browser message to send message.
+IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_SendMessageToBrowser,
+ int /* embedded_worker_id */,
+ IPC::Message /* message */)
+
// ---------------------------------------------------------------------------
// For EmbeddedWorkerContext related messages, which are directly sent from
// browser to the worker thread in the child process. We use a new message class
@@ -49,7 +48,8 @@ IPC_MESSAGE_CONTROL1(EmbeddedWorkerHostMsg_WorkerStopped,
#undef IPC_MESSAGE_START
#define IPC_MESSAGE_START EmbeddedWorkerContextMsgStart
-IPC_MESSAGE_CONTROL3(EmbeddedWorkerContextMsg_FetchEvent,
+// Browser -> Renderer message to send message.
+IPC_MESSAGE_CONTROL3(EmbeddedWorkerContextMsg_SendMessageToWorker,
int /* thread_id */,
int /* embedded_worker_id */,
- content::ServiceWorkerFetchRequest)
+ IPC::Message /* message */)
diff --git a/content/common/service_worker/service_worker_messages.h b/content/common/service_worker/service_worker_messages.h
index be11cbe..84e87f4 100644
--- a/content/common/service_worker/service_worker_messages.h
+++ b/content/common/service_worker/service_worker_messages.h
@@ -5,6 +5,7 @@
// Message definition file, included multiple times, hence no include guard.
#include "base/strings/string16.h"
+#include "content/common/service_worker/service_worker_types.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
@@ -17,6 +18,12 @@
IPC_ENUM_TRAITS(blink::WebServiceWorkerError::ErrorType)
+IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
+ IPC_STRUCT_TRAITS_MEMBER(url)
+ IPC_STRUCT_TRAITS_MEMBER(method)
+ IPC_STRUCT_TRAITS_MEMBER(headers)
+IPC_STRUCT_TRAITS_END()
+
// Messages sent from the child process to the browser.
IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_RegisterServiceWorker,
@@ -51,6 +58,10 @@ IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
blink::WebServiceWorkerError::ErrorType /* code */,
base::string16 /* message */)
+// Sent via EmbeddedWorker to dispatch fetch event.
+IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_FetchEvent,
+ content::ServiceWorkerFetchRequest)
+
// Informs the browser of a new ServiceWorkerProvider in the child process,
// |provider_id| is unique within its child process.
IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderCreated,