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

Side by Side Diff: webkit/fileapi/file_system_usage_cache.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « webkit/fileapi/file_system_url_unittest.cc ('k') | webkit/fileapi/file_system_usage_cache.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "webkit/storage/webkit_storage_export.h" 10 #include "webkit/storage/webkit_storage_export.h"
11 11
12 namespace fileapi { 12 namespace fileapi {
13 13
14 class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemUsageCache { 14 class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemUsageCache {
15 public: 15 public:
16 // Gets the size described in the .usage file even if dirty > 0 or 16 // Gets the size described in the .usage file even if dirty > 0 or
17 // is_valid == false. Returns less than zero if the .usage file is not 17 // is_valid == false. Returns less than zero if the .usage file is not
18 // available. 18 // available.
19 static int64 GetUsage(const FilePath& usage_file_path); 19 static int64 GetUsage(const base::FilePath& usage_file_path);
20 20
21 // Gets the dirty count in the .usage file. 21 // Gets the dirty count in the .usage file.
22 // Returns less than zero if the .usage file is not available. 22 // Returns less than zero if the .usage file is not available.
23 static int32 GetDirty(const FilePath& usage_file_path); 23 static int32 GetDirty(const base::FilePath& usage_file_path);
24 24
25 // Increments or decrements the "dirty" entry in the .usage file. 25 // Increments or decrements the "dirty" entry in the .usage file.
26 // Returns false if no .usage is available. 26 // Returns false if no .usage is available.
27 static bool IncrementDirty(const FilePath& usage_file_path); 27 static bool IncrementDirty(const base::FilePath& usage_file_path);
28 static bool DecrementDirty(const FilePath& usage_file_path); 28 static bool DecrementDirty(const base::FilePath& usage_file_path);
29 29
30 // Notifies quota system that it needs to recalculate the usage cache of the 30 // Notifies quota system that it needs to recalculate the usage cache of the
31 // origin. Returns false if no .usage is available. 31 // origin. Returns false if no .usage is available.
32 static bool Invalidate(const FilePath& usage_file_path); 32 static bool Invalidate(const base::FilePath& usage_file_path);
33 static bool IsValid(const FilePath& usage_file_path); 33 static bool IsValid(const base::FilePath& usage_file_path);
34 34
35 // Updates the size described in the .usage file. 35 // Updates the size described in the .usage file.
36 static int UpdateUsage(const FilePath& usage_file_path, int64 fs_usage); 36 static int UpdateUsage(const base::FilePath& usage_file_path, int64 fs_usage);
37 37
38 // Updates the size described in the .usage file by delta with keeping dirty 38 // Updates the size described in the .usage file by delta with keeping dirty
39 // even if dirty > 0. 39 // even if dirty > 0.
40 static int AtomicUpdateUsageByDelta( 40 static int AtomicUpdateUsageByDelta(
41 const FilePath& usage_file_path, int64 delta); 41 const base::FilePath& usage_file_path, int64 delta);
42 42
43 static bool Exists(const FilePath& usage_file_path); 43 static bool Exists(const base::FilePath& usage_file_path);
44 static bool Delete(const FilePath& usage_file_path); 44 static bool Delete(const base::FilePath& usage_file_path);
45 45
46 static const FilePath::CharType kUsageFileName[]; 46 static const base::FilePath::CharType kUsageFileName[];
47 static const char kUsageFileHeader[]; 47 static const char kUsageFileHeader[];
48 static const int kUsageFileSize; 48 static const int kUsageFileSize;
49 static const int kUsageFileHeaderSize; 49 static const int kUsageFileHeaderSize;
50 50
51 private: 51 private:
52 // Read the size, validity and the "dirty" entry described in the .usage file. 52 // Read the size, validity and the "dirty" entry described in the .usage file.
53 // Returns less than zero if no .usage file is available. 53 // Returns less than zero if no .usage file is available.
54 static int64 Read(const FilePath& usage_file_path, 54 static int64 Read(const base::FilePath& usage_file_path,
55 bool* is_valid, 55 bool* is_valid,
56 uint32* dirty); 56 uint32* dirty);
57 57
58 static int Write(const FilePath& usage_file_path, 58 static int Write(const base::FilePath& usage_file_path,
59 bool is_valid, 59 bool is_valid,
60 uint32 dirty, 60 uint32 dirty,
61 int64 fs_usage); 61 int64 fs_usage);
62 }; 62 };
63 63
64 } // namespace fileapi 64 } // namespace fileapi
65 65
66 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_ 66 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_USAGE_CACHE_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_url_unittest.cc ('k') | webkit/fileapi/file_system_usage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698