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

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

Issue 1658073002: ServiceWorker: Implement attributes of ExtendableMessageEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: templatize duplicate code Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 abc62e02f2b5a21566964d1658510ae59ef5bfdf..f926872c062ae5ec708f077868b7cf3300144c15 100644
--- a/content/child/service_worker/web_service_worker_impl.cc
+++ b/content/child/service_worker/web_service_worker_impl.cc
@@ -14,10 +14,12 @@
#include "content/common/service_worker/service_worker_messages.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerProxy.h"
+#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
using blink::WebMessagePortChannel;
using blink::WebMessagePortChannelArray;
using blink::WebMessagePortChannelClient;
+using blink::WebRuntimeFeatures;
using blink::WebString;
namespace content {
@@ -43,12 +45,17 @@ void SendPostMessageToWorkerOnMainThread(
int handle_id,
const base::string16& message,
scoped_ptr<WebMessagePortChannelArray> channels) {
- // TODO(nhiroki): Switch to PostMessageToClient message after
- // ExtendableMessageEvent is implemented (crbug.com/543198).
- thread_safe_sender->Send(
- new ServiceWorkerHostMsg_DeprecatedPostMessageToWorker(
- handle_id, message, WebMessagePortChannelImpl::ExtractMessagePortIDs(
- std::move(channels))));
+ if (WebRuntimeFeatures::isServiceWorkerExtendableMessageEventEnabled()) {
+ thread_safe_sender->Send(new ServiceWorkerHostMsg_PostMessageToWorker(
+ handle_id, message,
+ WebMessagePortChannelImpl::ExtractMessagePortIDs(std::move(channels))));
+ } else {
+ thread_safe_sender->Send(
+ new ServiceWorkerHostMsg_DeprecatedPostMessageToWorker(
+ handle_id, message,
+ WebMessagePortChannelImpl::ExtractMessagePortIDs(
+ std::move(channels))));
+ }
}
} // namespace
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698