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

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "content/browser/message_port_message_filter.h" 10 #include "content/browser/message_port_message_filter.h"
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 base::Bind(&ServiceWorkerDispatcherHost::GetRegistrationComplete, 488 base::Bind(&ServiceWorkerDispatcherHost::GetRegistrationComplete,
489 this, 489 this,
490 thread_id, 490 thread_id,
491 provider_id, 491 provider_id,
492 request_id)); 492 request_id));
493 } 493 }
494 494
495 void ServiceWorkerDispatcherHost::OnPostMessageToWorker( 495 void ServiceWorkerDispatcherHost::OnPostMessageToWorker(
496 int handle_id, 496 int handle_id,
497 const base::string16& message, 497 const base::string16& message,
498 const std::vector<int>& sent_message_port_ids) { 498 const std::vector<TransferredMessagePort>& sent_message_ports) {
499 TRACE_EVENT0("ServiceWorker", 499 TRACE_EVENT0("ServiceWorker",
500 "ServiceWorkerDispatcherHost::OnPostMessageToWorker"); 500 "ServiceWorkerDispatcherHost::OnPostMessageToWorker");
501 if (!GetContext()) 501 if (!GetContext())
502 return; 502 return;
503 503
504 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); 504 ServiceWorkerHandle* handle = handles_.Lookup(handle_id);
505 if (!handle) { 505 if (!handle) {
506 BadMessageReceived(); 506 BadMessageReceived();
507 return; 507 return;
508 } 508 }
509 509
510 handle->version()->DispatchMessageEvent( 510 handle->version()->DispatchMessageEvent(
511 message, sent_message_port_ids, 511 message, sent_message_ports,
512 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 512 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
513 } 513 }
514 514
515 void ServiceWorkerDispatcherHost::OnProviderCreated( 515 void ServiceWorkerDispatcherHost::OnProviderCreated(
516 int provider_id, 516 int provider_id,
517 int render_frame_id, 517 int render_frame_id,
518 ServiceWorkerProviderType provider_type) { 518 ServiceWorkerProviderType provider_type) {
519 TRACE_EVENT0("ServiceWorker", 519 TRACE_EVENT0("ServiceWorker",
520 "ServiceWorkerDispatcherHost::OnProviderCreated"); 520 "ServiceWorkerDispatcherHost::OnProviderCreated");
521 if (!GetContext()) 521 if (!GetContext())
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); 956 ServiceWorkerHandle* handle = handles_.Lookup(handle_id);
957 if (!handle) { 957 if (!handle) {
958 BadMessageReceived(); 958 BadMessageReceived();
959 return; 959 return;
960 } 960 }
961 handle->version()->StopWorker( 961 handle->version()->StopWorker(
962 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 962 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
963 } 963 }
964 964
965 } // namespace content 965 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698