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

Side by Side Diff: webkit/browser/fileapi/file_system_operation_impl.cc

Issue 23537020: Fixes FileSystemOperation::Cancel behavior (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/fileapi/file_system_operation_impl.h" 5 #include "webkit/browser/fileapi/file_system_operation_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 DidFinishOperation(callback, rv); 446 DidFinishOperation(callback, rv);
447 } 447 }
448 448
449 void FileSystemOperationImpl::DidFinishOperation( 449 void FileSystemOperationImpl::DidFinishOperation(
450 const StatusCallback& callback, 450 const StatusCallback& callback,
451 base::PlatformFileError rv) { 451 base::PlatformFileError rv) {
452 if (!cancel_callback_.is_null()) { 452 if (!cancel_callback_.is_null()) {
453 DCHECK_EQ(kOperationTruncate, pending_operation_); 453 DCHECK_EQ(kOperationTruncate, pending_operation_);
454 454
455 StatusCallback cancel_callback = cancel_callback_; 455 StatusCallback cancel_callback = cancel_callback_;
456 callback.Run(base::PLATFORM_FILE_ERROR_ABORT); 456 callback.Run(rv);
457 cancel_callback.Run(base::PLATFORM_FILE_OK); 457
458 // Return OK only if we succeeded to stop the operation.
459 cancel_callback.Run(rv == base::PLATFORM_FILE_ERROR_ABORT ?
460 base::PLATFORM_FILE_OK :
461 base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
458 } else { 462 } else {
459 callback.Run(rv); 463 callback.Run(rv);
460 } 464 }
461 } 465 }
462 466
463 void FileSystemOperationImpl::DidDirectoryExists( 467 void FileSystemOperationImpl::DidDirectoryExists(
464 const StatusCallback& callback, 468 const StatusCallback& callback,
465 base::PlatformFileError rv, 469 base::PlatformFileError rv,
466 const base::PlatformFileInfo& file_info) { 470 const base::PlatformFileInfo& file_info) {
467 if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory) 471 if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 532 }
529 533
530 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { 534 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) {
531 if (pending_operation_ != kOperationNone) 535 if (pending_operation_ != kOperationNone)
532 return false; 536 return false;
533 pending_operation_ = type; 537 pending_operation_ = type;
534 return true; 538 return true;
535 } 539 }
536 540
537 } // namespace fileapi 541 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698