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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 DCHECK_NE(kInvalidServiceWorkerResponseId, id); | 385 DCHECK_NE(kInvalidServiceWorkerResponseId, id); |
386 database_task_runner_->PostTask( | 386 database_task_runner_->PostTask( |
387 FROM_HERE, | 387 FROM_HERE, |
388 base::Bind(base::IgnoreResult( | 388 base::Bind(base::IgnoreResult( |
389 &ServiceWorkerDatabase::PurgeUncommittedResourceIds), | 389 &ServiceWorkerDatabase::PurgeUncommittedResourceIds), |
390 base::Unretained(database_.get()), | 390 base::Unretained(database_.get()), |
391 std::set<int64>(&id, &id + 1))); | 391 std::set<int64>(&id, &id + 1))); |
392 StartPurgingResources(std::vector<int64>(1, id)); | 392 StartPurgingResources(std::vector<int64>(1, id)); |
393 } | 393 } |
394 | 394 |
| 395 void ServiceWorkerStorage::CompareScriptResources( |
| 396 int64 lhs_id, int64 rhs_id, |
| 397 const CompareCallback& callback) { |
| 398 // TODO: claim equality for the moment |
| 399 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_OK, 0)); |
| 400 } |
| 401 |
395 void ServiceWorkerStorage::DeleteAndStartOver(const StatusCallback& callback) { | 402 void ServiceWorkerStorage::DeleteAndStartOver(const StatusCallback& callback) { |
396 Disable(); | 403 Disable(); |
397 | 404 |
398 // Delete the database on the database thread. | 405 // Delete the database on the database thread. |
399 PostTaskAndReplyWithResult( | 406 PostTaskAndReplyWithResult( |
400 database_task_runner_, | 407 database_task_runner_, |
401 FROM_HERE, | 408 FROM_HERE, |
402 base::Bind(&ServiceWorkerDatabase::DestroyDatabase, | 409 base::Bind(&ServiceWorkerDatabase::DestroyDatabase, |
403 base::Unretained(database_.get())), | 410 base::Unretained(database_.get())), |
404 base::Bind(&ServiceWorkerStorage::DidDeleteDatabase, | 411 base::Bind(&ServiceWorkerStorage::DidDeleteDatabase, |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 // Give up the corruption recovery until the browser restarts. | 1203 // Give up the corruption recovery until the browser restarts. |
1197 LOG(ERROR) << "Failed to delete the diskcache."; | 1204 LOG(ERROR) << "Failed to delete the diskcache."; |
1198 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1205 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
1199 return; | 1206 return; |
1200 } | 1207 } |
1201 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1208 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
1202 callback.Run(SERVICE_WORKER_OK); | 1209 callback.Run(SERVICE_WORKER_OK); |
1203 } | 1210 } |
1204 | 1211 |
1205 } // namespace content | 1212 } // namespace content |
OLD | NEW |