| 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_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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return; | 274 return; |
| 275 | 275 |
| 276 // Disassociation message should be sent only for controllees. | 276 // Disassociation message should be sent only for controllees. |
| 277 DCHECK(IsProviderForClient()); | 277 DCHECK(IsProviderForClient()); |
| 278 Send(new ServiceWorkerMsg_DisassociateRegistration( | 278 Send(new ServiceWorkerMsg_DisassociateRegistration( |
| 279 render_thread_id_, provider_id())); | 279 render_thread_id_, provider_id())); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void ServiceWorkerProviderHost::AddMatchingRegistration( | 282 void ServiceWorkerProviderHost::AddMatchingRegistration( |
| 283 ServiceWorkerRegistration* registration) { | 283 ServiceWorkerRegistration* registration) { |
| 284 // TODO(shimazu): Change CHECK to DCHECK when it's confirmed that | 284 DCHECK( |
| 285 // https://crbug.com/634222 has been fixed. | |
| 286 CHECK( | |
| 287 ServiceWorkerUtils::ScopeMatches(registration->pattern(), document_url_)); | 285 ServiceWorkerUtils::ScopeMatches(registration->pattern(), document_url_)); |
| 288 if (!IsContextSecureForServiceWorker()) | 286 if (!IsContextSecureForServiceWorker()) |
| 289 return; | 287 return; |
| 290 size_t key = registration->pattern().spec().size(); | 288 size_t key = registration->pattern().spec().size(); |
| 291 if (base::ContainsKey(matching_registrations_, key)) | 289 if (base::ContainsKey(matching_registrations_, key)) |
| 292 return; | 290 return; |
| 293 IncreaseProcessReference(registration->pattern()); | 291 IncreaseProcessReference(registration->pattern()); |
| 294 registration->AddListener(this); | 292 registration->AddListener(this); |
| 295 matching_registrations_[key] = registration; | 293 matching_registrations_[key] = registration; |
| 296 ReturnRegistrationForReadyIfNeeded(); | 294 ReturnRegistrationForReadyIfNeeded(); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 671 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
| 674 render_thread_id_, provider_id(), | 672 render_thread_id_, provider_id(), |
| 675 GetOrCreateServiceWorkerHandle( | 673 GetOrCreateServiceWorkerHandle( |
| 676 associated_registration_->active_version()), | 674 associated_registration_->active_version()), |
| 677 false /* shouldNotifyControllerChange */)); | 675 false /* shouldNotifyControllerChange */)); |
| 678 } | 676 } |
| 679 } | 677 } |
| 680 } | 678 } |
| 681 | 679 |
| 682 } // namespace content | 680 } // namespace content |
| OLD | NEW |