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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 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 | « content/child/service_worker/web_service_worker_impl.h ('k') | content/child/webmessageportchannel_impl.h » ('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 947359eb70a9e7f794c2934d61a3ffa0a60af94c..216e2c22b185ab360808105a70ae7581dee95252 100644
--- a/content/child/service_worker/web_service_worker_impl.cc
+++ b/content/child/service_worker/web_service_worker_impl.cc
@@ -43,18 +43,6 @@ class HandleImpl : public blink::WebServiceWorker::Handle {
DISALLOW_COPY_AND_ASSIGN(HandleImpl);
};
-void SendPostMessageToWorkerOnMainThread(
- ThreadSafeSender* thread_safe_sender,
- int handle_id,
- int provider_id,
- const base::string16& message,
- const url::Origin& source_origin,
- std::unique_ptr<WebMessagePortChannelArray> channels) {
- thread_safe_sender->Send(new ServiceWorkerHostMsg_PostMessageToWorker(
- handle_id, provider_id, message, source_origin,
- WebMessagePortChannelImpl::ExtractMessagePortIDs(std::move(channels))));
-}
-
} // namespace
WebServiceWorkerImpl::WebServiceWorkerImpl(
@@ -101,26 +89,14 @@ void WebServiceWorkerImpl::postMessage(
blink::WebServiceWorkerProvider* provider,
const WebString& message,
const WebSecurityOrigin& source_origin,
- WebMessagePortChannelArray* channels) {
- WebServiceWorkerProviderImpl* provider_impl =
- static_cast<WebServiceWorkerProviderImpl*>(provider);
- ServiceWorkerDispatcher* dispatcher =
- ServiceWorkerDispatcher::GetThreadSpecificInstance();
- DCHECK(dispatcher);
-
- // This may send channels for MessagePorts, and all internal book-keeping
- // messages for MessagePort (e.g. QueueMessages) are sent from main thread
- // (with thread hopping), so we need to do the same thread hopping here not
- // to overtake those messages.
- dispatcher->main_thread_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&SendPostMessageToWorkerOnMainThread,
- base::RetainedRef(thread_safe_sender_),
- handle_ref_->handle_id(), provider_impl->provider_id(),
- // We convert WebString to string16 before crossing
- // threads for thread-safety.
- message.utf16(), url::Origin(source_origin),
- base::Passed(base::WrapUnique(channels))));
+ WebMessagePortChannelArray channels) {
+ thread_safe_sender_->Send(
+ new ServiceWorkerHostMsg_PostMessageToWorker(
+ handle_ref_->handle_id(),
+ static_cast<WebServiceWorkerProviderImpl*>(provider)->provider_id(),
+ message.utf16(),
+ url::Origin(source_origin),
+ WebMessagePortChannelImpl::ExtractMessagePorts(std::move(channels))));
}
void WebServiceWorkerImpl::terminate() {
« no previous file with comments | « content/child/service_worker/web_service_worker_impl.h ('k') | content/child/webmessageportchannel_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698