Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 ServiceWorkerStatusCode status, | 108 ServiceWorkerStatusCode status, | 
| 109 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { | 109 const std::vector<ServiceWorkerRegistrationInfo>& registrations) { | 
| 110 if (!context || status != SERVICE_WORKER_OK) | 110 if (!context || status != SERVICE_WORKER_OK) | 
| 111 return; | 111 return; | 
| 112 // Make a copy of live versions map because StopWorker() removes the version | 112 // Make a copy of live versions map because StopWorker() removes the version | 
| 113 // from it when we were starting up and don't have a process yet. | 113 // from it when we were starting up and don't have a process yet. | 
| 114 const std::map<int64_t, ServiceWorkerVersion*> live_versions_copy = | 114 const std::map<int64_t, ServiceWorkerVersion*> live_versions_copy = | 
| 115 context->GetLiveVersions(); | 115 context->GetLiveVersions(); | 
| 116 for (const auto& version_itr : live_versions_copy) { | 116 for (const auto& version_itr : live_versions_copy) { | 
| 117 ServiceWorkerVersion* version(version_itr.second); | 117 ServiceWorkerVersion* version(version_itr.second); | 
| 118 if (version->running_status() == ServiceWorkerVersion::STARTING || | 118 if (version->running_status() == | 
| 119 version->running_status() == ServiceWorkerVersion::RUNNING) { | 119 ServiceWorkerVersion::RunningStatus::STARTING || | 
| 120 version->running_status() == | |
| 121 ServiceWorkerVersion::RunningStatus::RUNNING) { | |
| 
 
falken
2016/06/07 03:46:12
Should we use EmbeddedWorkerStatus:: for these use
 
 | |
| 120 version->StopWorker( | 122 version->StopWorker( | 
| 121 base::Bind(&ClearAllServiceWorkersHelper::OnResult, this)); | 123 base::Bind(&ClearAllServiceWorkersHelper::OnResult, this)); | 
| 122 } | 124 } | 
| 123 } | 125 } | 
| 124 for (const auto& registration_info : registrations) { | 126 for (const auto& registration_info : registrations) { | 
| 125 context->UnregisterServiceWorker( | 127 context->UnregisterServiceWorker( | 
| 126 registration_info.pattern, | 128 registration_info.pattern, | 
| 127 base::Bind(&ClearAllServiceWorkersHelper::OnResult, this)); | 129 base::Bind(&ClearAllServiceWorkersHelper::OnResult, this)); | 
| 128 } | 130 } | 
| 129 } | 131 } | 
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 850 } | 852 } | 
| 851 | 853 | 
| 852 void ServiceWorkerContextCore::OnRegistrationFinishedForCheckHasServiceWorker( | 854 void ServiceWorkerContextCore::OnRegistrationFinishedForCheckHasServiceWorker( | 
| 853 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 855 const ServiceWorkerContext::CheckHasServiceWorkerCallback callback, | 
| 854 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 856 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 
| 855 callback.Run(registration->active_version() || | 857 callback.Run(registration->active_version() || | 
| 856 registration->waiting_version()); | 858 registration->waiting_version()); | 
| 857 } | 859 } | 
| 858 | 860 | 
| 859 } // namespace content | 861 } // namespace content | 
| OLD | NEW |