OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> |
8 #include <set> | 9 #include <set> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 13 #include "base/file_path.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/time.h" | 16 #include "base/time.h" |
16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
17 | 18 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 GURL namespace_url; | 80 GURL namespace_url; |
80 }; | 81 }; |
81 | 82 |
82 explicit AppCacheDatabase(const FilePath& path); | 83 explicit AppCacheDatabase(const FilePath& path); |
83 ~AppCacheDatabase(); | 84 ~AppCacheDatabase(); |
84 | 85 |
85 void CloseConnection(); | 86 void CloseConnection(); |
86 void Disable(); | 87 void Disable(); |
87 bool is_disabled() const { return is_disabled_; } | 88 bool is_disabled() const { return is_disabled_; } |
88 | 89 |
| 90 // TODO(michaeln): Remove quota support from this class. |
89 int64 GetDefaultOriginQuota() { return 5 * 1024 * 1024; } | 91 int64 GetDefaultOriginQuota() { return 5 * 1024 * 1024; } |
| 92 int64 GetOriginQuota(const GURL& origin); |
| 93 |
90 int64 GetOriginUsage(const GURL& origin); | 94 int64 GetOriginUsage(const GURL& origin); |
91 int64 GetOriginQuota(const GURL& origin); | 95 bool GetAllOriginUsage(std::map<GURL, int64>* usage_map); |
92 | 96 |
93 bool FindOriginsWithGroups(std::set<GURL>* origins); | 97 bool FindOriginsWithGroups(std::set<GURL>* origins); |
94 bool FindLastStorageIds( | 98 bool FindLastStorageIds( |
95 int64* last_group_id, int64* last_cache_id, int64* last_response_id, | 99 int64* last_group_id, int64* last_cache_id, int64* last_response_id, |
96 int64* last_deletable_response_rowid); | 100 int64* last_deletable_response_rowid); |
97 | 101 |
98 bool FindGroup(int64 group_id, GroupRecord* record); | 102 bool FindGroup(int64 group_id, GroupRecord* record); |
99 bool FindGroupForManifestUrl(const GURL& manifest_url, GroupRecord* record); | 103 bool FindGroupForManifestUrl(const GURL& manifest_url, GroupRecord* record); |
100 bool FindGroupsForOrigin( | 104 bool FindGroupsForOrigin( |
101 const GURL& origin, std::vector<GroupRecord>* records); | 105 const GURL& origin, std::vector<GroupRecord>* records); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); | 215 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); |
212 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); | 216 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); |
213 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, Quotas); | 217 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, Quotas); |
214 | 218 |
215 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); | 219 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); |
216 }; | 220 }; |
217 | 221 |
218 } // namespace appcache | 222 } // namespace appcache |
219 | 223 |
220 #endif // WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ | 224 #endif // WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ |
OLD | NEW |