Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: webkit/appcache/appcache_storage.h

Issue 3083014: AppCache: Provide a way to override the default quota for an origin. The inte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/appcache/appcache_storage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_STORAGE_H_
6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_STORAGE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 virtual void DoomResponses( 160 virtual void DoomResponses(
161 const GURL& manifest_url, const std::vector<int64>& response_ids) = 0; 161 const GURL& manifest_url, const std::vector<int64>& response_ids) = 0;
162 162
163 // Schedules the lazy deletion of responses without persistently saving 163 // Schedules the lazy deletion of responses without persistently saving
164 // the response ids. 164 // the response ids.
165 virtual void DeleteResponses( 165 virtual void DeleteResponses(
166 const GURL& manifest_url, const std::vector<int64>& response_ids) = 0; 166 const GURL& manifest_url, const std::vector<int64>& response_ids) = 0;
167 167
168 virtual void PurgeMemory() = 0; 168 virtual void PurgeMemory() = 0;
169 169
170 // Maintain a collection of quota overrides in memory.
171 void SetOriginQuotaInMemory(const GURL& origin, int64 quota);
172 void ResetOriginQuotaInMemory(const GURL& origin);
173 int64 GetOriginQuotaInMemory(const GURL& origin);
174
170 // Generates unique storage ids for different object types. 175 // Generates unique storage ids for different object types.
171 int64 NewCacheId() { 176 int64 NewCacheId() {
172 return ++last_cache_id_; 177 return ++last_cache_id_;
173 } 178 }
174 int64 NewGroupId() { 179 int64 NewGroupId() {
175 return ++last_group_id_; 180 return ++last_group_id_;
176 } 181 }
177 182
178 // The working set of object instances currently in memory. 183 // The working set of object instances currently in memory.
179 AppCacheWorkingSet* working_set() { return &working_set_; } 184 AppCacheWorkingSet* working_set() { return &working_set_; }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 if (iter != pending_info_loads_.end()) 282 if (iter != pending_info_loads_.end())
278 return iter->second; 283 return iter->second;
279 return new ResponseInfoLoadTask(manifest_url, response_id, this); 284 return new ResponseInfoLoadTask(manifest_url, response_id, this);
280 } 285 }
281 286
282 // Should only be called when creating a new response writer. 287 // Should only be called when creating a new response writer.
283 int64 NewResponseId() { 288 int64 NewResponseId() {
284 return ++last_response_id_; 289 return ++last_response_id_;
285 } 290 }
286 291
292 // Store quotas for extensions in memory, in order to prevent writing a row
293 // to quota_table_ every time an extention is loaded.
294 typedef std::map<GURL, int64> QuotaMap;
295 QuotaMap in_memory_quotas_;
296
287 // The last storage id used for different object types. 297 // The last storage id used for different object types.
288 int64 last_cache_id_; 298 int64 last_cache_id_;
289 int64 last_group_id_; 299 int64 last_group_id_;
290 int64 last_response_id_; 300 int64 last_response_id_;
291 301
292 AppCacheWorkingSet working_set_; 302 AppCacheWorkingSet working_set_;
293 AppCacheService* service_; 303 AppCacheService* service_;
294 DelegateReferenceMap delegate_references_; 304 DelegateReferenceMap delegate_references_;
295 PendingResponseInfoLoads pending_info_loads_; 305 PendingResponseInfoLoads pending_info_loads_;
296 306
297 // The set of last ids must be retrieved from storage prior to being used. 307 // The set of last ids must be retrieved from storage prior to being used.
298 static const int64 kUnitializedId; 308 static const int64 kUnitializedId;
299 309
300 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, DelegateReferences); 310 FRIEND_TEST_ALL_PREFIXES(AppCacheStorageTest, DelegateReferences);
301 311
302 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage); 312 DISALLOW_COPY_AND_ASSIGN(AppCacheStorage);
303 }; 313 };
304 314
305 } // namespace appcache 315 } // namespace appcache
306 316
307 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_H_ 317 #endif // WEBKIT_APPCACHE_APPCACHE_STORAGE_H_
308 318
OLDNEW
« no previous file with comments | « no previous file | webkit/appcache/appcache_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698