summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 02:27:37 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-12 02:27:37 +0000
commit005bb5f499ad3282ffb6ad7d14167e1801796ef0 (patch)
tree834e045523c8d9213f2051c46d1ec081034ff6d7 /webkit/fileapi
parent22f649e079ecab148c43314569a3ab74d1d9d8b8 (diff)
downloadchromium_src-005bb5f499ad3282ffb6ad7d14167e1801796ef0.zip
chromium_src-005bb5f499ad3282ffb6ad7d14167e1801796ef0.tar.gz
chromium_src-005bb5f499ad3282ffb6ad7d14167e1801796ef0.tar.bz2
FileWriter: Defend against being deleted in the FileWriterDelegate completion callback.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3690003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/file_writer_delegate.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc
index d84d22f32..21f69b1 100644
--- a/webkit/fileapi/file_writer_delegate.cc
+++ b/webkit/fileapi/file_writer_delegate.cc
@@ -151,13 +151,14 @@ void FileWriterDelegate::OnProgress(int bytes_read, bool done) {
if (done || last_progress_event_time_.is_null() ||
(currentTime - last_progress_event_time_).InMilliseconds() >
kMinProgressDelayMS) {
- file_system_operation_->DidWrite(base::PLATFORM_FILE_OK,
- bytes_read + bytes_read_backlog_, done);
+ bytes_read += bytes_read_backlog_;
last_progress_event_time_ = currentTime;
bytes_read_backlog_ = 0;
- } else {
- bytes_read_backlog_ += bytes_read;
+ file_system_operation_->DidWrite(
+ base::PLATFORM_FILE_OK, bytes_read, done);
+ return;
}
+ bytes_read_backlog_ += bytes_read;
}
} // namespace fileapi