OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_context_watcher.h" | 5 #include "content/browser/service_worker/service_worker_context_watcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "content/browser/service_worker/service_worker_context_observer.h" | 9 #include "content/browser/service_worker/service_worker_context_observer.h" |
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); | 188 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); |
189 DCHECK(version); | 189 DCHECK(version); |
190 if (version->status == status) | 190 if (version->status == status) |
191 return; | 191 return; |
192 version->status = status; | 192 version->status = status; |
193 SendVersionInfo(*version); | 193 SendVersionInfo(*version); |
194 if (IsStoppedAndRedundant(*version)) | 194 if (IsStoppedAndRedundant(*version)) |
195 version_info_map_.erase(version_id); | 195 version_info_map_.erase(version_id); |
196 } | 196 } |
197 | 197 |
| 198 void ServiceWorkerContextWatcher::OnVersionUpdateTimeSet( |
| 199 int64 version_id, |
| 200 base::Time update_time) { |
| 201 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); |
| 202 DCHECK(version); |
| 203 if (version->update_time == update_time) |
| 204 return; |
| 205 version->update_time = update_time; |
| 206 SendVersionInfo(*version); |
| 207 } |
| 208 |
198 void ServiceWorkerContextWatcher::OnRegistrationStored(int64 registration_id, | 209 void ServiceWorkerContextWatcher::OnRegistrationStored(int64 registration_id, |
199 const GURL& pattern) { | 210 const GURL& pattern) { |
200 SendRegistrationInfo(registration_id, pattern, | 211 SendRegistrationInfo(registration_id, pattern, |
201 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); | 212 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); |
202 } | 213 } |
203 | 214 |
204 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64 registration_id, | 215 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64 registration_id, |
205 const GURL& pattern) { | 216 const GURL& pattern) { |
206 SendRegistrationInfo(registration_id, pattern, | 217 SendRegistrationInfo(registration_id, pattern, |
207 ServiceWorkerRegistrationInfo::IS_DELETED); | 218 ServiceWorkerRegistrationInfo::IS_DELETED); |
208 } | 219 } |
209 | 220 |
210 } // namespace content | 221 } // namespace content |
OLD | NEW |