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

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: rebase Created 5 years 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 "base/guid.h" 7 #include "base/guid.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/frame_host/frame_tree.h" 10 #include "content/browser/frame_host/frame_tree.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 ServiceWorkerRegistration* registration) { 402 ServiceWorkerRegistration* registration) {
403 if (!context_) 403 if (!context_)
404 return false; 404 return false;
405 if (running_hosted_version_.get()) 405 if (running_hosted_version_.get())
406 return false; 406 return false;
407 if (!registration || associated_registration_.get() || !allow_association_) 407 if (!registration || associated_registration_.get() || !allow_association_)
408 return false; 408 return false;
409 return true; 409 return true;
410 } 410 }
411 411
412 void ServiceWorkerProviderHost::PostMessage( 412 void ServiceWorkerProviderHost::PostMessageToClient(
413 ServiceWorkerVersion* version, 413 ServiceWorkerVersion* version,
414 const base::string16& message, 414 const base::string16& message,
415 const std::vector<TransferredMessagePort>& sent_message_ports) { 415 const std::vector<TransferredMessagePort>& sent_message_ports) {
416 if (!dispatcher_host_) 416 if (!dispatcher_host_)
417 return; // Could be NULL in some tests. 417 return; // Could be NULL in some tests.
418 418
419 std::vector<int> new_routing_ids; 419 std::vector<int> new_routing_ids;
420 dispatcher_host_->message_port_message_filter()-> 420 dispatcher_host_->message_port_message_filter()->
421 UpdateMessagePortsWithNewRoutes(sent_message_ports, 421 UpdateMessagePortsWithNewRoutes(sent_message_ports,
422 &new_routing_ids); 422 &new_routing_ids);
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 Send(new ServiceWorkerMsg_SetControllerServiceWorker( 725 Send(new ServiceWorkerMsg_SetControllerServiceWorker(
726 render_thread_id_, provider_id(), 726 render_thread_id_, provider_id(),
727 GetOrCreateServiceWorkerHandle( 727 GetOrCreateServiceWorkerHandle(
728 associated_registration_->active_version()), 728 associated_registration_->active_version()),
729 false /* shouldNotifyControllerChange */)); 729 false /* shouldNotifyControllerChange */));
730 } 730 }
731 } 731 }
732 } 732 }
733 733
734 } // namespace content 734 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698