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

Unified Diff: webkit/fileapi/file_writer_delegate.h

Issue 10008047: FileWriterDelegate should not call URLRequest::Start() after Cancel(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reverted the test Created 8 years, 7 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
« no previous file with comments | « webkit/fileapi/file_system_operation_write_unittest.cc ('k') | webkit/fileapi/file_writer_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_writer_delegate.h
diff --git a/webkit/fileapi/file_writer_delegate.h b/webkit/fileapi/file_writer_delegate.h
index 4b37af0f8ed3f0f5a32fbfde491487e7feedd3bb..3b58ae0f647572549c74e38b6e1d45b7414962d8 100644
--- a/webkit/fileapi/file_writer_delegate.h
+++ b/webkit/fileapi/file_writer_delegate.h
@@ -30,10 +30,15 @@ class FileWriterDelegate : public net::URLRequest::Delegate {
virtual ~FileWriterDelegate();
void Start(base::PlatformFile file,
- net::URLRequest* request);
- base::PlatformFile file() {
- return file_;
- }
+ scoped_ptr<net::URLRequest> request);
+
+ // Cancels the current write operation. Returns true if it is ok to
+ // delete this instance immediately. Otherwise this will call
+ // |write_operation|->DidWrite() with complete=true to let the operation
+ // perform the final cleanup.
+ bool Cancel();
+
+ base::PlatformFile file() const { return file_; }
virtual void OnReceivedRedirect(net::URLRequest* request,
const GURL& new_url,
@@ -51,7 +56,8 @@ class FileWriterDelegate : public net::URLRequest::Delegate {
int bytes_read) OVERRIDE;
private:
- void OnGetFileInfoAndCallStartUpdate(
+ void OnGetFileInfoAndStartRequest(
+ scoped_ptr<net::URLRequest> request,
base::PlatformFileError error,
const base::PlatformFileInfo& file_info);
void Read();
@@ -69,6 +75,7 @@ class FileWriterDelegate : public net::URLRequest::Delegate {
FileSystemPath path_;
int64 size_;
int64 offset_;
+ bool has_pending_write_;
base::Time last_progress_event_time_;
int bytes_written_backlog_;
int bytes_written_;
@@ -78,7 +85,7 @@ class FileWriterDelegate : public net::URLRequest::Delegate {
scoped_refptr<net::IOBufferWithSize> io_buffer_;
scoped_refptr<net::DrainableIOBuffer> cursor_;
scoped_ptr<net::FileStream> file_stream_;
- net::URLRequest* request_;
+ scoped_ptr<net::URLRequest> request_;
base::WeakPtrFactory<FileWriterDelegate> weak_factory_;
};
« no previous file with comments | « webkit/fileapi/file_system_operation_write_unittest.cc ('k') | webkit/fileapi/file_writer_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698