| 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_storage.h" | 5 #include "content/browser/service_worker/service_worker_storage.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 context_->GetLiveVersion(data.version_id); | 1290 context_->GetLiveVersion(data.version_id); |
| 1291 if (!version.get()) { | 1291 if (!version.get()) { |
| 1292 version = new ServiceWorkerVersion( | 1292 version = new ServiceWorkerVersion( |
| 1293 registration.get(), data.script, data.version_id, context_); | 1293 registration.get(), data.script, data.version_id, context_); |
| 1294 version->SetStatus(data.is_active ? | 1294 version->SetStatus(data.is_active ? |
| 1295 ServiceWorkerVersion::ACTIVATED : ServiceWorkerVersion::INSTALLED); | 1295 ServiceWorkerVersion::ACTIVATED : ServiceWorkerVersion::INSTALLED); |
| 1296 version->script_cache_map()->SetResources(resources); | 1296 version->script_cache_map()->SetResources(resources); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 if (version->status() == ServiceWorkerVersion::ACTIVATED) | 1299 if (version->status() == ServiceWorkerVersion::ACTIVATED) |
| 1300 registration->SetActiveVersion(version.get()); | 1300 registration->SetActiveVersion(version); |
| 1301 else if (version->status() == ServiceWorkerVersion::INSTALLED) | 1301 else if (version->status() == ServiceWorkerVersion::INSTALLED) |
| 1302 registration->SetWaitingVersion(version.get()); | 1302 registration->SetWaitingVersion(version); |
| 1303 else | 1303 else |
| 1304 NOTREACHED(); | 1304 NOTREACHED(); |
| 1305 | 1305 |
| 1306 return registration; | 1306 return registration; |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 ServiceWorkerRegistration* | 1309 ServiceWorkerRegistration* |
| 1310 ServiceWorkerStorage::FindInstallingRegistrationForDocument( | 1310 ServiceWorkerStorage::FindInstallingRegistrationForDocument( |
| 1311 const GURL& document_url) { | 1311 const GURL& document_url) { |
| 1312 DCHECK(!document_url.has_ref()); | 1312 DCHECK(!document_url.has_ref()); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1793 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
| 1794 return; | 1794 return; |
| 1795 } | 1795 } |
| 1796 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1796 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
| 1797 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( | 1797 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( |
| 1798 ServiceWorkerMetrics::DELETE_OK); | 1798 ServiceWorkerMetrics::DELETE_OK); |
| 1799 callback.Run(SERVICE_WORKER_OK); | 1799 callback.Run(SERVICE_WORKER_OK); |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 } // namespace content | 1802 } // namespace content |
| OLD | NEW |