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

Unified Diff: content/browser/in_process_webkit/indexed_db_context.h

Issue 7470008: Improve IndexedDB's quota support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: improve names and comments, better map cleanup Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/in_process_webkit/indexed_db_context.h
diff --git a/content/browser/in_process_webkit/indexed_db_context.h b/content/browser/in_process_webkit/indexed_db_context.h
index 408cccc737a15a2a863092a8093bbbcdeeb3e9a9..ef3a4728f6ba1ab03fcf2815f0770a6f6c1c6eec 100644
--- a/content/browser/in_process_webkit/indexed_db_context.h
+++ b/content/browser/in_process_webkit/indexed_db_context.h
@@ -12,6 +12,8 @@
#include "base/memory/scoped_ptr.h"
#include "content/browser/browser_thread.h"
+#include <map>
kinuko 2011/08/03 09:12:22 nit: this must be above other chromium headers
dgrogan 2011/08/03 21:45:47 Done.
+
class GURL;
class FilePath;
class WebKitContext;
@@ -53,17 +55,33 @@ class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> {
clear_local_state_on_exit_ = clear_local_state;
}
- // Deletes a single indexed db file.
+ // Deletes the leveldb directory for a single origin.
void DeleteIndexedDBFile(const FilePath& file_path);
- // Deletes all indexed db files for the given origin.
+ // Deletes all indexed db files for the given origin. Only works for
+ // extensions, not any origin.
void DeleteIndexedDBForOrigin(const string16& origin_id);
+ // TODO(dgrogan): Once we can delete IndexedDB directories out from
+ // underneath open webkit instances, merge this, DeleteIndexedDBForOrigin and
+ // DeleteIndexedDBFile.
+ void EvictOriginIfNotInUse(const GURL& origin_url);
+
// Does a particular origin get unlimited storage?
bool IsUnlimitedStorageGranted(const GURL& origin) const;
void GetAllOriginIdentifiers(std::vector<string16>* origin_ids);
+ void NewConnection(const GURL& origin_url);
+ void TransactionComplete(const GURL& origin_url);
+ void ConnectionClosed(const GURL& origin_url);
+ int64 InitializeDiskUsage(const GURL& origin_url);
+ void GotUpdatedQuota(const GURL& origin_url, int64 usage, int64 quota);
+ bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes);
+ bool IsOverQuota(const GURL& origin_url);
+
+ void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url);
+
quota::QuotaManagerProxy* quota_manager_proxy();
#ifdef UNIT_TEST
@@ -85,6 +103,15 @@ class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> {
scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBContext);
+
+ typedef std::map<GURL, int64> OriginToSizeMap;
+ OriginToSizeMap origin_size_map_;
+ OriginToSizeMap origin_allocated_quota_map_;
+
+ std::map<GURL, unsigned int> connection_count_;
+
+ int64 ReadUsageFromDisk(const GURL& origin_url) const;
+ void QueryAvailableQuota(const GURL& origin_url);
};
#endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698