drive: Move temporary file removal responsiblity to FileCache
FileCache is responsible for all file operations, FileCacheMetadata should focus on metadata business.
Remove FileCacheMetadata::RemoveTemporaryFiles()
Rewrite FileCache::FreeDiskSpaceIfNeededFor with iterator.
Add test for FileCache::FreeDiskSpaceIfNeededFor().
Make FileCache::Pin() public.
BUG=234487
TEST=unit_tests
[email protected]
Review URL: https://codereview.chromium.org/15690021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204455 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/drive/file_cache.h b/chrome/browser/chromeos/drive/file_cache.h
index 4634d87..bb3f9118 100644
--- a/chrome/browser/chromeos/drive/file_cache.h
+++ b/chrome/browser/chromeos/drive/file_cache.h
@@ -208,13 +208,18 @@
FileOperationType file_operation_type,
const FileOperationCallback& callback);
- // Pins the specified entry.
+ // Runs Pin() on |blocking_task_runner_|, and calls |callback| with the result
+ // asynchronously.
// |callback| must not be null.
// Must be called on the UI thread.
void PinOnUIThread(const std::string& resource_id,
const std::string& md5,
const FileOperationCallback& callback);
+ // Pins the specified entry.
+ FileError Pin(const std::string& resource_id,
+ const std::string& md5);
+
// Runs Unpin() on |blocking_task_runner_|, and calls |callback| with the
// result asynchronously.
// |callback| must not be null.
@@ -303,6 +308,7 @@
private:
friend class FileCacheTest;
+ friend class FileCacheTestOnUIThread;
// Enum defining origin of a cached file.
enum CachedFileOrigin {
@@ -341,10 +347,6 @@
FileOperationType file_operation_type,
CachedFileOrigin origin);
- // Used to implement PinOnUIThread.
- FileError Pin(const std::string& resource_id,
- const std::string& md5);
-
// Used to implement MarkAsMountedOnUIThread.
FileError MarkAsMounted(const std::string& resource_id,
const std::string& md5,