OLD | NEW |
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_context_core.h" | 5 #include "content/browser/service_worker/service_worker_context_core.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 transferee->frame_id(), | 636 transferee->frame_id(), |
637 provider_id, | 637 provider_id, |
638 transferee->provider_type(), | 638 transferee->provider_type(), |
639 AsWeakPtr(), | 639 AsWeakPtr(), |
640 transferee->dispatcher_host()); | 640 transferee->dispatcher_host()); |
641 map->Replace(provider_id, replacement); | 641 map->Replace(provider_id, replacement); |
642 transferee->PrepareForCrossSiteTransfer(); | 642 transferee->PrepareForCrossSiteTransfer(); |
643 return base::WrapUnique(transferee); | 643 return base::WrapUnique(transferee); |
644 } | 644 } |
645 | 645 |
646 void ServiceWorkerContextCore::TransferProviderHostIn( | 646 bool ServiceWorkerContextCore::TransferProviderHostIn( |
647 int new_process_id, | 647 int new_process_id, |
648 int new_provider_id, | 648 int new_provider_id, |
649 std::unique_ptr<ServiceWorkerProviderHost> transferee) { | 649 std::unique_ptr<ServiceWorkerProviderHost> transferee) { |
650 ProviderMap* map = GetProviderMapForProcess(new_process_id); | 650 ProviderMap* map = GetProviderMapForProcess(new_process_id); |
651 ServiceWorkerProviderHost* temp = map->Lookup(new_provider_id); | 651 ServiceWorkerProviderHost* temp = map->Lookup(new_provider_id); |
652 if (!temp) | 652 if (!temp) |
653 return; | 653 return false; |
654 | 654 |
655 DCHECK(temp->document_url().is_empty()); | 655 DCHECK(temp->document_url().is_empty()); |
656 transferee->CompleteCrossSiteTransfer(new_process_id, | 656 transferee->CompleteCrossSiteTransfer(new_process_id, |
657 temp->frame_id(), | 657 temp->frame_id(), |
658 new_provider_id, | 658 new_provider_id, |
659 temp->provider_type(), | 659 temp->provider_type(), |
660 temp->dispatcher_host()); | 660 temp->dispatcher_host()); |
661 map->Replace(new_provider_id, transferee.release()); | 661 map->Replace(new_provider_id, transferee.release()); |
662 delete temp; | 662 delete temp; |
| 663 return true; |
663 } | 664 } |
664 | 665 |
665 void ServiceWorkerContextCore::ClearAllServiceWorkersForTest( | 666 void ServiceWorkerContextCore::ClearAllServiceWorkersForTest( |
666 const base::Closure& callback) { | 667 const base::Closure& callback) { |
667 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 668 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
668 // |callback| will be called in the destructor of |helper| on the UI thread. | 669 // |callback| will be called in the destructor of |helper| on the UI thread. |
669 scoped_refptr<ClearAllServiceWorkersHelper> helper( | 670 scoped_refptr<ClearAllServiceWorkersHelper> helper( |
670 new ClearAllServiceWorkersHelper(callback)); | 671 new ClearAllServiceWorkersHelper(callback)); |
671 if (!was_service_worker_registered_) | 672 if (!was_service_worker_registered_) |
672 return; | 673 return; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 } | 851 } |
851 | 852 |
852 void ServiceWorkerContextCore::OnRegistrationFinishedForCheckHasServiceWorker( | 853 void ServiceWorkerContextCore::OnRegistrationFinishedForCheckHasServiceWorker( |
853 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 854 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, |
854 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 855 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
855 callback.Run(registration->active_version() || | 856 callback.Run(registration->active_version() || |
856 registration->waiting_version()); | 857 registration->waiting_version()); |
857 } | 858 } |
858 | 859 |
859 } // namespace content | 860 } // namespace content |
OLD | NEW |