| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 // Disassociation message should be sent only for controllees. | 277 // Disassociation message should be sent only for controllees. |
| 278 DCHECK(IsProviderForClient()); | 278 DCHECK(IsProviderForClient()); |
| 279 Send(new ServiceWorkerMsg_DisassociateRegistration( | 279 Send(new ServiceWorkerMsg_DisassociateRegistration( |
| 280 render_thread_id_, provider_id())); | 280 render_thread_id_, provider_id())); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void ServiceWorkerProviderHost::AddMatchingRegistration( | 283 void ServiceWorkerProviderHost::AddMatchingRegistration( |
| 284 ServiceWorkerRegistration* registration) { | 284 ServiceWorkerRegistration* registration) { |
| 285 // TODO(shimazu): Change CHECK to DCHECK after https://crbug.com/634222 is | 285 DCHECK( |
| 286 // fixed. | |
| 287 CHECK( | |
| 288 ServiceWorkerUtils::ScopeMatches(registration->pattern(), document_url_)); | 286 ServiceWorkerUtils::ScopeMatches(registration->pattern(), document_url_)); |
| 289 if (!IsContextSecureForServiceWorker()) | 287 if (!IsContextSecureForServiceWorker()) |
| 290 return; | 288 return; |
| 291 size_t key = registration->pattern().spec().size(); | 289 size_t key = registration->pattern().spec().size(); |
| 292 if (base::ContainsKey(matching_registrations_, key)) | 290 if (base::ContainsKey(matching_registrations_, key)) |
| 293 return; | 291 return; |
| 294 IncreaseProcessReference(registration->pattern()); | 292 IncreaseProcessReference(registration->pattern()); |
| 295 registration->AddListener(this); | 293 registration->AddListener(this); |
| 296 matching_registrations_[key] = registration; | 294 matching_registrations_[key] = registration; |
| 297 ReturnRegistrationForReadyIfNeeded(); | 295 ReturnRegistrationForReadyIfNeeded(); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 Send(new ServiceWorkerMsg_SetControllerServiceWorker( | 663 Send(new ServiceWorkerMsg_SetControllerServiceWorker( |
| 666 render_thread_id_, provider_id(), | 664 render_thread_id_, provider_id(), |
| 667 GetOrCreateServiceWorkerHandle( | 665 GetOrCreateServiceWorkerHandle( |
| 668 associated_registration_->active_version()), | 666 associated_registration_->active_version()), |
| 669 false /* shouldNotifyControllerChange */)); | 667 false /* shouldNotifyControllerChange */)); |
| 670 } | 668 } |
| 671 } | 669 } |
| 672 } | 670 } |
| 673 | 671 |
| 674 } // namespace content | 672 } // namespace content |
| OLD | NEW |