summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authormmenke <mmenke@chromium.org>2015-12-17 14:16:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-17 22:18:22 +0000
commit8e329d672df2c725b3add82a186f30a1241eee01 (patch)
treedf3f3705ffe425330bbd1be664422b509e1cace8 /storage
parent55a51cd2acee98071ed344f7b17bac9fbd20fe54 (diff)
downloadchromium_src-8e329d672df2c725b3add82a186f30a1241eee01.zip
chromium_src-8e329d672df2c725b3add82a186f30a1241eee01.tar.gz
chromium_src-8e329d672df2c725b3add82a186f30a1241eee01.tar.bz2
Remove support for a URLRequest having a NULL Delegate.
This could be used to prevent it from invoking any callbacks, but this codepath was untested, and is only used by one consumer in production codes and a couple random tests, which can all easily be modified not to depend on it. BUG=569055 TBR=marq@chromium.org Review URL: https://codereview.chromium.org/1523433002 Cr-Commit-Position: refs/heads/master@{#365909}
Diffstat (limited to 'storage')
-rw-r--r--storage/browser/fileapi/file_writer_delegate.cc13
1 files changed, 4 insertions, 9 deletions
diff --git a/storage/browser/fileapi/file_writer_delegate.cc b/storage/browser/fileapi/file_writer_delegate.cc
index ab264d3..b401e02 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);