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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 return make_scoped_ptr( | 636 return make_scoped_ptr( |
637 new ServiceWorkerResponseReader(response_id, disk_cache())); | 637 new ServiceWorkerResponseReader(response_id, disk_cache())); |
638 } | 638 } |
639 | 639 |
640 scoped_ptr<ServiceWorkerResponseWriter> | 640 scoped_ptr<ServiceWorkerResponseWriter> |
641 ServiceWorkerStorage::CreateResponseWriter(int64 response_id) { | 641 ServiceWorkerStorage::CreateResponseWriter(int64 response_id) { |
642 return make_scoped_ptr( | 642 return make_scoped_ptr( |
643 new ServiceWorkerResponseWriter(response_id, disk_cache())); | 643 new ServiceWorkerResponseWriter(response_id, disk_cache())); |
644 } | 644 } |
645 | 645 |
| 646 scoped_ptr<ServiceWorkerResponseMetadataWriter> |
| 647 ServiceWorkerStorage::CreateResponseMetadataWriter(int64 response_id) { |
| 648 return make_scoped_ptr( |
| 649 new ServiceWorkerResponseMetadataWriter(response_id, disk_cache())); |
| 650 } |
| 651 |
646 void ServiceWorkerStorage::StoreUncommittedResponseId(int64 id) { | 652 void ServiceWorkerStorage::StoreUncommittedResponseId(int64 id) { |
647 DCHECK_NE(kInvalidServiceWorkerResponseId, id); | 653 DCHECK_NE(kInvalidServiceWorkerResponseId, id); |
648 DCHECK_EQ(INITIALIZED, state_); | 654 DCHECK_EQ(INITIALIZED, state_); |
649 | 655 |
650 if (!has_checked_for_stale_resources_) | 656 if (!has_checked_for_stale_resources_) |
651 DeleteStaleResources(); | 657 DeleteStaleResources(); |
652 | 658 |
653 database_task_manager_->GetTaskRunner()->PostTask( | 659 database_task_manager_->GetTaskRunner()->PostTask( |
654 FROM_HERE, | 660 FROM_HERE, |
655 base::Bind(base::IgnoreResult( | 661 base::Bind(base::IgnoreResult( |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 // Give up the corruption recovery until the browser restarts. | 1777 // Give up the corruption recovery until the browser restarts. |
1772 LOG(ERROR) << "Failed to delete the diskcache."; | 1778 LOG(ERROR) << "Failed to delete the diskcache."; |
1773 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1779 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
1774 return; | 1780 return; |
1775 } | 1781 } |
1776 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1782 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
1777 callback.Run(SERVICE_WORKER_OK); | 1783 callback.Run(SERVICE_WORKER_OK); |
1778 } | 1784 } |
1779 | 1785 |
1780 } // namespace content | 1786 } // namespace content |
OLD | NEW |