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

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: Rebase fixes 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..a63d65c92591f226118fa725845b5397b9a23e50 100644
--- a/content/child/service_worker/web_service_worker_impl.cc
+++ b/content/child/service_worker/web_service_worker_impl.cc
@@ -4,8 +4,34 @@
#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"
+#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) {
+ PostMessage(message, channels);
marja 2014/03/17 09:15:02 Why this indirection?
jsbell 2014/03/17 16:49:06 No need now. Squashed the methods. (Before I fact
+}
+
+void WebServiceWorkerImpl::PostMessage(
+ const base::string16& 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