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

Unified Diff: webkit/fileapi/file_system_usage_cache.h

Issue 7608018: Handle inconsistency between DB and Files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/file_system_usage_cache.h
diff --git a/webkit/fileapi/file_system_usage_cache.h b/webkit/fileapi/file_system_usage_cache.h
index 7c38bfbf8db77a407fabe633bfb15fd0e3345ce5..ae3a2e6976e01cde4d503b5724f5cbe898e7e883 100644
--- a/webkit/fileapi/file_system_usage_cache.h
+++ b/webkit/fileapi/file_system_usage_cache.h
@@ -12,8 +12,9 @@ namespace fileapi {
class FileSystemUsageCache {
public:
- // Gets the size described in the .usage file even if dirty > 0.
- // Returns less than zero if the .usage file is not available.
+ // Gets the size described in the .usage file even if dirty > 0 or
+ // is_valid == false. Returns less than zero if the .usage file is not
+ // available.
static int64 GetUsage(const FilePath& usage_file_path);
// Gets the dirty count in the .usage file.
@@ -25,6 +26,11 @@ class FileSystemUsageCache {
static bool IncrementDirty(const FilePath& usage_file_path);
static bool DecrementDirty(const FilePath& usage_file_path);
+ // Notifies quota system need to recalculate their usage cache of the origin.
ericu 2011/08/24 03:43:50 s/need/that it needs/ s/their/the Sorry, I know i
tzik 2011/08/29 06:54:13 Done.
+ // Returns false if no .usage is available.
+ static bool Invalidate(const FilePath& usage_file_path);
+ static bool IsValid(const FilePath& usage_file_path);
+
// Updates the size described in the .usage file.
static int UpdateUsage(const FilePath& usage_file_path, int64 fs_usage);
@@ -42,12 +48,16 @@ class FileSystemUsageCache {
static const int kUsageFileHeaderSize;
private:
- // Read the size and the "dirty" entry described in the .usage file.
+ // Read the size, validity and the "dirty" entry described in the .usage file.
// Returns less than zero if no .usage file is available.
- static int64 Read(const FilePath& usage_file_path, uint32* dirty);
+ static int64 Read(const FilePath& usage_file_path,
+ bool* is_valid,
+ uint32* dirty);
static int Write(const FilePath& usage_file_path,
- uint32 dirty, int64 fs_usage);
+ bool is_valid,
+ uint32 dirty,
+ int64 fs_usage);
};
} // namespace fileapi

Powered by Google App Engine
This is Rietveld 408576698