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

Unified Diff: storage/browser/fileapi/file_writer_delegate.cc

Issue 1523433002: Remove support for a URLRequest having a NULL Delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge, remove if in file_writer_delegate Created 5 years 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 | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/fileapi/file_writer_delegate.cc
diff --git a/storage/browser/fileapi/file_writer_delegate.cc b/storage/browser/fileapi/file_writer_delegate.cc
index ab264d3b517fc1919a362e6750557c3b52dde6ec..b401e020247a36d013def7105f6fa26db53eb0b5 100644
--- a/storage/browser/fileapi/file_writer_delegate.cc
+++ b/storage/browser/fileapi/file_writer_delegate.cc
@@ -44,11 +44,8 @@ void FileWriterDelegate::Start(scoped_ptr<net::URLRequest> request,
}
void FileWriterDelegate::Cancel() {
- if (request_) {
- // This halts any callbacks on this delegate.
- request_->set_delegate(NULL);
- request_->Cancel();
- }
+ // Destroy the request to prevent it from invoking any callbacks.
+ request_.reset();
const int status = file_stream_writer_->Cancel(
base::Bind(&FileWriterDelegate::OnWriteCancelled,
@@ -172,10 +169,8 @@ FileWriterDelegate::GetCompletionStatusOnError() const {
}
void FileWriterDelegate::OnError(base::File::Error error) {
- if (request_) {
- request_->set_delegate(NULL);
- request_->Cancel();
- }
+ // Destroy the request to prevent it from invoking any callbacks.
+ request_.reset();
if (writing_started_)
MaybeFlushForCompletion(error, 0, ERROR_WRITE_STARTED);
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698