| 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_registration.h" | 5 #include "content/browser/service_worker/service_worker_registration.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "content/browser/service_worker/service_worker_context_core.h" | 9 #include "content/browser/service_worker/service_worker_context_core.h" |
| 10 #include "content/browser/service_worker/service_worker_info.h" | 10 #include "content/browser/service_worker/service_worker_info.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 ServiceWorkerRegistration::ServiceWorkerRegistration( | 29 ServiceWorkerRegistration::ServiceWorkerRegistration( |
| 30 const GURL& pattern, | 30 const GURL& pattern, |
| 31 int64_t registration_id, | 31 int64_t registration_id, |
| 32 base::WeakPtr<ServiceWorkerContextCore> context) | 32 base::WeakPtr<ServiceWorkerContextCore> context) |
| 33 : pattern_(pattern), | 33 : pattern_(pattern), |
| 34 registration_id_(registration_id), | 34 registration_id_(registration_id), |
| 35 is_deleted_(false), | 35 is_deleted_(false), |
| 36 is_uninstalling_(false), | 36 is_uninstalling_(false), |
| 37 is_uninstalled_(false), | 37 is_uninstalled_(false), |
| 38 should_activate_when_ready_(false), | 38 should_activate_when_ready_(false), |
| 39 force_update_on_page_load_(false), | |
| 40 resources_total_size_bytes_(0), | 39 resources_total_size_bytes_(0), |
| 41 context_(context) { | 40 context_(context) { |
| 42 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 41 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 43 DCHECK_NE(kInvalidServiceWorkerRegistrationId, registration_id); | 42 DCHECK_NE(kInvalidServiceWorkerRegistrationId, registration_id); |
| 44 DCHECK(context_); | 43 DCHECK(context_); |
| 45 context_->AddLiveRegistration(this); | 44 context_->AddLiveRegistration(this); |
| 46 } | 45 } |
| 47 | 46 |
| 48 ServiceWorkerRegistration::~ServiceWorkerRegistration() { | 47 ServiceWorkerRegistration::~ServiceWorkerRegistration() { |
| 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 48 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 if (mask.active_changed() || mask.waiting_changed()) | 85 if (mask.active_changed() || mask.waiting_changed()) |
| 87 NotifyRegistrationFinished(); | 86 NotifyRegistrationFinished(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { | 89 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { |
| 91 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 90 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 92 return ServiceWorkerRegistrationInfo( | 91 return ServiceWorkerRegistrationInfo( |
| 93 pattern(), registration_id_, | 92 pattern(), registration_id_, |
| 94 is_deleted_ ? ServiceWorkerRegistrationInfo::IS_DELETED | 93 is_deleted_ ? ServiceWorkerRegistrationInfo::IS_DELETED |
| 95 : ServiceWorkerRegistrationInfo::IS_NOT_DELETED, | 94 : ServiceWorkerRegistrationInfo::IS_NOT_DELETED, |
| 96 force_update_on_page_load_ ? ServiceWorkerRegistrationInfo::IS_FORCED | |
| 97 : ServiceWorkerRegistrationInfo::IS_NOT_FORCED, | |
| 98 GetVersionInfo(active_version_.get()), | 95 GetVersionInfo(active_version_.get()), |
| 99 GetVersionInfo(waiting_version_.get()), | 96 GetVersionInfo(waiting_version_.get()), |
| 100 GetVersionInfo(installing_version_.get()), resources_total_size_bytes_); | 97 GetVersionInfo(installing_version_.get()), resources_total_size_bytes_); |
| 101 } | 98 } |
| 102 | 99 |
| 103 void ServiceWorkerRegistration::SetActiveVersion( | 100 void ServiceWorkerRegistration::SetActiveVersion( |
| 104 const scoped_refptr<ServiceWorkerVersion>& version) { | 101 const scoped_refptr<ServiceWorkerVersion>& version) { |
| 105 should_activate_when_ready_ = false; | 102 should_activate_when_ready_ = false; |
| 106 if (active_version_ == version) | 103 if (active_version_ == version) |
| 107 return; | 104 return; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 if (!context_) { | 428 if (!context_) { |
| 432 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 429 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
| 433 return; | 430 return; |
| 434 } | 431 } |
| 435 context_->storage()->NotifyDoneInstallingRegistration( | 432 context_->storage()->NotifyDoneInstallingRegistration( |
| 436 this, version.get(), status); | 433 this, version.get(), status); |
| 437 callback.Run(status); | 434 callback.Run(status); |
| 438 } | 435 } |
| 439 | 436 |
| 440 } // namespace content | 437 } // namespace content |
| OLD | NEW |