OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace webkit_database { | 25 namespace webkit_database { |
26 class QuotaTable; | 26 class QuotaTable; |
27 } | 27 } |
28 | 28 |
29 namespace appcache { | 29 namespace appcache { |
30 | 30 |
31 class AppCacheDatabase { | 31 class AppCacheDatabase { |
32 public: | 32 public: |
33 struct GroupRecord { | 33 struct GroupRecord { |
| 34 GroupRecord(); |
| 35 ~GroupRecord(); |
| 36 |
34 int64 group_id; | 37 int64 group_id; |
35 GURL origin; | 38 GURL origin; |
36 GURL manifest_url; | 39 GURL manifest_url; |
37 base::Time creation_time; | 40 base::Time creation_time; |
38 base::Time last_access_time; | 41 base::Time last_access_time; |
39 GroupRecord() : group_id(0) {} | |
40 }; | 42 }; |
41 | 43 |
42 struct CacheRecord { | 44 struct CacheRecord { |
| 45 CacheRecord() |
| 46 : cache_id(0), group_id(0), online_wildcard(false), cache_size(0) {} |
| 47 |
43 int64 cache_id; | 48 int64 cache_id; |
44 int64 group_id; | 49 int64 group_id; |
45 bool online_wildcard; | 50 bool online_wildcard; |
46 base::Time update_time; | 51 base::Time update_time; |
47 int64 cache_size; // the sum of all response sizes in this cache | 52 int64 cache_size; // the sum of all response sizes in this cache |
48 CacheRecord() | |
49 : cache_id(0), group_id(0), online_wildcard(false), cache_size(0) {} | |
50 }; | 53 }; |
51 | 54 |
52 struct EntryRecord { | 55 struct EntryRecord { |
| 56 EntryRecord() : cache_id(0), flags(0), response_id(0), response_size(0) {} |
| 57 |
53 int64 cache_id; | 58 int64 cache_id; |
54 GURL url; | 59 GURL url; |
55 int flags; | 60 int flags; |
56 int64 response_id; | 61 int64 response_id; |
57 int64 response_size; | 62 int64 response_size; |
58 EntryRecord() : cache_id(0), flags(0), response_id(0), response_size(0) {} | |
59 }; | 63 }; |
60 | 64 |
61 struct FallbackNameSpaceRecord { | 65 struct FallbackNameSpaceRecord { |
| 66 FallbackNameSpaceRecord(); |
| 67 ~FallbackNameSpaceRecord(); |
| 68 |
62 int64 cache_id; | 69 int64 cache_id; |
63 GURL origin; // intentionally not normalized | 70 GURL origin; // intentionally not normalized |
64 GURL namespace_url; | 71 GURL namespace_url; |
65 GURL fallback_entry_url; | 72 GURL fallback_entry_url; |
66 FallbackNameSpaceRecord() : cache_id(0) {} | |
67 }; | 73 }; |
68 | 74 |
69 struct OnlineWhiteListRecord { | 75 struct OnlineWhiteListRecord { |
| 76 OnlineWhiteListRecord() : cache_id(0) {} |
| 77 |
70 int64 cache_id; | 78 int64 cache_id; |
71 GURL namespace_url; | 79 GURL namespace_url; |
72 OnlineWhiteListRecord() : cache_id(0) {} | |
73 }; | 80 }; |
74 | 81 |
75 explicit AppCacheDatabase(const FilePath& path); | 82 explicit AppCacheDatabase(const FilePath& path); |
76 ~AppCacheDatabase(); | 83 ~AppCacheDatabase(); |
77 | 84 |
78 void CloseConnection(); | 85 void CloseConnection(); |
79 void Disable(); | 86 void Disable(); |
80 bool is_disabled() const { return is_disabled_; } | 87 bool is_disabled() const { return is_disabled_; } |
81 | 88 |
82 int64 GetDefaultOriginQuota() { return 5 * 1024 * 1024; } | 89 int64 GetDefaultOriginQuota() { return 5 * 1024 * 1024; } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); | 211 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); |
205 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); | 212 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); |
206 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, Quotas); | 213 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, Quotas); |
207 | 214 |
208 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); | 215 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); |
209 }; | 216 }; |
210 | 217 |
211 } // namespace appcache | 218 } // namespace appcache |
212 | 219 |
213 #endif // WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ | 220 #endif // WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ |
OLD | NEW |