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

Unified Diff: chrome/browser/chromeos/drive/file_cache.h

Issue 15681009: Extract GetResolveFile into DownloadOperation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_cache.h
diff --git a/chrome/browser/chromeos/drive/file_cache.h b/chrome/browser/chromeos/drive/file_cache.h
index fb33aae237b6d9756841b773656c3213431451cd..bef7635c9ef455c2c266caaa94b7947b93fa4bcd 100644
--- a/chrome/browser/chromeos/drive/file_cache.h
+++ b/chrome/browser/chromeos/drive/file_cache.h
@@ -148,21 +148,37 @@ class FileCache {
// TODO(hashimoto): Stop using callbacks for this method. crbug.com/242818
void Iterate(const CacheIterateCallback& iteration_callback);
- // Frees up disk space to store the given number of bytes, while keeping
- // kMinFreeSpace bytes on the disk, if needed.
- // Runs |callback| with true when we successfully manage to have enough space.
+
+ // Runs FreeDiskSpaceIfNeededFor() on |blocking_task_runner_|, and calls
+ // |callback| with the result asynchronously.
+ // |callback| must not be null.
// Must be called on the UI thread.
void FreeDiskSpaceIfNeededForOnUIThread(
int64 num_bytes,
const InitializeCacheCallback& callback);
- // Checks if file corresponding to |resource_id| and |md5| exists in cache.
+ // Frees up disk space to store a file with |num_bytes| size content, while
+ // keeping kMinFreeSpace bytes on the disk, if needed.
+ // Returns true if we successfully manage to have enough space, otherwise
+ // false.
+ bool FreeDiskSpaceIfNeededFor(int64 num_bytes);
+
+ // Runs GetFile() on |blocking_task_runner_|, and calls |callback| with
+ // the result asynchronously.
// |callback| must not be null.
// Must be called on the UI thread.
void GetFileOnUIThread(const std::string& resource_id,
const std::string& md5,
const GetFileFromCacheCallback& callback);
+ // Checks if file corresponding to |resource_id| and |md5| exists in cache,
+ // and returns FILE_ERROR_OK with |cache_file_path| storing the path to
+ // the file.
+ // |cache_file_path| must not be null.
+ FileError GetFile(const std::string& resource_id,
+ const std::string& md5,
+ base::FilePath* cache_file_path);
+
// Runs Store() on |blocking_task_runner_|, and calls |callback| with
// the result asynchronously.
// |callback| must not be null.
@@ -201,15 +217,19 @@ class FileCache {
const std::string& md5,
const FileOperationCallback& callback);
- // Modifies cache state, which involves the following:
- // - moves |source_path| to |dest_path| in tmp dir if file is not dirty
- // - deletes symlink from pinned dir
+ // Runs Unpin() on |blocking_task_runner_|, and calls |callback| with the
+ // result asynchronously.
// |callback| must not be null.
// Must be called on the UI thread.
void UnpinOnUIThread(const std::string& resource_id,
const std::string& md5,
const FileOperationCallback& callback);
+ // Modifies cache state, which involves the following:
+ // - moves the local file from pinned directory to unpinned directory.
+ // - update cache metadata.
+ FileError Unpin(const std::string& resource_id, const std::string& md5);
+
// Sets the state of the cache entry corresponding to |resource_id| and |md5|
// as mounted.
// |callback| must not be null.
@@ -336,14 +356,6 @@ class FileCache {
// Destroys the cache on the blocking pool.
void DestroyOnBlockingPool();
- // Used to implement FreeDiskSpaceIfNeededForOnUIThread().
- bool FreeDiskSpaceIfNeededFor(int64 num_bytes);
-
- // Used to implement GetFileOnUIThread.
- FileError GetFile(const std::string& resource_id,
- const std::string& md5,
- base::FilePath* cache_file_path);
-
// Used to implement Store and StoreLocallyModifiedOnUIThread.
// TODO(hidehiko): Merge this method with Store(), after
// StoreLocallyModifiedOnUIThread is removed.
@@ -357,10 +369,6 @@ class FileCache {
FileError Pin(const std::string& resource_id,
const std::string& md5);
- // Used to implement UnpinOnUIThread.
- FileError Unpin(const std::string& resource_id,
- const std::string& md5);
-
// Used to implement MarkAsMountedOnUIThread.
FileError MarkAsMounted(const std::string& resource_id,
const std::string& md5,
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/file_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698