OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DISK_CACHE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISK_CACHE_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISK_CACHE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISK_CACHE_H_ |
7 | 7 |
8 #include "content/browser/appcache/appcache_disk_cache.h" | 8 #include "content/browser/appcache/appcache_disk_cache.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 // Wholesale reusage of the appcache code for response reading, | 13 // Wholesale reusage of the appcache code for response reading, |
14 // writing, and storage. See the corresponding class in that | 14 // writing, and storage. See the corresponding class in that |
15 // library for doc comments and other details. | 15 // library for doc comments and other details. |
16 // TODO(michaeln): If this reuse sticks, refactor/move the | 16 // TODO(michaeln): If this reuse sticks, refactor/move the |
17 // resused classes to a more common location. | 17 // resused classes to a more common location. |
18 | 18 |
19 class CONTENT_EXPORT ServiceWorkerDiskCache | 19 class CONTENT_EXPORT ServiceWorkerDiskCache |
20 : public AppCacheDiskCache { | 20 : public AppCacheDiskCache { |
| 21 public: |
| 22 static scoped_ptr<ServiceWorkerDiskCache> CreateWithBlockFileBackend(); |
| 23 static scoped_ptr<ServiceWorkerDiskCache> CreateWithSimpleBackend(); |
| 24 |
| 25 private: |
| 26 friend class ServiceWorkerDiskCacheMigrator; |
| 27 friend class ServiceWorkerDiskCacheMigratorTest; |
| 28 explicit ServiceWorkerDiskCache(bool use_simple_cache); |
21 }; | 29 }; |
22 | 30 |
23 class CONTENT_EXPORT ServiceWorkerResponseReader | 31 class CONTENT_EXPORT ServiceWorkerResponseReader |
24 : public AppCacheResponseReader { | 32 : public AppCacheResponseReader { |
25 protected: | 33 protected: |
26 // Should only be constructed by the storage class. | 34 // Should only be constructed by the storage class. |
| 35 friend class ServiceWorkerDiskCacheMigrator; |
| 36 friend class ServiceWorkerDiskCacheMigratorTest; |
27 friend class ServiceWorkerStorage; | 37 friend class ServiceWorkerStorage; |
28 ServiceWorkerResponseReader( | 38 ServiceWorkerResponseReader( |
29 int64 response_id, | 39 int64 response_id, |
30 ServiceWorkerDiskCache* disk_cache); | 40 ServiceWorkerDiskCache* disk_cache); |
31 }; | 41 }; |
32 | 42 |
33 class CONTENT_EXPORT ServiceWorkerResponseWriter | 43 class CONTENT_EXPORT ServiceWorkerResponseWriter |
34 : public AppCacheResponseWriter { | 44 : public AppCacheResponseWriter { |
35 protected: | 45 protected: |
36 // Should only be constructed by the storage class. | 46 // Should only be constructed by the storage class. |
| 47 friend class ServiceWorkerDiskCacheMigrator; |
| 48 friend class ServiceWorkerDiskCacheMigratorTest; |
37 friend class ServiceWorkerStorage; | 49 friend class ServiceWorkerStorage; |
38 ServiceWorkerResponseWriter( | 50 ServiceWorkerResponseWriter( |
39 int64 response_id, | 51 int64 response_id, |
40 ServiceWorkerDiskCache* disk_cache); | 52 ServiceWorkerDiskCache* disk_cache); |
41 }; | 53 }; |
42 | 54 |
43 class CONTENT_EXPORT ServiceWorkerResponseMetadataWriter | 55 class CONTENT_EXPORT ServiceWorkerResponseMetadataWriter |
44 : public AppCacheResponseMetadataWriter { | 56 : public AppCacheResponseMetadataWriter { |
45 protected: | 57 protected: |
46 // Should only be constructed by the storage class. | 58 // Should only be constructed by the storage class. |
| 59 friend class ServiceWorkerDiskCacheMigrator; |
| 60 friend class ServiceWorkerDiskCacheMigratorTest; |
47 friend class ServiceWorkerStorage; | 61 friend class ServiceWorkerStorage; |
48 ServiceWorkerResponseMetadataWriter(int64 response_id, | 62 ServiceWorkerResponseMetadataWriter(int64 response_id, |
49 ServiceWorkerDiskCache* disk_cache); | 63 ServiceWorkerDiskCache* disk_cache); |
50 }; | 64 }; |
51 | 65 |
52 } // namespace content | 66 } // namespace content |
53 | 67 |
54 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISK_CACHE_H_ | 68 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISK_CACHE_H_ |
OLD | NEW |