diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 11:11:59 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-15 11:11:59 +0000 |
commit | 8ee8a0b20c3b138034ab5cd855ca3263dc20dde4 (patch) | |
tree | 4c0aae09e1124eb2cd45167eaa1e409164b075eb /webkit/chromeos | |
parent | 7cb20f8ec695b6b9f7343d9e33dcdf874725e2b3 (diff) | |
download | chromium_src-8ee8a0b20c3b138034ab5cd855ca3263dc20dde4.zip chromium_src-8ee8a0b20c3b138034ab5cd855ca3263dc20dde4.tar.gz chromium_src-8ee8a0b20c3b138034ab5cd855ca3263dc20dde4.tar.bz2 |
Add test for RemoteFileSystemOperation::Write() and fix several revealed bugs.
* Add a browser test for remote file writing.
* Fix a confusion of remote and local path in CloseWritableSnapshotFile.
* Fix a calling thread for automatic invocation of CreateWritableSnapshotFile.
* Fix a wrong ownership relation between FileWriterDelegate and RemoteFileStreamWriter.
* Made CommitDirtyInCache update entry metadata.
BUG=132051, 127097
TEST=browser_tests --gtest_filter='*RemoteFileSystem*'
Review URL: https://chromiumcodereview.appspot.com/10537174
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/chromeos')
-rw-r--r-- | webkit/chromeos/fileapi/remote_file_system_operation.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/webkit/chromeos/fileapi/remote_file_system_operation.cc b/webkit/chromeos/fileapi/remote_file_system_operation.cc index 9e38541..3404f37 100644 --- a/webkit/chromeos/fileapi/remote_file_system_operation.cc +++ b/webkit/chromeos/fileapi/remote_file_system_operation.cc @@ -111,7 +111,8 @@ void RemoteFileSystemOperation::Write( file_writer_delegate_.reset( new fileapi::FileWriterDelegate( base::Bind(&RemoteFileSystemOperation::DidWrite, - base::Owned(this), + // FileWriterDelegate is owned by |this|. So Unretained. + base::Unretained(this), callback), scoped_ptr<fileapi::FileStreamWriter>( new fileapi::RemoteFileStreamWriter(remote_proxy_, @@ -230,9 +231,16 @@ void RemoteFileSystemOperation::DidWrite( base::PlatformFileError rv, int64 bytes, bool complete) { - if (rv != base::PLATFORM_FILE_OK || complete) - file_writer_delegate_.reset(); callback.Run(rv, bytes, complete); + if (rv != base::PLATFORM_FILE_OK || complete) { + // Other Did*'s doesn't have "delete this", because it is automatic since + // they are base::Owned by the caller of the callback. For DidWrite, the + // owner is file_writer_delegate_ which itself is owned by this Operation + // object. Hence we need manual life time management here. + // TODO(kinaba): think about refactoring FileWriterDelegate to be self + // destructing, for avoiding the manual management. + delete this; + } } void RemoteFileSystemOperation::DidFinishFileOperation( |