Commit b4de3da3 authored by satorux@chromium.org's avatar satorux@chromium.org

gdata: Remove GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal()

In favor of less indirection.
Along the way, remove an unsed parameter gdata_file_path from some places.

BUG=chromium-os:29813
TEST=compiles

Review URL: https://chromiumcodereview.appspot.com/10182012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133544 0039d316-1c4b-4281-b951-d872f2087c98
parent a93d6557
...@@ -499,13 +499,12 @@ void RunGetFileFromCacheCallbackHelper( ...@@ -499,13 +499,12 @@ void RunGetFileFromCacheCallbackHelper(
base::PlatformFileError* error, base::PlatformFileError* error,
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
FilePath* cache_file_path) { FilePath* cache_file_path) {
DCHECK(error); DCHECK(error);
DCHECK(cache_file_path); DCHECK(cache_file_path);
if (!callback.is_null()) if (!callback.is_null())
callback.Run(*error, resource_id, md5, gdata_file_path, *cache_file_path); callback.Run(*error, resource_id, md5, *cache_file_path);
} }
void RunGetCacheStateCallbackHelper( void RunGetCacheStateCallbackHelper(
...@@ -1761,7 +1760,6 @@ void GDataFileSystem::OnGetFileFromCache(const GetFileFromCacheParams& params, ...@@ -1761,7 +1760,6 @@ void GDataFileSystem::OnGetFileFromCache(const GetFileFromCacheParams& params,
base::PlatformFileError error, base::PlatformFileError error,
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
const FilePath& cache_file_path) { const FilePath& cache_file_path) {
// Have we found the file in cache? If so, return it back to the caller. // Have we found the file in cache? If so, return it back to the caller.
if (error == base::PLATFORM_FILE_OK) { if (error == base::PLATFORM_FILE_OK) {
...@@ -3227,14 +3225,6 @@ FilePath GDataFileSystem::GetCacheFilePath( ...@@ -3227,14 +3225,6 @@ FilePath GDataFileSystem::GetCacheFilePath(
return cache_paths_[sub_dir_type].Append(base_name); return cache_paths_[sub_dir_type].Append(base_name);
} }
void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5(
const std::string& resource_id,
const std::string& md5,
const GetFileFromCacheCallback& callback) {
GetFileFromCacheByResourceIdAndMd5Internal(
resource_id, md5, FilePath(), callback);
}
void GDataFileSystem::StoreToCache(const std::string& resource_id, void GDataFileSystem::StoreToCache(const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& source_path, const FilePath& source_path,
...@@ -3333,7 +3323,6 @@ void GDataFileSystem::MarkDirtyInCache( ...@@ -3333,7 +3323,6 @@ void GDataFileSystem::MarkDirtyInCache(
base::Owned(error), base::Owned(error),
resource_id, resource_id,
md5, md5,
FilePath() /* gdata_file_path */,
base::Owned(cache_file_path))); base::Owned(cache_file_path)));
} }
...@@ -3453,7 +3442,6 @@ void GDataFileSystem::InitializeCacheOnIOThreadPool() { ...@@ -3453,7 +3442,6 @@ void GDataFileSystem::InitializeCacheOnIOThreadPool() {
void GDataFileSystem::GetFileFromCacheOnIOThreadPool( void GDataFileSystem::GetFileFromCacheOnIOThreadPool(
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
base::PlatformFileError* error, base::PlatformFileError* error,
FilePath* cache_file_path) { FilePath* cache_file_path) {
DCHECK(error); DCHECK(error);
...@@ -4231,10 +4219,9 @@ void GDataFileSystem::ScanCacheDirectory( ...@@ -4231,10 +4219,9 @@ void GDataFileSystem::ScanCacheDirectory(
} }
} }
void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal( void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5(
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
const GetFileFromCacheCallback& callback) { const GetFileFromCacheCallback& callback) {
InitializeCacheIfNecessary(); InitializeCacheIfNecessary();
...@@ -4248,7 +4235,6 @@ void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal( ...@@ -4248,7 +4235,6 @@ void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal(
base::Unretained(this), base::Unretained(this),
resource_id, resource_id,
md5, md5,
gdata_file_path,
error, error,
cache_file_path), cache_file_path),
base::Bind(&RunGetFileFromCacheCallbackHelper, base::Bind(&RunGetFileFromCacheCallbackHelper,
...@@ -4256,7 +4242,6 @@ void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal( ...@@ -4256,7 +4242,6 @@ void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal(
base::Owned(error), base::Owned(error),
resource_id, resource_id,
md5, md5,
gdata_file_path,
base::Owned(cache_file_path))); base::Owned(cache_file_path)));
} }
......
...@@ -56,7 +56,6 @@ typedef base::Callback<void(base::PlatformFileError error, ...@@ -56,7 +56,6 @@ typedef base::Callback<void(base::PlatformFileError error,
typedef base::Callback<void(base::PlatformFileError error, typedef base::Callback<void(base::PlatformFileError error,
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
const FilePath& cache_file_path)> const FilePath& cache_file_path)>
GetFileFromCacheCallback; GetFileFromCacheCallback;
...@@ -1109,7 +1108,6 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -1109,7 +1108,6 @@ class GDataFileSystem : public GDataFileSystemInterface,
void GetFileFromCacheOnIOThreadPool( void GetFileFromCacheOnIOThreadPool(
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
base::PlatformFileError* error, base::PlatformFileError* error,
FilePath* cache_file_path); FilePath* cache_file_path);
...@@ -1215,12 +1213,11 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -1215,12 +1213,11 @@ class GDataFileSystem : public GDataFileSystemInterface,
// Helper function for internally handling responses from // Helper function for internally handling responses from
// GetFileFromCacheByResourceIdAndMd5() calls during processing of // GetFileFromCacheByResourceIdAndMd5() calls during processing of
// GetFile() request. // GetFileByPath() request.
void OnGetFileFromCache(const GetFileFromCacheParams& params, void OnGetFileFromCache(const GetFileFromCacheParams& params,
base::PlatformFileError error, base::PlatformFileError error,
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
const FilePath& cache_file_path); const FilePath& cache_file_path);
// Frees up disk space to store the given number of bytes, while keeping // Frees up disk space to store the given number of bytes, while keeping
...@@ -1250,14 +1247,6 @@ class GDataFileSystem : public GDataFileSystemInterface, ...@@ -1250,14 +1247,6 @@ class GDataFileSystem : public GDataFileSystemInterface,
GDataRootDirectory::CacheSubDirectoryType sub_dir_type, GDataRootDirectory::CacheSubDirectoryType sub_dir_type,
GDataRootDirectory::CacheMap* cache_map); GDataRootDirectory::CacheMap* cache_map);
// Called from GetFileFromCacheByResourceIdAndMd5() and
// GetFileFromCacheByPath().
void GetFileFromCacheByResourceIdAndMd5Internal(
const std::string& resource_id,
const std::string& md5,
const FilePath& gdata_file_path,
const GetFileFromCacheCallback& callback);
// Wrapper task around any sequenced task that runs on IO thread pool that // Wrapper task around any sequenced task that runs on IO thread pool that
// makes sure |in_shutdown_| and |on_io_completed_| are handled properly in // makes sure |in_shutdown_| and |on_io_completed_| are handled properly in
// the right order. // the right order.
......
...@@ -367,7 +367,6 @@ class GDataFileSystemTest : public testing::Test { ...@@ -367,7 +367,6 @@ class GDataFileSystemTest : public testing::Test {
void VerifyGetFromCache(base::PlatformFileError error, void VerifyGetFromCache(base::PlatformFileError error,
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
const FilePath& cache_file_path) { const FilePath& cache_file_path) {
++num_callback_invocations_; ++num_callback_invocations_;
...@@ -575,7 +574,6 @@ class GDataFileSystemTest : public testing::Test { ...@@ -575,7 +574,6 @@ class GDataFileSystemTest : public testing::Test {
void VerifyMarkDirty(base::PlatformFileError error, void VerifyMarkDirty(base::PlatformFileError error,
const std::string& resource_id, const std::string& resource_id,
const std::string& md5, const std::string& md5,
const FilePath& gdata_file_path,
const FilePath& cache_file_path) { const FilePath& cache_file_path) {
VerifyCacheFileState(error, resource_id, md5); VerifyCacheFileState(error, resource_id, md5);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment