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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 typedef std::vector<ServiceWorkerDatabase::ResourceRecord> ResourceList; | 47 typedef std::vector<ServiceWorkerDatabase::ResourceRecord> ResourceList; |
48 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; | 48 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; |
49 typedef base::Callback<void(ServiceWorkerStatusCode status, | 49 typedef base::Callback<void(ServiceWorkerStatusCode status, |
50 const scoped_refptr<ServiceWorkerRegistration>& | 50 const scoped_refptr<ServiceWorkerRegistration>& |
51 registration)> FindRegistrationCallback; | 51 registration)> FindRegistrationCallback; |
52 typedef base::Callback< | 52 typedef base::Callback< |
53 void(const std::vector<ServiceWorkerRegistrationInfo>& registrations)> | 53 void(const std::vector<ServiceWorkerRegistrationInfo>& registrations)> |
54 GetAllRegistrationInfosCallback; | 54 GetAllRegistrationInfosCallback; |
55 typedef base::Callback< | 55 typedef base::Callback< |
56 void(ServiceWorkerStatusCode status, int result)> | 56 void(ServiceWorkerStatusCode status, int compare_result)> |
57 CompareCallback; | 57 CompareCallback; |
58 | 58 |
59 virtual ~ServiceWorkerStorage(); | 59 virtual ~ServiceWorkerStorage(); |
60 | 60 |
61 static scoped_ptr<ServiceWorkerStorage> Create( | 61 static scoped_ptr<ServiceWorkerStorage> Create( |
62 const base::FilePath& path, | 62 const base::FilePath& path, |
63 base::WeakPtr<ServiceWorkerContextCore> context, | 63 base::WeakPtr<ServiceWorkerContextCore> context, |
64 base::SequencedTaskRunner* database_task_runner, | 64 base::SequencedTaskRunner* database_task_runner, |
65 base::MessageLoopProxy* disk_cache_thread, | 65 base::MessageLoopProxy* disk_cache_thread, |
66 quota::QuotaManagerProxy* quota_manager_proxy); | 66 quota::QuotaManagerProxy* quota_manager_proxy); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 int64 response_id); | 117 int64 response_id); |
118 | 118 |
119 // Adds |id| to the set of resources ids that are in the disk | 119 // Adds |id| to the set of resources ids that are in the disk |
120 // cache but not yet stored with a registration. | 120 // cache but not yet stored with a registration. |
121 void StoreUncommittedResponseId(int64 id); | 121 void StoreUncommittedResponseId(int64 id); |
122 | 122 |
123 // Removes |id| from uncommitted list, adds it to the | 123 // Removes |id| from uncommitted list, adds it to the |
124 // purgeable list and purges it. | 124 // purgeable list and purges it. |
125 void DoomUncommittedResponse(int64 id); | 125 void DoomUncommittedResponse(int64 id); |
126 | 126 |
| 127 void CompareScriptResources(int64 lhs_id, int64 rhs_id, |
| 128 const CompareCallback& callback); |
| 129 |
127 // Deletes the storage and starts over. | 130 // Deletes the storage and starts over. |
128 void DeleteAndStartOver(const StatusCallback& callback); | 131 void DeleteAndStartOver(const StatusCallback& callback); |
129 | 132 |
130 // Returns new IDs which are guaranteed to be unique in the storage. | 133 // Returns new IDs which are guaranteed to be unique in the storage. |
131 int64 NewRegistrationId(); | 134 int64 NewRegistrationId(); |
132 int64 NewVersionId(); | 135 int64 NewVersionId(); |
133 int64 NewResourceId(); | 136 int64 NewResourceId(); |
134 | 137 |
135 // Intended for use only by ServiceWorkerRegisterJob. | 138 // Intended for use only by ServiceWorkerRegisterJob. |
136 void NotifyInstallingRegistration( | 139 void NotifyInstallingRegistration( |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 bool has_checked_for_stale_resources_; | 356 bool has_checked_for_stale_resources_; |
354 | 357 |
355 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 358 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
356 | 359 |
357 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 360 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
358 }; | 361 }; |
359 | 362 |
360 } // namespace content | 363 } // namespace content |
361 | 364 |
362 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 365 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
OLD | NEW |