diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-28 02:18:57 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-28 02:18:57 +0000 |
commit | 1a4ed8891fed6746fdb948e31056c46e7195fa49 (patch) | |
tree | 47b3cadad0201c3a97153dea76bedb64b86c1294 /webkit | |
parent | 00f70c98d67c5fe78ec6366cf1d450ebe778fd17 (diff) | |
download | chromium_src-1a4ed8891fed6746fdb948e31056c46e7195fa49.zip chromium_src-1a4ed8891fed6746fdb948e31056c46e7195fa49.tar.gz chromium_src-1a4ed8891fed6746fdb948e31056c46e7195fa49.tar.bz2 |
Revert 123864 - Adding CreateSnapshotFile interface to FileSystemOperationInterface
To allow each filesystem implementation to prepare a local snapshot file
for File object.
BUG=115603
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9462005
TBR=kinuko@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/fileapi/file_system_operation.cc | 21 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation.h | 3 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_interface.h | 45 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_unittest.cc | 50 |
4 files changed, 0 insertions, 119 deletions
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index d63647f..bbeedc8 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -9,7 +9,6 @@ #include "base/utf_string_conversions.h" #include "net/base/escape.h" #include "net/url_request/url_request_context.h" -#include "webkit/blob/deletable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util_proxy.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -24,20 +23,6 @@ namespace fileapi { -namespace { - -void GetMetadataForSnapshot( - const FileSystemOperationInterface::SnapshotFileCallback& callback, - base::PlatformFileError result, - const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { - // We don't want the third party to delete our local file, so just returning - // NULL as |deletable_file_reference|. - callback.Run(result, file_info, platform_path, NULL); -} - -} // anonymous namespace - class FileSystemOperation::ScopedQuotaNotifier { public: ScopedQuotaNotifier(FileSystemContext* context, @@ -442,12 +427,6 @@ void FileSystemOperation::SyncGetPlatformPath(const GURL& path_url, delete this; } -void FileSystemOperation::CreateSnapshotFile( - const GURL& path_url, - const SnapshotFileCallback& callback) { - GetMetadata(path_url, base::Bind(&GetMetadataForSnapshot, callback)); -} - FileSystemOperation::FileSystemOperation( scoped_refptr<base::MessageLoopProxy> proxy, FileSystemContext* file_system_context) diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h index ee51bd9..d0f1f25 100644 --- a/webkit/fileapi/file_system_operation.h +++ b/webkit/fileapi/file_system_operation.h @@ -89,9 +89,6 @@ class FileSystemOperation : public FileSystemOperationInterface { const OpenFileCallback& callback) OVERRIDE; virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE; virtual FileSystemOperation* AsFileSystemOperation() OVERRIDE; - virtual void CreateSnapshotFile( - const GURL& path, - const SnapshotFileCallback& callback) OVERRIDE; // Synchronously gets the platform path for the given |path_url|. void SyncGetPlatformPath(const GURL& path_url, FilePath* platform_path); diff --git a/webkit/fileapi/file_system_operation_interface.h b/webkit/fileapi/file_system_operation_interface.h index 6777f34..fe8ac4d 100644 --- a/webkit/fileapi/file_system_operation_interface.h +++ b/webkit/fileapi/file_system_operation_interface.h @@ -8,7 +8,6 @@ #include "base/file_util_proxy.h" #include "base/platform_file.h" #include "base/process.h" -#include "webkit/blob/deletable_file_reference.h" namespace base { class Time; @@ -19,10 +18,6 @@ class URLRequest; class URLRequestContext; } // namespace net -namespace webkit_blob { -class DeletableFileReference; -} - class GURL; namespace fileapi { @@ -79,35 +74,6 @@ class FileSystemOperationInterface { const std::vector<base::FileUtilProxy::Entry>& file_list, bool has_more)> ReadDirectoryCallback; - // Used for CreateSnapshotFile(). (Please see the comment at - // CreateSnapshotFile() below for how the method is called) - // |result| is the return code of the operation. - // |file_info| is the metadata of the snapshot file created. - // |platform_path| is the path to the snapshot file created. - // - // The snapshot file could simply be of the local file pointed by the given - // filesystem URL in local filesystem cases; remote filesystems - // may want to download the file into a temporary snapshot file and then - // return the metadata of the temporary file. - // - // |deletable_file_ref| is used to manage the lifetime of the returned - // snapshot file. It can be set to let the chromium backend take - // care of the life time of the snapshot file. Otherwise (if the returned - // file is not a temporary file to be deleted) the implementation can just - // return NULL. In a more complex case, the implementaiton can manage - // the lifetime of the snapshot file on its own (e.g. by its cache system) - // but also can be notified via the reference when the file becomes no - // longer necessary in the javascript world. - // Please see the comment for DeletableFileReference for details. - // - typedef base::Callback<void( - base::PlatformFileError result, - const base::PlatformFileInfo& file_info, - const FilePath& platform_path, - const scoped_refptr<webkit_blob::DeletableFileReference>& - deletable_file_ref - )> SnapshotFileCallback; - // Used for Write(). typedef base::Callback<void(base::PlatformFileError result, int64 bytes, @@ -229,17 +195,6 @@ class FileSystemOperationInterface { // handling based on element types is supported. virtual FileSystemOperation* AsFileSystemOperation() = 0; - // Creates a local snapshot file for a given |path| and returns the - // metadata and platform path of the snapshot file via |callback|. - // In local filesystem cases the implementation may simply return - // the metadata of the file itself (as well as GetMetadata does), - // while in remote filesystem case the backend may want to download the file - // into a temporary snapshot file and return the metadata of the - // temporary file. Or if the implementaiton already has the local cache - // data for |path| it can simply return the path to the cache. - virtual void CreateSnapshotFile(const GURL& path, - const SnapshotFileCallback& callback) = 0; - protected: // Used only for internal assertions. enum OperationType { diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index dcd0238..15f0d2b 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -13,7 +13,6 @@ #include "base/scoped_temp_dir.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" -#include "webkit/blob/deletable_file_reference.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -29,7 +28,6 @@ using quota::QuotaClient; using quota::QuotaManager; using quota::QuotaManagerProxy; using quota::StorageType; -using webkit_blob::DeletableFileReference; namespace fileapi { @@ -170,9 +168,6 @@ class FileSystemOperationTest const std::vector<base::FileUtilProxy::Entry>& entries() const { return entries_; } - const DeletableFileReference* deletable_file_ref() const { - return deletable_file_ref_; - } virtual void SetUp(); virtual void TearDown(); @@ -256,12 +251,6 @@ class FileSystemOperationTest return base::Bind(&FileSystemOperationTest::DidGetMetadata, AsWeakPtr()); } - FileSystemOperationInterface::SnapshotFileCallback - RecordSnapshotFileCallback() { - return base::Bind(&FileSystemOperationTest::DidCreateSnapshotFile, - AsWeakPtr()); - } - void DidFinish(base::PlatformFileError status) { status_ = status; } @@ -282,23 +271,11 @@ class FileSystemOperationTest status_ = status; } - void DidCreateSnapshotFile( - base::PlatformFileError status, - const base::PlatformFileInfo& info, - const FilePath& platform_path, - const scoped_refptr<DeletableFileReference>& deletable_file_ref) { - info_ = info; - path_ = platform_path; - status_ = status; - deletable_file_ref_ = deletable_file_ref; - } - // For post-operation status. int status_; base::PlatformFileInfo info_; FilePath path_; std::vector<base::FileUtilProxy::Entry> entries_; - scoped_refptr<DeletableFileReference> deletable_file_ref_; private: scoped_ptr<LocalFileUtil> local_file_util_; @@ -1037,31 +1014,4 @@ TEST_F(FileSystemOperationTest, TestTouchFile) { EXPECT_EQ(new_accessed_time.ToTimeT(), info.last_accessed.ToTimeT()); } -TEST_F(FileSystemOperationTest, TestCreateSnapshotFile) { - FilePath dir_path(CreateVirtualTemporaryDir()); - - // Create a file for the testing. - operation()->DirectoryExists(URLForPath(dir_path), - RecordStatusCallback()); - FilePath file_path(CreateVirtualTemporaryFileInDir(dir_path)); - operation()->FileExists(URLForPath(file_path), RecordStatusCallback()); - MessageLoop::current()->RunAllPending(); - EXPECT_EQ(base::PLATFORM_FILE_OK, status()); - - // See if we can get a 'snapshot' file info for the file. - // Since FileSystemOperation assumes the file exists in the local directory - // it should just returns the same metadata and platform_path as - // the file itself. - operation()->CreateSnapshotFile(URLForPath(file_path), - RecordSnapshotFileCallback()); - MessageLoop::current()->RunAllPending(); - EXPECT_EQ(base::PLATFORM_FILE_OK, status()); - EXPECT_FALSE(info().is_directory); - EXPECT_EQ(PlatformPath(file_path), path()); - - // The FileSystemOpration implementation does not set the deletable - // file reference. - EXPECT_EQ(NULL, deletable_file_ref()); -} - } // namespace fileapi |