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 "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
8 #include "content/browser/service_worker/service_worker_info.h" | 8 #include "content/browser/service_worker/service_worker_info.h" |
9 #include "content/browser/service_worker/service_worker_register_job.h" | 9 #include "content/browser/service_worker/service_worker_register_job.h" |
10 #include "content/browser/service_worker/service_worker_utils.h" | 10 #include "content/browser/service_worker/service_worker_utils.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 ServiceWorkerRegistration::ServiceWorkerRegistration( | 25 ServiceWorkerRegistration::ServiceWorkerRegistration( |
26 const GURL& pattern, | 26 const GURL& pattern, |
27 int64 registration_id, | 27 int64 registration_id, |
28 base::WeakPtr<ServiceWorkerContextCore> context) | 28 base::WeakPtr<ServiceWorkerContextCore> context) |
29 : pattern_(pattern), | 29 : pattern_(pattern), |
30 registration_id_(registration_id), | 30 registration_id_(registration_id), |
31 is_deleted_(false), | 31 is_deleted_(false), |
32 is_uninstalling_(false), | 32 is_uninstalling_(false), |
33 is_uninstalled_(false), | 33 is_uninstalled_(false), |
34 should_activate_when_ready_(false), | 34 should_activate_when_ready_(false), |
| 35 resources_total_size_bytes_(0), |
35 context_(context) { | 36 context_(context) { |
36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
37 DCHECK(context_); | 38 DCHECK(context_); |
38 context_->AddLiveRegistration(this); | 39 context_->AddLiveRegistration(this); |
39 } | 40 } |
40 | 41 |
41 ServiceWorkerRegistration::~ServiceWorkerRegistration() { | 42 ServiceWorkerRegistration::~ServiceWorkerRegistration() { |
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
43 DCHECK(!listeners_.might_have_observers()); | 44 DCHECK(!listeners_.might_have_observers()); |
44 if (context_) | 45 if (context_) |
(...skipping 26 matching lines...) Expand all Loading... |
71 FOR_EACH_OBSERVER(Listener, listeners_, OnUpdateFound(this)); | 72 FOR_EACH_OBSERVER(Listener, listeners_, OnUpdateFound(this)); |
72 } | 73 } |
73 | 74 |
74 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { | 75 ServiceWorkerRegistrationInfo ServiceWorkerRegistration::GetInfo() { |
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
76 return ServiceWorkerRegistrationInfo( | 77 return ServiceWorkerRegistrationInfo( |
77 pattern(), | 78 pattern(), |
78 registration_id_, | 79 registration_id_, |
79 GetVersionInfo(active_version_.get()), | 80 GetVersionInfo(active_version_.get()), |
80 GetVersionInfo(waiting_version_.get()), | 81 GetVersionInfo(waiting_version_.get()), |
81 GetVersionInfo(installing_version_.get())); | 82 GetVersionInfo(installing_version_.get()), |
| 83 resources_total_size_bytes_); |
82 } | 84 } |
83 | 85 |
84 void ServiceWorkerRegistration::SetActiveVersion( | 86 void ServiceWorkerRegistration::SetActiveVersion( |
85 ServiceWorkerVersion* version) { | 87 ServiceWorkerVersion* version) { |
86 should_activate_when_ready_ = false; | 88 should_activate_when_ready_ = false; |
87 SetVersionInternal(version, &active_version_, | 89 SetVersionInternal(version, &active_version_, |
88 ChangedVersionAttributesMask::ACTIVE_VERSION); | 90 ChangedVersionAttributesMask::ACTIVE_VERSION); |
89 } | 91 } |
90 | 92 |
91 void ServiceWorkerRegistration::SetWaitingVersion( | 93 void ServiceWorkerRegistration::SetWaitingVersion( |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (!context_) { | 328 if (!context_) { |
327 callback.Run(SERVICE_WORKER_ERROR_ABORT); | 329 callback.Run(SERVICE_WORKER_ERROR_ABORT); |
328 return; | 330 return; |
329 } | 331 } |
330 context_->storage()->NotifyDoneInstallingRegistration( | 332 context_->storage()->NotifyDoneInstallingRegistration( |
331 this, version.get(), status); | 333 this, version.get(), status); |
332 callback.Run(status); | 334 callback.Run(status); |
333 } | 335 } |
334 | 336 |
335 } // namespace content | 337 } // namespace content |
OLD | NEW |