diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 06:57:10 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-14 06:57:10 +0000 |
commit | 86b74ce5087602c51cc2dd8ac45451b49d894f2b (patch) | |
tree | dafc222796f2149deaf50332bba941f476154620 /webkit/browser | |
parent | 7d8af07670ad54900b0ba030e59fc5d50efc5e3a (diff) | |
download | chromium_src-86b74ce5087602c51cc2dd8ac45451b49d894f2b.zip chromium_src-86b74ce5087602c51cc2dd8ac45451b49d894f2b.tar.gz chromium_src-86b74ce5087602c51cc2dd8ac45451b49d894f2b.tar.bz2 |
fileapi: Remove platform_path parameter from FileSystemOperation::GetMetadataCallback
This parameter is no longer used. When the platform file path
is needed, CreateSnapshotFile() should be used instead of GetMetadata().
BUG=248480
TEST=none
R=kinuko@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/16729003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser')
17 files changed, 70 insertions, 58 deletions
diff --git a/webkit/browser/chromeos/fileapi/remote_file_system_operation.cc b/webkit/browser/chromeos/fileapi/remote_file_system_operation.cc index 5a5e6eb..c50f3ad 100644 --- a/webkit/browser/chromeos/fileapi/remote_file_system_operation.cc +++ b/webkit/browser/chromeos/fileapi/remote_file_system_operation.cc @@ -188,8 +188,7 @@ bool RemoteFileSystemOperation::SetPendingOperationType(OperationType type) { void RemoteFileSystemOperation::DidDirectoryExists( const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused) { + const base::PlatformFileInfo& file_info) { if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory) rv = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; callback.Run(rv); @@ -198,8 +197,7 @@ void RemoteFileSystemOperation::DidDirectoryExists( void RemoteFileSystemOperation::DidFileExists( const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused) { + const base::PlatformFileInfo& file_info) { if (rv == base::PLATFORM_FILE_OK && file_info.is_directory) rv = base::PLATFORM_FILE_ERROR_NOT_A_FILE; callback.Run(rv); diff --git a/webkit/browser/chromeos/fileapi/remote_file_system_operation.h b/webkit/browser/chromeos/fileapi/remote_file_system_operation.h index 629380b..2c6ad3b 100644 --- a/webkit/browser/chromeos/fileapi/remote_file_system_operation.h +++ b/webkit/browser/chromeos/fileapi/remote_file_system_operation.h @@ -88,12 +88,10 @@ class RemoteFileSystemOperation // Generic callback that translates platform errors to WebKit error codes. void DidDirectoryExists(const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused); + const base::PlatformFileInfo& file_info); void DidFileExists(const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused); + const base::PlatformFileInfo& file_info); void DidWrite(const WriteCallback& write_callback, base::PlatformFileError result, int64 bytes, diff --git a/webkit/browser/fileapi/async_file_test_helper.cc b/webkit/browser/fileapi/async_file_test_helper.cc index 72d0b4d..d60a68e 100644 --- a/webkit/browser/fileapi/async_file_test_helper.cc +++ b/webkit/browser/fileapi/async_file_test_helper.cc @@ -35,13 +35,24 @@ AssignAndQuitCallback(base::RunLoop* run_loop, void GetMetadataCallback(base::RunLoop* run_loop, base::PlatformFileError* result_out, base::PlatformFileInfo* file_info_out, - base::FilePath* platform_path_out, base::PlatformFileError result, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path) { + const base::PlatformFileInfo& file_info) { *result_out = result; if (file_info_out) *file_info_out = file_info; + run_loop->Quit(); +} + +void CreateSnapshotFileCallback( + base::RunLoop* run_loop, + base::PlatformFileError* result_out, + base::FilePath* platform_path_out, + base::PlatformFileError result, + const base::PlatformFileInfo& file_info, + const base::FilePath& platform_path, + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { + DCHECK(!file_ref); + *result_out = result; if (platform_path_out) *platform_path_out = platform_path; run_loop->Quit(); @@ -168,13 +179,25 @@ base::PlatformFileError AsyncFileTestHelper::TruncateFile( base::PlatformFileError AsyncFileTestHelper::GetMetadata( FileSystemContext* context, const FileSystemURL& url, - base::PlatformFileInfo* file_info, - base::FilePath* platform_path) { + base::PlatformFileInfo* file_info) { base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED; base::RunLoop run_loop; context->operation_runner()->GetMetadata( url, base::Bind(&GetMetadataCallback, &run_loop, &result, - file_info, platform_path)); + file_info)); + run_loop.Run(); + return result; +} + +base::PlatformFileError AsyncFileTestHelper::GetPlatformPath( + FileSystemContext* context, + const FileSystemURL& url, + base::FilePath* platform_path) { + base::PlatformFileError result = base::PLATFORM_FILE_ERROR_FAILED; + base::RunLoop run_loop; + context->operation_runner()->CreateSnapshotFile( + url, base::Bind(&CreateSnapshotFileCallback, &run_loop, &result, + platform_path)); run_loop.Run(); return result; } @@ -184,7 +207,7 @@ bool AsyncFileTestHelper::FileExists( const FileSystemURL& url, int64 expected_size) { base::PlatformFileInfo file_info; - base::PlatformFileError result = GetMetadata(context, url, &file_info, NULL); + base::PlatformFileError result = GetMetadata(context, url, &file_info); if (result != base::PLATFORM_FILE_OK || file_info.is_directory) return false; return expected_size == kDontCheckSize || file_info.size == expected_size; @@ -194,7 +217,7 @@ bool AsyncFileTestHelper::DirectoryExists( FileSystemContext* context, const FileSystemURL& url) { base::PlatformFileInfo file_info; - base::PlatformFileError result = GetMetadata(context, url, &file_info, NULL); + base::PlatformFileError result = GetMetadata(context, url, &file_info); return (result == base::PLATFORM_FILE_OK) && file_info.is_directory; } diff --git a/webkit/browser/fileapi/async_file_test_helper.h b/webkit/browser/fileapi/async_file_test_helper.h index 062634d..cfa7981 100644 --- a/webkit/browser/fileapi/async_file_test_helper.h +++ b/webkit/browser/fileapi/async_file_test_helper.h @@ -62,8 +62,12 @@ class AsyncFileTestHelper { // Retrieves PlatformFileInfo for |url| and populates |file_info|. static base::PlatformFileError GetMetadata(FileSystemContext* context, const FileSystemURL& url, - base::PlatformFileInfo* file_info, - base::FilePath* platform_path); + base::PlatformFileInfo* file_info); + + // Retrieves FilePath for |url| and populates |platform_path|. + static base::PlatformFileError GetPlatformPath(FileSystemContext* context, + const FileSystemURL& url, + base::FilePath* platform_path); // Returns true if a file exists at |url| with |size|. If |size| is // kDontCheckSize it doesn't check the file size (but just check its diff --git a/webkit/browser/fileapi/async_file_util.h b/webkit/browser/fileapi/async_file_util.h index 97b6590..922bbfc 100644 --- a/webkit/browser/fileapi/async_file_util.h +++ b/webkit/browser/fileapi/async_file_util.h @@ -51,8 +51,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT AsyncFileUtil { typedef base::Callback< void(base::PlatformFileError result, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path)> GetFileInfoCallback; + const base::PlatformFileInfo& file_info)> GetFileInfoCallback; typedef std::vector<DirectoryEntry> EntryList; typedef base::Callback< diff --git a/webkit/browser/fileapi/async_file_util_adapter.cc b/webkit/browser/fileapi/async_file_util_adapter.cc index 1664a0b..7dd9a95 100644 --- a/webkit/browser/fileapi/async_file_util_adapter.cc +++ b/webkit/browser/fileapi/async_file_util_adapter.cc @@ -66,7 +66,7 @@ class GetFileInfoHelper { void ReplyFileInfo(const AsyncFileUtil::GetFileInfoCallback& callback) { if (!callback.is_null()) - callback.Run(error_, file_info_, platform_path_); + callback.Run(error_, file_info_); } void ReplySnapshotFile( diff --git a/webkit/browser/fileapi/file_system_operation.h b/webkit/browser/fileapi/file_system_operation.h index ff6b7b3..b4e887c 100644 --- a/webkit/browser/fileapi/file_system_operation.h +++ b/webkit/browser/fileapi/file_system_operation.h @@ -62,12 +62,10 @@ class FileSystemOperation { typedef base::Callback<void(base::PlatformFileError result)> StatusCallback; // Used for GetMetadata(). |result| is the return code of the operation, - // |file_info| is the obtained file info, and |platform_path| is the path - // of the file. + // |file_info| is the obtained file info. typedef base::Callback< void(base::PlatformFileError result, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path)> GetMetadataCallback; + const base::PlatformFileInfo& file_info)> GetMetadataCallback; // Used for OpenFile(). |result| is the return code of the operation. // |on_close_callback| will be called after the file is closed in the child diff --git a/webkit/browser/fileapi/file_system_operation_runner.cc b/webkit/browser/fileapi/file_system_operation_runner.cc index 6d1f67a..13da4fe 100644 --- a/webkit/browser/fileapi/file_system_operation_runner.cc +++ b/webkit/browser/fileapi/file_system_operation_runner.cc @@ -154,7 +154,7 @@ OperationID FileSystemOperationRunner::GetMetadata( FileSystemOperation* operation = file_system_context_->CreateFileSystemOperation(url, &error); if (!operation) { - callback.Run(error, base::PlatformFileInfo(), base::FilePath()); + callback.Run(error, base::PlatformFileInfo()); return kErrorOperationID; } OperationID id = operations_.Add(operation); @@ -463,9 +463,8 @@ void FileSystemOperationRunner::DidGetMetadata( OperationID id, const GetMetadataCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path) { - callback.Run(rv, file_info, platform_path); + const base::PlatformFileInfo& file_info) { + callback.Run(rv, file_info); FinishOperation(id); } diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h index 49c10fa..2c5389b 100644 --- a/webkit/browser/fileapi/file_system_operation_runner.h +++ b/webkit/browser/fileapi/file_system_operation_runner.h @@ -237,8 +237,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner void DidGetMetadata(OperationID id, const GetMetadataCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path); + const base::PlatformFileInfo& file_info); void DidReadDirectory(OperationID id, const ReadDirectoryCallback& callback, base::PlatformFileError rv, diff --git a/webkit/browser/fileapi/file_system_url_request_job.cc b/webkit/browser/fileapi/file_system_url_request_job.cc index 34f8661..e8bc42c 100644 --- a/webkit/browser/fileapi/file_system_url_request_job.cc +++ b/webkit/browser/fileapi/file_system_url_request_job.cc @@ -165,8 +165,7 @@ void FileSystemURLRequestJob::StartAsync() { void FileSystemURLRequestJob::DidGetMetadata( base::PlatformFileError error_code, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path) { + const base::PlatformFileInfo& file_info) { if (error_code != base::PLATFORM_FILE_OK) { NotifyFailed(error_code == base::PLATFORM_FILE_ERROR_INVALID_URL ? net::ERR_INVALID_URL : net::ERR_FILE_NOT_FOUND); diff --git a/webkit/browser/fileapi/file_system_url_request_job.h b/webkit/browser/fileapi/file_system_url_request_job.h index 1be5833..6b829e6 100644 --- a/webkit/browser/fileapi/file_system_url_request_job.h +++ b/webkit/browser/fileapi/file_system_url_request_job.h @@ -62,8 +62,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemURLRequestJob void StartAsync(); void DidGetMetadata( base::PlatformFileError error_code, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path); + const base::PlatformFileInfo& file_info); void DidRead(int result); void NotifyFailed(int rv); diff --git a/webkit/browser/fileapi/isolated_file_util_unittest.cc b/webkit/browser/fileapi/isolated_file_util_unittest.cc index 26fd11c..1f2eacb 100644 --- a/webkit/browser/fileapi/isolated_file_util_unittest.cc +++ b/webkit/browser/fileapi/isolated_file_util_unittest.cc @@ -159,19 +159,25 @@ class IsolatedFileUtilTest : public testing::Test { void VerifyFilesHaveSameContent(const FileSystemURL& url1, const FileSystemURL& url2) { - // Get the file info for url1. + // Get the file info and the platform path for url1. base::PlatformFileInfo info1; - base::FilePath platform_path1; ASSERT_EQ(base::PLATFORM_FILE_OK, AsyncFileTestHelper::GetMetadata( - file_system_context(), url1, &info1, &platform_path1)); + file_system_context(), url1, &info1)); + base::FilePath platform_path1; + ASSERT_EQ(base::PLATFORM_FILE_OK, + AsyncFileTestHelper::GetPlatformPath( + file_system_context(), url1, &platform_path1)); - // Get the file info for url2. + // Get the file info and the platform path for url2. base::PlatformFileInfo info2; - base::FilePath platform_path2; ASSERT_EQ(base::PLATFORM_FILE_OK, AsyncFileTestHelper::GetMetadata( - file_system_context(), url2, &info2, &platform_path2)); + file_system_context(), url2, &info2)); + base::FilePath platform_path2; + ASSERT_EQ(base::PLATFORM_FILE_OK, + AsyncFileTestHelper::GetPlatformPath( + file_system_context(), url2, &platform_path2)); // See if file info matches with the other one. EXPECT_EQ(info1.is_directory, info2.is_directory); diff --git a/webkit/browser/fileapi/local_file_system_operation.cc b/webkit/browser/fileapi/local_file_system_operation.cc index 23653b4..4d5aec4 100644 --- a/webkit/browser/fileapi/local_file_system_operation.cc +++ b/webkit/browser/fileapi/local_file_system_operation.cc @@ -461,8 +461,7 @@ void LocalFileSystemOperation::DidFinishOperation( void LocalFileSystemOperation::DidDirectoryExists( const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused) { + const base::PlatformFileInfo& file_info) { if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory) rv = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; callback.Run(rv); @@ -471,8 +470,7 @@ void LocalFileSystemOperation::DidDirectoryExists( void LocalFileSystemOperation::DidFileExists( const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused) { + const base::PlatformFileInfo& file_info) { if (rv == base::PLATFORM_FILE_OK && file_info.is_directory) rv = base::PLATFORM_FILE_ERROR_NOT_A_FILE; callback.Run(rv); diff --git a/webkit/browser/fileapi/local_file_system_operation.h b/webkit/browser/fileapi/local_file_system_operation.h index eb88551..1a73d39 100644 --- a/webkit/browser/fileapi/local_file_system_operation.h +++ b/webkit/browser/fileapi/local_file_system_operation.h @@ -214,12 +214,10 @@ class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileSystemOperation base::PlatformFileError rv); void DidDirectoryExists(const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused); + const base::PlatformFileInfo& file_info); void DidFileExists(const StatusCallback& callback, base::PlatformFileError rv, - const base::PlatformFileInfo& file_info, - const base::FilePath& unused); + const base::PlatformFileInfo& file_info); void DidWrite(const FileSystemURL& url, const WriteCallback& callback, base::PlatformFileError rv, diff --git a/webkit/browser/fileapi/local_file_system_operation_unittest.cc b/webkit/browser/fileapi/local_file_system_operation_unittest.cc index 333e5a9..e867ba9 100644 --- a/webkit/browser/fileapi/local_file_system_operation_unittest.cc +++ b/webkit/browser/fileapi/local_file_system_operation_unittest.cc @@ -200,10 +200,8 @@ class LocalFileSystemOperationTest } void DidGetMetadata(base::PlatformFileError status, - const base::PlatformFileInfo& info, - const base::FilePath& platform_path) { + const base::PlatformFileInfo& info) { info_ = info; - path_ = platform_path; status_ = status; } @@ -797,7 +795,6 @@ TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataSuccess) { base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_OK, status()); EXPECT_TRUE(info().is_directory); - EXPECT_EQ(base::FilePath(), path()); ++read_access; operation_runner()->FileExists(file, RecordStatusCallback()); @@ -809,7 +806,6 @@ TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataSuccess) { base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_OK, status()); EXPECT_FALSE(info().is_directory); - EXPECT_EQ(PlatformPath("dir/file"), path()); ++read_access; EXPECT_EQ(read_access, diff --git a/webkit/browser/fileapi/syncable/local_file_sync_context.cc b/webkit/browser/fileapi/syncable/local_file_sync_context.cc index 56fe032..764eb42 100644 --- a/webkit/browser/fileapi/syncable/local_file_sync_context.cc +++ b/webkit/browser/fileapi/syncable/local_file_sync_context.cc @@ -702,8 +702,7 @@ void LocalFileSyncContext::DidApplyRemoteChange( void LocalFileSyncContext::DidGetFileMetadata( const SyncFileMetadataCallback& callback, base::PlatformFileError file_error, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path) { + const base::PlatformFileInfo& file_info) { DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); SyncFileMetadata metadata; if (file_error == base::PLATFORM_FILE_OK) { diff --git a/webkit/browser/fileapi/syncable/local_file_sync_context.h b/webkit/browser/fileapi/syncable/local_file_sync_context.h index 3bb616d..c69287d 100644 --- a/webkit/browser/fileapi/syncable/local_file_sync_context.h +++ b/webkit/browser/fileapi/syncable/local_file_sync_context.h @@ -247,8 +247,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileSyncContext void DidGetFileMetadata( const SyncFileMetadataCallback& callback, base::PlatformFileError file_error, - const base::PlatformFileInfo& file_info, - const base::FilePath& platform_path); + const base::PlatformFileInfo& file_info); base::TimeDelta NotifyChangesDuration(); |