diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-07 20:49:59 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-07 20:49:59 +0000 |
commit | 74b3dc7a7ea8ff8c2a87d54eb3362afea597165a (patch) | |
tree | 20b5713585d131d42537800535fee30cec513f6e /webkit/fileapi/file_system_operation.cc | |
parent | 39f1166de3823e6b4e7164838b958e2028d6c1ec (diff) | |
download | chromium_src-74b3dc7a7ea8ff8c2a87d54eb3362afea597165a.zip chromium_src-74b3dc7a7ea8ff8c2a87d54eb3362afea597165a.tar.gz chromium_src-74b3dc7a7ea8ff8c2a87d54eb3362afea597165a.tar.bz2 |
Revert 61833 - Add the actual writing-files part of FileWriter.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3476002
TBR=ericu@google.com
Review URL: http://codereview.chromium.org/3630002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation.cc')
-rw-r--r-- | webkit/fileapi/file_system_operation.cc | 60 |
1 files changed, 9 insertions, 51 deletions
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index 29690b9..29336a8 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -5,9 +5,8 @@ #include "webkit/fileapi/file_system_operation.h" #include "base/time.h" -#include "net/url_request/url_request_context.h" +#include "googleurl/src/gurl.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" -#include "webkit/fileapi/file_writer_delegate.h" namespace fileapi { @@ -25,8 +24,6 @@ FileSystemOperation::FileSystemOperation( } FileSystemOperation::~FileSystemOperation() { - if (file_writer_delegate_.get()) - base::FileUtilProxy::Close(proxy_, file_writer_delegate_->file(), NULL); } void FileSystemOperation::CreateFile(const FilePath& path, @@ -133,7 +130,6 @@ void FileSystemOperation::Remove(const FilePath& path, bool recursive) { } void FileSystemOperation::Write( - scoped_refptr<URLRequestContext> url_request_context, const FilePath& path, const GURL& blob_url, int64 offset) { @@ -141,28 +137,7 @@ void FileSystemOperation::Write( DCHECK(kOperationNone == pending_operation_); pending_operation_ = kOperationWrite; #endif - DCHECK(blob_url.is_valid()); - file_writer_delegate_.reset(new FileWriterDelegate(this, offset)); - blob_request_.reset(new URLRequest(blob_url, file_writer_delegate_.get())); - blob_request_->set_context(url_request_context); - base::FileUtilProxy::CreateOrOpen( - proxy_, - path, - base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE | - base::PLATFORM_FILE_ASYNC, - callback_factory_.NewCallback( - &FileSystemOperation::OnFileOpenedForWrite)); -} - -void FileSystemOperation::OnFileOpenedForWrite( - base::PlatformFileError rv, - base::PassPlatformFile file, - bool created) { - if (base::PLATFORM_FILE_OK != rv) { - dispatcher_->DidFail(rv); - return; - } - file_writer_delegate_->Start(file.ReleaseValue(), blob_request_.get()); + NOTREACHED(); } void FileSystemOperation::Truncate(const FilePath& path, int64 length) { @@ -191,32 +166,15 @@ void FileSystemOperation::TouchFile(const FilePath& path, // We can only get here on a write or truncate that's not yet completed. // We don't support cancelling any other operation at this time. void FileSystemOperation::Cancel(FileSystemOperation* cancel_operation) { - if (file_writer_delegate_.get()) { #ifndef NDEBUG - DCHECK(kOperationWrite == pending_operation_); + DCHECK(kOperationTruncate == pending_operation_); + // FIXME(ericu): Cancelling for writes coming soon. #endif - // Writes are done without proxying through FileUtilProxy after the initial - // opening of the PlatformFile. All state changes are done on this thread, - // so we're guaranteed to be able to shut down atomically. We do need to - // check that the file has been opened [which means the blob_request_ has - // been created], so we know how much we need to do. - if (blob_request_.get()) - // This halts any calls to file_writer_delegate_ from blob_request_. - blob_request_->Cancel(); - - // This deletes us, and by proxy deletes file_writer_delegate_ if any. - dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_ABORT); - cancel_operation->dispatcher_->DidSucceed(); - } else { -#ifndef NDEBUG - DCHECK(kOperationTruncate == pending_operation_); -#endif - // We're cancelling a truncate operation, but we can't actually stop it - // since it's been proxied to another thread. We need to save the - // cancel_operation so that when the truncate returns, it can see that it's - // been cancelled, report it, and report that the cancel has succeeded. - cancel_operation_ = cancel_operation; - } + // We're cancelling a truncate operation, but we can't actually stop it + // since it's been proxied to another thread. We need to save the + // cancel_operation so that when the truncate returns, it can see that it's + // been cancelled, report it, and report that the cancel has succeeded. + cancel_operation_ = cancel_operation; } void FileSystemOperation::DidCreateFileExclusive( |