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_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 static int UpdateUsage(const FilePath& usage_file_path, int64 fs_usage); | 35 static int UpdateUsage(const FilePath& usage_file_path, int64 fs_usage); |
36 | 36 |
37 // Updates the size described in the .usage file by delta with keeping dirty | 37 // Updates the size described in the .usage file by delta with keeping dirty |
38 // even if dirty > 0. | 38 // even if dirty > 0. |
39 static int AtomicUpdateUsageByDelta( | 39 static int AtomicUpdateUsageByDelta( |
40 const FilePath& usage_file_path, int64 delta); | 40 const FilePath& usage_file_path, int64 delta); |
41 | 41 |
42 static bool Exists(const FilePath& usage_file_path); | 42 static bool Exists(const FilePath& usage_file_path); |
43 static bool Delete(const FilePath& usage_file_path); | 43 static bool Delete(const FilePath& usage_file_path); |
44 | 44 |
45 static const char kUsageFileName[]; | 45 static const FilePath::CharType kUsageFileName[]; |
46 static const char kUsageFileHeader[]; | 46 static const char kUsageFileHeader[]; |
47 static const int kUsageFileSize; | 47 static const int kUsageFileSize; |
48 static const int kUsageFileHeaderSize; | 48 static const int kUsageFileHeaderSize; |
49 | 49 |
50 private: | 50 private: |
51 // Read the size, validity and the "dirty" entry described in the .usage file. | 51 // Read the size, validity and the "dirty" entry described in the .usage file. |
52 // Returns less than zero if no .usage file is available. | 52 // Returns less than zero if no .usage file is available. |
53 static int64 Read(const FilePath& usage_file_path, | 53 static int64 Read(const FilePath& usage_file_path, |
54 bool* is_valid, | 54 bool* is_valid, |
55 uint32* dirty); | 55 uint32* dirty); |
56 | 56 |
57 static int Write(const FilePath& usage_file_path, | 57 static int Write(const FilePath& usage_file_path, |
58 bool is_valid, | 58 bool is_valid, |
59 uint32 dirty, | 59 uint32 dirty, |
60 int64 fs_usage); | 60 int64 fs_usage); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace fileapi | 63 } // namespace fileapi |
64 | 64 |
65 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ | 65 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ |
OLD | NEW |