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

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: fixing.. Created 8 years, 8 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
Index: webkit/fileapi/file_writer_delegate.h
diff --git a/webkit/fileapi/file_writer_delegate.h b/webkit/fileapi/file_writer_delegate.h
index dbb2d7c140f181ab7e5ee13203674567284324a7..8b85bc10e105bb53db0393fe48b2d998d872a27d 100644
--- a/webkit/fileapi/file_writer_delegate.h
+++ b/webkit/fileapi/file_writer_delegate.h
@@ -32,10 +32,10 @@ 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);
+ void Cancel();
+
+ base::PlatformFile file() const { return file_; }
virtual void OnReceivedRedirect(net::URLRequest* request,
const GURL& new_url,
@@ -53,6 +53,12 @@ class FileWriterDelegate : public net::URLRequest::Delegate {
int bytes_read) OVERRIDE;
private:
+ enum State {
+ FILE_WRITER_STATE_CREATED,
+ FILE_WRITER_STATE_REQUEST_STARTED,
+ FILE_WRITER_STATE_CANCELED,
+ };
+
void OnGetFileInfoAndCallStartUpdate(
base::PlatformFileError error,
const base::PlatformFileInfo& file_info);
@@ -67,6 +73,7 @@ class FileWriterDelegate : public net::URLRequest::Delegate {
FileSystemQuotaUtil* quota_util() const;
FileSystemOperation* file_system_operation_;
+ State state_;
base::PlatformFile file_;
FileSystemPath path_;
int64 size_;
@@ -81,7 +88,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_;
};

Powered by Google App Engine
This is Rietveld 408576698