OLD | NEW |
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 CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 const std::string& md5, | 161 const std::string& md5, |
162 const GetCacheEntryCallback& callback); | 162 const GetCacheEntryCallback& callback); |
163 | 163 |
164 // Gets the resource IDs of pinned-but-not-fetched files and | 164 // Gets the resource IDs of pinned-but-not-fetched files and |
165 // dirty-but-not-uploaded files. | 165 // dirty-but-not-uploaded files. |
166 // | 166 // |
167 // Must be called on UI thread. |callback| is run on UI thread. | 167 // Must be called on UI thread. |callback| is run on UI thread. |
168 void GetResourceIdsOfBacklogOnUIThread( | 168 void GetResourceIdsOfBacklogOnUIThread( |
169 const GetResourceIdsOfBacklogCallback& callback); | 169 const GetResourceIdsOfBacklogCallback& callback); |
170 | 170 |
171 // Gets the resource IDs of all pinned files, including pinned dirty files. | 171 // Gets the resource IDs of all exsiting (i.e. cached locally) pinned |
| 172 // files, including pinned dirty files. |
172 // | 173 // |
173 // Must be called on UI thread. |callback| is run on UI thread. | 174 // Must be called on UI thread. |callback| is run on UI thread. |
174 void GetResourceIdsOfExistingPinnedFilesOnUIThread( | 175 void GetResourceIdsOfExistingPinnedFilesOnUIThread( |
175 const GetResourceIdsCallback& callback); | 176 const GetResourceIdsCallback& callback); |
176 | 177 |
| 178 // Gets the resource IDs of all files in the cache. |
| 179 // |
| 180 // Must be called on UI thread. |callback| is run on UI thread. |
| 181 void GetResourceIdsOfAllFilesOnUIThread( |
| 182 const GetResourceIdsCallback& callback); |
| 183 |
177 // Frees up disk space to store the given number of bytes, while keeping | 184 // Frees up disk space to store the given number of bytes, while keeping |
178 // kMinFreSpace bytes on the disk, if needed. |has_enough_space| is | 185 // kMinFreSpace bytes on the disk, if needed. |has_enough_space| is |
179 // updated to indicate if we have enough space. | 186 // updated to indicate if we have enough space. |
180 void FreeDiskSpaceIfNeededFor(int64 num_bytes, | 187 void FreeDiskSpaceIfNeededFor(int64 num_bytes, |
181 bool* has_enough_space); | 188 bool* has_enough_space); |
182 | 189 |
183 // Checks if file corresponding to |resource_id| and |md5| exists in cache. | 190 // Checks if file corresponding to |resource_id| and |md5| exists in cache. |
184 void GetFileOnUIThread(const std::string& resource_id, | 191 void GetFileOnUIThread(const std::string& resource_id, |
185 const std::string& md5, | 192 const std::string& md5, |
186 const GetFileFromCacheCallback& callback); | 193 const GetFileFromCacheCallback& callback); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 331 |
325 // Used to implement GetResourceIdsOfBacklogOnUIThread. | 332 // Used to implement GetResourceIdsOfBacklogOnUIThread. |
326 void GetResourceIdsOfBacklog( | 333 void GetResourceIdsOfBacklog( |
327 std::vector<std::string>* to_fetch, | 334 std::vector<std::string>* to_fetch, |
328 std::vector<std::string>* to_upload); | 335 std::vector<std::string>* to_upload); |
329 | 336 |
330 // Used to implement GetResourceIdsOfExistingPinnedFilesOnUIThread. | 337 // Used to implement GetResourceIdsOfExistingPinnedFilesOnUIThread. |
331 void GetResourceIdsOfExistingPinnedFiles( | 338 void GetResourceIdsOfExistingPinnedFiles( |
332 std::vector<std::string>* resource_ids); | 339 std::vector<std::string>* resource_ids); |
333 | 340 |
| 341 // Used to implement GetResourceIdsOfAllFilesOnUIThread. |
| 342 void GetResourceIdsOfAllFiles( |
| 343 std::vector<std::string>* resource_ids); |
| 344 |
334 // Used to implement GetFileOnUIThread. | 345 // Used to implement GetFileOnUIThread. |
335 void GetFile(const std::string& resource_id, | 346 void GetFile(const std::string& resource_id, |
336 const std::string& md5, | 347 const std::string& md5, |
337 GDataFileError* error, | 348 GDataFileError* error, |
338 FilePath* cache_file_path); | 349 FilePath* cache_file_path); |
339 | 350 |
340 // Used to implement StoreOnUIThread. | 351 // Used to implement StoreOnUIThread. |
341 void Store(const std::string& resource_id, | 352 void Store(const std::string& resource_id, |
342 const std::string& md5, | 353 const std::string& md5, |
343 const FilePath& source_path, | 354 const FilePath& source_path, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 }; | 457 }; |
447 | 458 |
448 // Sets the free disk space getter for testing. | 459 // Sets the free disk space getter for testing. |
449 // The existing getter is deleted. | 460 // The existing getter is deleted. |
450 void SetFreeDiskSpaceGetterForTesting( | 461 void SetFreeDiskSpaceGetterForTesting( |
451 FreeDiskSpaceGetterInterface* getter); | 462 FreeDiskSpaceGetterInterface* getter); |
452 | 463 |
453 } // namespace gdata | 464 } // namespace gdata |
454 | 465 |
455 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 466 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
OLD | NEW |