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

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

Issue 1264333002: First step to refactor ServiceWorkerVersion to make event dispatching more modular. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rockot nits Created 4 years, 11 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_provider_host.h" 5 #include "content/browser/service_worker/service_worker_provider_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 ServiceWorkerRegistration* registration) { 404 ServiceWorkerRegistration* registration) {
405 if (!context_) 405 if (!context_)
406 return false; 406 return false;
407 if (running_hosted_version_.get()) 407 if (running_hosted_version_.get())
408 return false; 408 return false;
409 if (!registration || associated_registration_.get() || !allow_association_) 409 if (!registration || associated_registration_.get() || !allow_association_)
410 return false; 410 return false;
411 return true; 411 return true;
412 } 412 }
413 413
414 void ServiceWorkerProviderHost::PostMessage( 414 void ServiceWorkerProviderHost::PostMessageToClient(
415 ServiceWorkerVersion* version, 415 ServiceWorkerVersion* version,
416 const base::string16& message, 416 const base::string16& message,
417 const std::vector<TransferredMessagePort>& sent_message_ports) { 417 const std::vector<TransferredMessagePort>& sent_message_ports) {
418 if (!dispatcher_host_) 418 if (!dispatcher_host_)
419 return; // Could be NULL in some tests. 419 return; // Could be NULL in some tests.
420 420
421 std::vector<int> new_routing_ids; 421 std::vector<int> new_routing_ids;
422 dispatcher_host_->message_port_message_filter()-> 422 dispatcher_host_->message_port_message_filter()->
423 UpdateMessagePortsWithNewRoutes(sent_message_ports, 423 UpdateMessagePortsWithNewRoutes(sent_message_ports,
424 &new_routing_ids); 424 &new_routing_ids);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 Send(new ServiceWorkerMsg_SetControllerServiceWorker( 727 Send(new ServiceWorkerMsg_SetControllerServiceWorker(
728 render_thread_id_, provider_id(), 728 render_thread_id_, provider_id(),
729 GetOrCreateServiceWorkerHandle( 729 GetOrCreateServiceWorkerHandle(
730 associated_registration_->active_version()), 730 associated_registration_->active_version()),
731 false /* shouldNotifyControllerChange */)); 731 false /* shouldNotifyControllerChange */));
732 } 732 }
733 } 733 }
734 } 734 }
735 735
736 } // namespace content 736 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698