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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 const std::string& md5, | 256 const std::string& md5, |
257 const CacheOperationCallback& callback); | 257 const CacheOperationCallback& callback); |
258 | 258 |
259 // Does the following: | 259 // Does the following: |
260 // - remove all delete stale cache versions corresponding to |resource_id| in | 260 // - remove all delete stale cache versions corresponding to |resource_id| in |
261 // persistent, tmp and pinned directories | 261 // persistent, tmp and pinned directories |
262 // - remove entry corresponding to |resource_id| from cache map. | 262 // - remove entry corresponding to |resource_id| from cache map. |
263 void RemoveOnUIThread(const std::string& resource_id, | 263 void RemoveOnUIThread(const std::string& resource_id, |
264 const CacheOperationCallback& callback); | 264 const CacheOperationCallback& callback); |
265 | 265 |
266 // Does the following: | |
267 // - remove all the files in the cache directory. | |
268 // - re-create the |metadata_| instance. | |
269 void ClearAllOnUIThread(const SetMountedStateCallback& callback); | |
satorux1
2012/08/01 20:50:31
The callback type name looks awkward for this func
yoshiki
2012/08/01 21:44:59
Done.
| |
270 | |
266 // Utility method to call Initialize on UI thread. | 271 // Utility method to call Initialize on UI thread. |
267 void RequestInitializeOnUIThread(); | 272 void RequestInitializeOnUIThread(); |
268 | 273 |
269 // Force a rescan of cache files, for testing. | 274 // Force a rescan of cache files, for testing. |
270 void ForceRescanOnUIThreadForTesting(); | 275 void ForceRescanOnUIThreadForTesting(); |
271 | 276 |
272 // Gets the cache entry for file corresponding to |resource_id| and |md5| | 277 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
273 // and returns true if entry exists in cache map. Otherwise, returns false. | 278 // and returns true if entry exists in cache map. Otherwise, returns false. |
274 // |md5| can be empty if only matching |resource_id| is desired, which may | 279 // |md5| can be empty if only matching |resource_id| is desired, which may |
275 // happen when looking for pinned entries where symlinks' filenames have no | 280 // happen when looking for pinned entries where symlinks' filenames have no |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 // Used to implement ClearDirtyOnUIThread. | 394 // Used to implement ClearDirtyOnUIThread. |
390 void ClearDirty(const std::string& resource_id, | 395 void ClearDirty(const std::string& resource_id, |
391 const std::string& md5, | 396 const std::string& md5, |
392 FileOperationType file_operation_type, | 397 FileOperationType file_operation_type, |
393 GDataFileError* error); | 398 GDataFileError* error); |
394 | 399 |
395 // Used to implement RemoveOnUIThread. | 400 // Used to implement RemoveOnUIThread. |
396 void Remove(const std::string& resource_id, | 401 void Remove(const std::string& resource_id, |
397 GDataFileError* error); | 402 GDataFileError* error); |
398 | 403 |
404 // Used to implement ClearAllUIThread. | |
405 void ClearAll(GDataFileError* error); | |
406 | |
399 // Runs callback and notifies the observers when file is pinned. | 407 // Runs callback and notifies the observers when file is pinned. |
400 void OnPinned(GDataFileError* error, | 408 void OnPinned(GDataFileError* error, |
401 const std::string& resource_id, | 409 const std::string& resource_id, |
402 const std::string& md5, | 410 const std::string& md5, |
403 const CacheOperationCallback& callback); | 411 const CacheOperationCallback& callback); |
404 | 412 |
405 // Runs callback and notifies the observers when file is unpinned. | 413 // Runs callback and notifies the observers when file is unpinned. |
406 void OnUnpinned(GDataFileError* error, | 414 void OnUnpinned(GDataFileError* error, |
407 const std::string& resource_id, | 415 const std::string& resource_id, |
408 const std::string& md5, | 416 const std::string& md5, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 }; | 465 }; |
458 | 466 |
459 // Sets the free disk space getter for testing. | 467 // Sets the free disk space getter for testing. |
460 // The existing getter is deleted. | 468 // The existing getter is deleted. |
461 void SetFreeDiskSpaceGetterForTesting( | 469 void SetFreeDiskSpaceGetterForTesting( |
462 FreeDiskSpaceGetterInterface* getter); | 470 FreeDiskSpaceGetterInterface* getter); |
463 | 471 |
464 } // namespace gdata | 472 } // namespace gdata |
465 | 473 |
466 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 474 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
OLD | NEW |