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_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 void ServiceWorkerDispatcherHost::RegisterServiceWorkerRegistrationHandle( | 238 void ServiceWorkerDispatcherHost::RegisterServiceWorkerRegistrationHandle( |
239 std::unique_ptr<ServiceWorkerRegistrationHandle> handle) { | 239 std::unique_ptr<ServiceWorkerRegistrationHandle> handle) { |
240 int handle_id = handle->handle_id(); | 240 int handle_id = handle->handle_id(); |
241 registration_handles_.AddWithID(std::move(handle), handle_id); | 241 registration_handles_.AddWithID(std::move(handle), handle_id); |
242 } | 242 } |
243 | 243 |
244 ServiceWorkerHandle* ServiceWorkerDispatcherHost::FindServiceWorkerHandle( | 244 ServiceWorkerHandle* ServiceWorkerDispatcherHost::FindServiceWorkerHandle( |
245 int provider_id, | 245 int provider_id, |
246 int64_t version_id) { | 246 int64_t version_id) { |
247 for (IDMap<ServiceWorkerHandle, IDMapOwnPointer>::iterator iter(&handles_); | 247 for (IDMap<std::unique_ptr<ServiceWorkerHandle>>::iterator iter(&handles_); |
248 !iter.IsAtEnd(); iter.Advance()) { | 248 !iter.IsAtEnd(); iter.Advance()) { |
249 ServiceWorkerHandle* handle = iter.GetCurrentValue(); | 249 ServiceWorkerHandle* handle = iter.GetCurrentValue(); |
250 DCHECK(handle); | 250 DCHECK(handle); |
251 DCHECK(handle->version()); | 251 DCHECK(handle->version()); |
252 if (handle->provider_id() == provider_id && | 252 if (handle->provider_id() == provider_id && |
253 handle->version()->version_id() == version_id) { | 253 handle->version()->version_id() == version_id) { |
254 return handle; | 254 return handle; |
255 } | 255 } |
256 } | 256 } |
257 return nullptr; | 257 return nullptr; |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 if (!handle) { | 1720 if (!handle) { |
1721 bad_message::ReceivedBadMessage(this, | 1721 bad_message::ReceivedBadMessage(this, |
1722 bad_message::SWDH_TERMINATE_BAD_HANDLE); | 1722 bad_message::SWDH_TERMINATE_BAD_HANDLE); |
1723 return; | 1723 return; |
1724 } | 1724 } |
1725 handle->version()->StopWorker( | 1725 handle->version()->StopWorker( |
1726 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 1726 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
1727 } | 1727 } |
1728 | 1728 |
1729 } // namespace content | 1729 } // namespace content |
OLD | NEW |