| Index: webkit/fileapi/webfilewriter_base.cc
|
| diff --git a/webkit/fileapi/webfilewriter_base.cc b/webkit/fileapi/webfilewriter_base.cc
|
| index ca0239f57ed5c8ac1074997a48ef9ebd405ffb4b..cd0bd7575999b7ce0e1f0935c553cfeb0d836518 100644
|
| --- a/webkit/fileapi/webfilewriter_base.cc
|
| +++ b/webkit/fileapi/webfilewriter_base.cc
|
| @@ -63,6 +63,34 @@ void WebFileWriterBase::cancel() {
|
| DoCancel();
|
| }
|
|
|
| +void WebFileWriterBase::DidFinish(base::PlatformFileError error_code) {
|
| + if (error_code == base::PLATFORM_FILE_OK)
|
| + DidSucceed();
|
| + else
|
| + DidFail(error_code);
|
| +}
|
| +
|
| +void WebFileWriterBase::DidWrite(int64 bytes, bool complete) {
|
| + DCHECK(kOperationWrite == operation_);
|
| + switch (cancel_state_) {
|
| + case kCancelNotInProgress:
|
| + if (complete)
|
| + operation_ = kOperationNone;
|
| + client_->didWrite(bytes, complete);
|
| + break;
|
| + case kCancelSent:
|
| + // This is the success call of the write, which we'll eat, even though
|
| + // it succeeded before the cancel got there. We accepted the cancel call,
|
| + // so the write will eventually return an error.
|
| + if (complete)
|
| + cancel_state_ = kCancelReceivedWriteResponse;
|
| + break;
|
| + case kCancelReceivedWriteResponse:
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| +}
|
| +
|
| void WebFileWriterBase::DidSucceed() {
|
| // Write never gets a DidSucceed call, so this is either a cancel or truncate
|
| // response.
|
| @@ -115,27 +143,6 @@ void WebFileWriterBase::DidFail(base::PlatformFileError error_code) {
|
| }
|
| }
|
|
|
| -void WebFileWriterBase::DidWrite(int64 bytes, bool complete) {
|
| - DCHECK(kOperationWrite == operation_);
|
| - switch (cancel_state_) {
|
| - case kCancelNotInProgress:
|
| - if (complete)
|
| - operation_ = kOperationNone;
|
| - client_->didWrite(bytes, complete);
|
| - break;
|
| - case kCancelSent:
|
| - // This is the success call of the write, which we'll eat, even though
|
| - // it succeeded before the cancel got there. We accepted the cancel call,
|
| - // so the write will eventually return an error.
|
| - if (complete)
|
| - cancel_state_ = kCancelReceivedWriteResponse;
|
| - break;
|
| - case kCancelReceivedWriteResponse:
|
| - default:
|
| - NOTREACHED();
|
| - }
|
| -}
|
| -
|
| void WebFileWriterBase::FinishCancel() {
|
| DCHECK(kCancelReceivedWriteResponse == cancel_state_);
|
| DCHECK(kOperationNone != operation_);
|
|
|