Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: webkit/fileapi/local_file_system_operation.cc

Issue 10956064: Send OnModifyFile Notification when File Write Finishes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added write status inside FileWriteDelegate so onFileModify notifications are only sent when a file… Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/local_file_system_operation.cc
diff --git a/webkit/fileapi/local_file_system_operation.cc b/webkit/fileapi/local_file_system_operation.cc
index ff46be532199a57d370f4c7b080206d6aa826091..3d1e4a4db899f898d30e2bf357b41a3ef1c4a8d3 100644
--- a/webkit/fileapi/local_file_system_operation.cc
+++ b/webkit/fileapi/local_file_system_operation.cc
@@ -314,7 +314,7 @@ void LocalFileSystemOperation::Write(
DCHECK(blob_url.is_valid());
file_writer_delegate_.reset(new FileWriterDelegate(
base::Bind(&LocalFileSystemOperation::DidWrite,
- weak_factory_.GetWeakPtr()),
+ weak_factory_.GetWeakPtr(), url),
writer.Pass()));
set_write_callback(callback);
@@ -677,17 +677,27 @@ void LocalFileSystemOperation::DidReadDirectory(
}
void LocalFileSystemOperation::DidWrite(
+ const FileSystemURL& url,
base::PlatformFileError rv,
int64 bytes,
- bool complete) {
+ FileWriterDelegate::WriteCompletionStatus write_status) {
if (write_callback_.is_null()) {
// If cancelled, callback is already invoked and set to null in Cancel().
// We must not call it twice. Just shut down this operation object.
delete this;
return;
}
+
+ if (write_status == FileWriterDelegate::COMPLETE_SUCCESSFUL ||
+ write_status == FileWriterDelegate::ERROR_WRITE_STARTED) {
kinuko 2012/09/25 14:00:49 This might be only me but I found this code kinda
calvinlo 2012/09/26 05:23:07 Done.
+ operation_context_->change_observers()->Notify(
+ &FileChangeObserver::OnModifyFile, MakeTuple(url));
+ }
+
+ bool complete = (write_status != FileWriterDelegate::NOT_COMPLETE);
write_callback_.Run(rv, bytes, complete);
- if (complete || rv != base::PLATFORM_FILE_OK)
+ if (write_status == FileWriterDelegate::COMPLETE_SUCCESSFUL ||
kinuko 2012/09/25 14:00:49 shouldn't this just use 'complete'?
calvinlo 2012/09/26 05:23:07 Done.
+ rv != base::PLATFORM_FILE_OK)
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698