| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "content/browser/service_worker/service_worker_database.h" | 17 #include "content/browser/service_worker/service_worker_database.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/service_worker/service_worker_status_code.h" | 19 #include "content/common/service_worker/service_worker_status_code.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class MessageLoopProxy; |
| 23 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace quota { | 27 namespace quota { |
| 27 class QuotaManagerProxy; | 28 class QuotaManagerProxy; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 | 32 |
| 32 class ServiceWorkerContextCore; | 33 class ServiceWorkerContextCore; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 int64 next_resource_id; | 59 int64 next_resource_id; |
| 59 std::set<GURL> origins; | 60 std::set<GURL> origins; |
| 60 | 61 |
| 61 InitialData(); | 62 InitialData(); |
| 62 ~InitialData(); | 63 ~InitialData(); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 ServiceWorkerStorage(const base::FilePath& path, | 66 ServiceWorkerStorage(const base::FilePath& path, |
| 66 base::WeakPtr<ServiceWorkerContextCore> context, | 67 base::WeakPtr<ServiceWorkerContextCore> context, |
| 67 base::SequencedTaskRunner* database_task_runner, | 68 base::SequencedTaskRunner* database_task_runner, |
| 69 base::MessageLoopProxy* disk_cache_thread, |
| 68 quota::QuotaManagerProxy* quota_manager_proxy); | 70 quota::QuotaManagerProxy* quota_manager_proxy); |
| 69 ~ServiceWorkerStorage(); | 71 ~ServiceWorkerStorage(); |
| 70 | 72 |
| 71 // Finds registration for |document_url| or |pattern| or |registration_id|. | 73 // Finds registration for |document_url| or |pattern| or |registration_id|. |
| 72 // The Find methods will find stored and initially installing registrations. | 74 // The Find methods will find stored and initially installing registrations. |
| 73 // Returns SERVICE_WORKER_OK with non-null registration if registration | 75 // Returns SERVICE_WORKER_OK with non-null registration if registration |
| 74 // is found, or returns SERVICE_WORKER_ERROR_NOT_FOUND if no matching | 76 // is found, or returns SERVICE_WORKER_ERROR_NOT_FOUND if no matching |
| 75 // registration is found. The FindRegistrationForPattern method is | 77 // registration is found. The FindRegistrationForPattern method is |
| 76 // guaranteed to return asynchronously. However, the methods to find | 78 // guaranteed to return asynchronously. However, the methods to find |
| 77 // for |document_url| or |registration_id| may complete immediately | 79 // for |document_url| or |registration_id| may complete immediately |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 }; | 203 }; |
| 202 State state_; | 204 State state_; |
| 203 | 205 |
| 204 base::FilePath path_; | 206 base::FilePath path_; |
| 205 base::WeakPtr<ServiceWorkerContextCore> context_; | 207 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 206 | 208 |
| 207 // Only accessed on |database_task_runner_|. | 209 // Only accessed on |database_task_runner_|. |
| 208 scoped_ptr<ServiceWorkerDatabase> database_; | 210 scoped_ptr<ServiceWorkerDatabase> database_; |
| 209 | 211 |
| 210 scoped_refptr<base::SequencedTaskRunner> database_task_runner_; | 212 scoped_refptr<base::SequencedTaskRunner> database_task_runner_; |
| 213 scoped_refptr<base::MessageLoopProxy> disk_cache_thread_; |
| 211 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 214 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 212 scoped_ptr<ServiceWorkerDiskCache> disk_cache_; | 215 scoped_ptr<ServiceWorkerDiskCache> disk_cache_; |
| 213 | 216 |
| 214 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; | 217 base::WeakPtrFactory<ServiceWorkerStorage> weak_factory_; |
| 215 | 218 |
| 216 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); | 219 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerStorage); |
| 217 }; | 220 }; |
| 218 | 221 |
| 219 } // namespace content | 222 } // namespace content |
| 220 | 223 |
| 221 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ | 224 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_STORAGE_H_ |
| OLD | NEW |