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

Side by Side Diff: webkit/chromeos/fileapi/remote_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: Kinuko Review #2 Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" 5 #include "webkit/chromeos/fileapi/remote_file_system_operation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/platform_file.h" 9 #include "base/platform_file.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const ReadDirectoryCallback& callback, 264 const ReadDirectoryCallback& callback,
265 base::PlatformFileError rv, 265 base::PlatformFileError rv,
266 const std::vector<base::FileUtilProxy::Entry>& entries, 266 const std::vector<base::FileUtilProxy::Entry>& entries,
267 bool has_more) { 267 bool has_more) {
268 callback.Run(rv, entries, has_more /* has_more */); 268 callback.Run(rv, entries, has_more /* has_more */);
269 } 269 }
270 270
271 void RemoteFileSystemOperation::DidWrite( 271 void RemoteFileSystemOperation::DidWrite(
272 base::PlatformFileError rv, 272 base::PlatformFileError rv,
273 int64 bytes, 273 int64 bytes,
274 bool complete) { 274 FileWriterDelegate::WriteProgressStatus write_status) {
275 if (write_callback_.is_null()) { 275 if (write_callback_.is_null()) {
276 // If cancelled, callback is already invoked and set to null in Cancel(). 276 // If cancelled, callback is already invoked and set to null in Cancel().
277 // We must not call it twice. Just shut down this operation object. 277 // We must not call it twice. Just shut down this operation object.
278 delete this; 278 delete this;
279 return; 279 return;
280 } 280 }
281
282 bool complete = (write_status != FileWriterDelegate::SUCCESS_IO_PENDING);
281 write_callback_.Run(rv, bytes, complete); 283 write_callback_.Run(rv, bytes, complete);
282 if (rv != base::PLATFORM_FILE_OK || complete) { 284 if (rv != base::PLATFORM_FILE_OK || complete) {
283 // Other Did*'s doesn't have "delete this", because it is automatic since 285 // Other Did*'s doesn't have "delete this", because it is automatic since
284 // they are base::Owned by the caller of the callback. For DidWrite, the 286 // they are base::Owned by the caller of the callback. For DidWrite, the
285 // owner is file_writer_delegate_ which itself is owned by this Operation 287 // owner is file_writer_delegate_ which itself is owned by this Operation
286 // object. Hence we need manual life time management here. 288 // object. Hence we need manual life time management here.
287 // TODO(kinaba): think about refactoring FileWriterDelegate to be self 289 // TODO(kinaba): think about refactoring FileWriterDelegate to be self
288 // destructing, for avoiding the manual management. 290 // destructing, for avoiding the manual management.
289 delete this; 291 delete this;
290 } 292 }
(...skipping 24 matching lines...) Expand all
315 317
316 void RemoteFileSystemOperation::DidOpenFile( 318 void RemoteFileSystemOperation::DidOpenFile(
317 const OpenFileCallback& callback, 319 const OpenFileCallback& callback,
318 base::PlatformFileError result, 320 base::PlatformFileError result,
319 base::PlatformFile file, 321 base::PlatformFile file,
320 base::ProcessHandle peer_handle) { 322 base::ProcessHandle peer_handle) {
321 callback.Run(result, file, peer_handle); 323 callback.Run(result, file, peer_handle);
322 } 324 }
323 325
324 } // namespace chromeos 326 } // namespace chromeos
OLDNEW
« no previous file with comments | « webkit/chromeos/fileapi/remote_file_system_operation.h ('k') | webkit/fileapi/file_writer_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698