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

Side by Side Diff: components/drive/chromeos/file_cache.h

Issue 2048993002: Add an API to get total size of Drive cache including non-evictable ones. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an unnecessary parameter. Created 4 years, 6 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
« no previous file with comments | « components/drive/chromeos/fake_file_system.cc ('k') | components/drive/chromeos/file_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 COMPONENTS_DRIVE_CHROMEOS_FILE_CACHE_H_ 5 #ifndef COMPONENTS_DRIVE_CHROMEOS_FILE_CACHE_H_
6 #define COMPONENTS_DRIVE_CHROMEOS_FILE_CACHE_H_ 6 #define COMPONENTS_DRIVE_CHROMEOS_FILE_CACHE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // 86 //
87 // Can be called on any thread. 87 // Can be called on any thread.
88 bool IsUnderFileCacheDirectory(const base::FilePath& path) const; 88 bool IsUnderFileCacheDirectory(const base::FilePath& path) const;
89 89
90 // Frees up disk space to store a file with |num_bytes| size content, while 90 // Frees up disk space to store a file with |num_bytes| size content, while
91 // keeping drive::internal::kMinFreeSpaceInBytes bytes on the disk, if needed. 91 // keeping drive::internal::kMinFreeSpaceInBytes bytes on the disk, if needed.
92 // Returns true if we successfully manage to have enough space, otherwise 92 // Returns true if we successfully manage to have enough space, otherwise
93 // false. 93 // false.
94 bool FreeDiskSpaceIfNeededFor(int64_t num_bytes); 94 bool FreeDiskSpaceIfNeededFor(int64_t num_bytes);
95 95
96 // Calculates and returns cache size. In error case, this returns 0.
97 int64_t CalculateCacheSize();
98
96 // Calculates and returns evictable cache size. In error case, this returns 0. 99 // Calculates and returns evictable cache size. In error case, this returns 0.
97 uint64_t CalculateEvictableCacheSize(); 100 int64_t CalculateEvictableCacheSize();
98 101
99 // Checks if file corresponding to |id| exists in cache, and returns 102 // Checks if file corresponding to |id| exists in cache, and returns
100 // FILE_ERROR_OK with |cache_file_path| storing the path to the file. 103 // FILE_ERROR_OK with |cache_file_path| storing the path to the file.
101 // |cache_file_path| must not be null. 104 // |cache_file_path| must not be null.
102 FileError GetFile(const std::string& id, base::FilePath* cache_file_path); 105 FileError GetFile(const std::string& id, base::FilePath* cache_file_path);
103 106
104 // Stores |source_path| as a cache of the remote content of the file 107 // Stores |source_path| as a cache of the remote content of the file
105 // with |id| and |md5|. 108 // with |id| and |md5|.
106 // Pass an empty string as MD5 to mark the entry as dirty. 109 // Pass an empty string as MD5 to mark the entry as dirty.
107 FileError Store(const std::string& id, 110 FileError Store(const std::string& id,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // invalidate its weak pointers before any other members are destroyed. 229 // invalidate its weak pointers before any other members are destroyed.
227 // This object should be accessed only on |blocking_task_runner_|. 230 // This object should be accessed only on |blocking_task_runner_|.
228 base::WeakPtrFactory<FileCache> weak_ptr_factory_; 231 base::WeakPtrFactory<FileCache> weak_ptr_factory_;
229 DISALLOW_COPY_AND_ASSIGN(FileCache); 232 DISALLOW_COPY_AND_ASSIGN(FileCache);
230 }; 233 };
231 234
232 } // namespace internal 235 } // namespace internal
233 } // namespace drive 236 } // namespace drive
234 237
235 #endif // COMPONENTS_DRIVE_CHROMEOS_FILE_CACHE_H_ 238 #endif // COMPONENTS_DRIVE_CHROMEOS_FILE_CACHE_H_
OLDNEW
« no previous file with comments | « components/drive/chromeos/fake_file_system.cc ('k') | components/drive/chromeos/file_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698