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

Unified Diff: content/child/service_worker/web_service_worker_impl.cc

Issue 189253002: Implement ServiceWorker::postMessage() [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-cl format and review feedback Created 6 years, 9 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/child/service_worker/web_service_worker_impl.cc
diff --git a/content/child/service_worker/web_service_worker_impl.cc b/content/child/service_worker/web_service_worker_impl.cc
index 02d9cf8ca772096907baeb01c944c7a11d9f3a3e..aab625ae5f2816fe555643564c921bfe2559e7c8 100644
--- a/content/child/service_worker/web_service_worker_impl.cc
+++ b/content/child/service_worker/web_service_worker_impl.cc
@@ -4,8 +4,27 @@
#include "content/child/service_worker/web_service_worker_impl.h"
+#include "content/child/thread_safe_sender.h"
+#include "content/child/webmessageportchannel_impl.h"
+#include "content/common/service_worker/service_worker_messages.h"
+#include "ipc/ipc_message.h"
jam 2014/03/19 21:08:48 nit: don't need this, you get this automatically f
jsbell 2014/03/19 23:52:39 Done. (Left over from before ExtractMessagePortIDs
+#include "third_party/WebKit/public/platform/WebString.h"
+
+using blink::WebMessagePortChannel;
+using blink::WebMessagePortChannelArray;
+using blink::WebMessagePortChannelClient;
+using blink::WebString;
+
namespace content {
WebServiceWorkerImpl::~WebServiceWorkerImpl() {}
+void WebServiceWorkerImpl::postMessage(const WebString& message,
+ WebMessagePortChannelArray* channels) {
+ std::vector<int> message_port_ids;
+ WebMessagePortChannelImpl::ExtractMessagePortIDs(channels, &message_port_ids);
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_PostMessage(
+ registration_id_, message, message_port_ids));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698