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_STORAGE_IMPL_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 class MakeGroupObsoleteTask; | 73 class MakeGroupObsoleteTask; |
74 class GetDeletableResponseIdsTask; | 74 class GetDeletableResponseIdsTask; |
75 class InsertDeletableResponseIdsTask; | 75 class InsertDeletableResponseIdsTask; |
76 class DeleteDeletableResponseIdsTask; | 76 class DeleteDeletableResponseIdsTask; |
77 class UpdateGroupLastAccessTimeTask; | 77 class UpdateGroupLastAccessTimeTask; |
78 | 78 |
79 typedef std::deque<DatabaseTask*> DatabaseTaskQueue; | 79 typedef std::deque<DatabaseTask*> DatabaseTaskQueue; |
80 typedef std::map<int64, CacheLoadTask*> PendingCacheLoads; | 80 typedef std::map<int64, CacheLoadTask*> PendingCacheLoads; |
81 typedef std::map<GURL, GroupLoadTask*> PendingGroupLoads; | 81 typedef std::map<GURL, GroupLoadTask*> PendingGroupLoads; |
82 typedef std::deque<std::pair<GURL, int64> > PendingForeignMarkings; | 82 typedef std::deque<std::pair<GURL, int64> > PendingForeignMarkings; |
| 83 typedef std::set<StoreGroupAndCacheTask*> PendingQuotaQueries; |
83 | 84 |
84 bool IsInitTaskComplete() { | 85 bool IsInitTaskComplete() { |
85 return last_cache_id_ != AppCacheStorage::kUnitializedId; | 86 return last_cache_id_ != AppCacheStorage::kUnitializedId; |
86 } | 87 } |
87 | 88 |
88 CacheLoadTask* GetPendingCacheLoadTask(int64 cache_id); | 89 CacheLoadTask* GetPendingCacheLoadTask(int64 cache_id); |
89 GroupLoadTask* GetPendingGroupLoadTask(const GURL& manifest_url); | 90 GroupLoadTask* GetPendingGroupLoadTask(const GURL& manifest_url); |
90 void GetPendingForeignMarkingsForCache( | 91 void GetPendingForeignMarkingsForCache( |
91 int64 cache_id, std::vector<GURL>* urls); | 92 int64 cache_id, std::vector<GURL>* urls); |
92 | 93 |
(...skipping 27 matching lines...) Expand all Loading... |
120 // The directory in which we place files in the file system. | 121 // The directory in which we place files in the file system. |
121 FilePath cache_directory_; | 122 FilePath cache_directory_; |
122 scoped_refptr<base::MessageLoopProxy> cache_thread_; | 123 scoped_refptr<base::MessageLoopProxy> cache_thread_; |
123 bool is_incognito_; | 124 bool is_incognito_; |
124 | 125 |
125 // Structures to keep track of DatabaseTasks that are in-flight. | 126 // Structures to keep track of DatabaseTasks that are in-flight. |
126 DatabaseTaskQueue scheduled_database_tasks_; | 127 DatabaseTaskQueue scheduled_database_tasks_; |
127 PendingCacheLoads pending_cache_loads_; | 128 PendingCacheLoads pending_cache_loads_; |
128 PendingGroupLoads pending_group_loads_; | 129 PendingGroupLoads pending_group_loads_; |
129 PendingForeignMarkings pending_foreign_markings_; | 130 PendingForeignMarkings pending_foreign_markings_; |
| 131 PendingQuotaQueries pending_quota_queries_; |
130 | 132 |
131 // Structures to keep track of lazy response deletion. | 133 // Structures to keep track of lazy response deletion. |
132 std::deque<int64> deletable_response_ids_; | 134 std::deque<int64> deletable_response_ids_; |
133 std::vector<int64> deleted_response_ids_; | 135 std::vector<int64> deleted_response_ids_; |
134 bool is_response_deletion_scheduled_; | 136 bool is_response_deletion_scheduled_; |
135 bool did_start_deleting_responses_; | 137 bool did_start_deleting_responses_; |
136 int64 last_deletable_response_rowid_; | 138 int64 last_deletable_response_rowid_; |
137 | 139 |
138 // AppCacheDiskCache async callbacks | 140 // AppCacheDiskCache async callbacks |
139 net::CompletionCallbackImpl<AppCacheStorageImpl> doom_callback_; | 141 net::CompletionCallbackImpl<AppCacheStorageImpl> doom_callback_; |
140 net::CompletionCallbackImpl<AppCacheStorageImpl> init_callback_; | 142 net::CompletionCallbackImpl<AppCacheStorageImpl> init_callback_; |
141 | 143 |
142 // Created on the IO thread, but only used on the DB thread. | 144 // Created on the IO thread, but only used on the DB thread. |
143 AppCacheDatabase* database_; | 145 AppCacheDatabase* database_; |
144 | 146 |
145 // Set if we discover a fatal error like a corrupt sql database or | 147 // Set if we discover a fatal error like a corrupt sql database or |
146 // disk cache and cannot continue. | 148 // disk cache and cannot continue. |
147 bool is_disabled_; | 149 bool is_disabled_; |
148 | 150 |
149 // TODO(michaeln): use a disk_cache per group (manifest or group_id). | 151 // TODO(michaeln): use a disk_cache per group (manifest or group_id). |
150 scoped_ptr<AppCacheDiskCache> disk_cache_; | 152 scoped_ptr<AppCacheDiskCache> disk_cache_; |
151 | 153 |
152 // Used to short-circuit certain operations without having to schedule | 154 // Used to short-circuit certain operations without having to schedule |
153 // any tasks on the background database thread. | 155 // any tasks on the background database thread. |
154 std::set<GURL> origins_with_groups_; | |
155 std::deque<Task*> pending_simple_tasks_; | 156 std::deque<Task*> pending_simple_tasks_; |
156 ScopedRunnableMethodFactory<AppCacheStorageImpl> method_factory_; | 157 ScopedRunnableMethodFactory<AppCacheStorageImpl> method_factory_; |
157 | 158 |
158 FRIEND_TEST_ALL_PREFIXES(ChromeAppCacheServiceTest, KeepOnDestruction); | 159 FRIEND_TEST_ALL_PREFIXES(ChromeAppCacheServiceTest, KeepOnDestruction); |
159 FRIEND_TEST_ALL_PREFIXES(ChromeAppCacheServiceTest, RemoveOnDestruction); | 160 FRIEND_TEST_ALL_PREFIXES(ChromeAppCacheServiceTest, RemoveOnDestruction); |
160 }; | 161 }; |
161 | 162 |
162 } // namespace appcache | 163 } // namespace appcache |
163 | 164 |
164 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ | 165 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_IMPL_H_ |
OLD | NEW |