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

Unified Diff: content/browser/service_worker/embedded_worker_instance.h

Issue 139923005: Implement ServiceWorkerVersion::SendMessage() (for dispatching events etc) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 6 years, 10 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/service_worker/embedded_worker_instance.h
diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h
index e55634c283adf265665f3ac0cd011ce19c092a6e..29d4b4966e48856c5c0729d15d6aaa4214e96e11 100644
--- a/content/browser/service_worker/embedded_worker_instance.h
+++ b/content/browser/service_worker/embedded_worker_instance.h
@@ -44,7 +44,8 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
virtual ~Observer() {}
virtual void OnStarted() = 0;
virtual void OnStopped() = 0;
- virtual void OnMessageReceived(const IPC::Message& message) = 0;
+ virtual void OnMessageReceived(int request_id,
+ const IPC::Message& message) = 0;
};
~EmbeddedWorkerInstance();
@@ -62,7 +63,11 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
// Sends |message| to the embedded worker running in the child process.
// It is invalid to call this while the worker is not in RUNNING status.
- ServiceWorkerStatusCode SendMessage(const IPC::Message& message);
+ // |request_id| can be optionally used to establish 2-way request-response
+ // messaging (e.g. the receiver can send back a response using the same
+ // request_id).
+ ServiceWorkerStatusCode SendMessage(
+ int request_id, const IPC::Message& message);
// Add or remove |process_id| to the internal process set where this
// worker can be started.
@@ -102,7 +107,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
// Called back from Registry when the worker instance sends message
// to the browser (i.e. EmbeddedWorker observers).
- void OnMessageReceived(const IPC::Message& message);
+ void OnMessageReceived(int request_id, const IPC::Message& message);
// Chooses a process to start this worker and populate process_id_.
// Returns false when no process is available.

Powered by Google App Engine
This is Rietveld 408576698