| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); | 192 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); |
| 193 DCHECK(version); | 193 DCHECK(version); |
| 194 if (version->status == status) | 194 if (version->status == status) |
| 195 return; | 195 return; |
| 196 version->status = status; | 196 version->status = status; |
| 197 SendVersionInfo(*version); | 197 SendVersionInfo(*version); |
| 198 if (IsStoppedAndRedundant(*version)) | 198 if (IsStoppedAndRedundant(*version)) |
| 199 version_info_map_.erase(version_id); | 199 version_info_map_.erase(version_id); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void ServiceWorkerContextWatcher::OnMainScriptHttpResponseInfoSet( |
| 203 int64 version_id, |
| 204 base::Time script_response_time, |
| 205 base::Time script_last_modified) { |
| 206 ServiceWorkerVersionInfo* version = version_info_map_.get(version_id); |
| 207 DCHECK(version); |
| 208 version->script_response_time = script_response_time; |
| 209 version->script_last_modified = script_last_modified; |
| 210 SendVersionInfo(*version); |
| 211 } |
| 212 |
| 202 void ServiceWorkerContextWatcher::OnErrorReported(int64 version_id, | 213 void ServiceWorkerContextWatcher::OnErrorReported(int64 version_id, |
| 203 int process_id, | 214 int process_id, |
| 204 int thread_id, | 215 int thread_id, |
| 205 const ErrorInfo& info) { | 216 const ErrorInfo& info) { |
| 206 int64 registration_id = kInvalidServiceWorkerRegistrationId; | 217 int64 registration_id = kInvalidServiceWorkerRegistrationId; |
| 207 if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id)) | 218 if (ServiceWorkerVersionInfo* version = version_info_map_.get(version_id)) |
| 208 registration_id = version->registration_id; | 219 registration_id = version->registration_id; |
| 209 BrowserThread::PostTask( | 220 BrowserThread::PostTask( |
| 210 BrowserThread::UI, FROM_HERE, | 221 BrowserThread::UI, FROM_HERE, |
| 211 base::Bind(error_callback_, registration_id, version_id, info)); | 222 base::Bind(error_callback_, registration_id, version_id, info)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 234 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); | 245 ServiceWorkerRegistrationInfo::IS_NOT_DELETED); |
| 235 } | 246 } |
| 236 | 247 |
| 237 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64 registration_id, | 248 void ServiceWorkerContextWatcher::OnRegistrationDeleted(int64 registration_id, |
| 238 const GURL& pattern) { | 249 const GURL& pattern) { |
| 239 SendRegistrationInfo(registration_id, pattern, | 250 SendRegistrationInfo(registration_id, pattern, |
| 240 ServiceWorkerRegistrationInfo::IS_DELETED); | 251 ServiceWorkerRegistrationInfo::IS_DELETED); |
| 241 } | 252 } |
| 242 | 253 |
| 243 } // namespace content | 254 } // namespace content |
| OLD | NEW |