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