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

Unified Diff: net/url_request/url_fetcher_core.cc

Issue 2653183006: Make URLFetcherCore::ReleaseRequest() release |buffer_|. (Closed)
Patch Set: Move to OnResponseStarted Created 3 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_core.cc
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 2a7a4d2899830a41287eab8107b5f2f462ece75d..ff5e5d4da34fcb68077bbe83363649de23844d3e 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -82,7 +82,6 @@ URLFetcherCore::URLFetcherCore(URLFetcher* fetcher,
delegate_task_runner_(base::SequencedTaskRunnerHandle::Get()),
load_flags_(LOAD_NORMAL),
response_code_(URLFetcher::RESPONSE_CODE_INVALID),
- buffer_(new IOBuffer(kBufferSize)),
url_request_data_key_(NULL),
was_fetched_via_proxy_(false),
was_cached_(false),
@@ -428,6 +427,9 @@ void URLFetcherCore::OnResponseStarted(URLRequest* request, int net_error) {
total_response_bytes_ = request_->GetExpectedContentSize();
}
+ DCHECK(!buffer_);
+ if (request_type_ != URLFetcher::HEAD)
+ buffer_ = new IOBuffer(kBufferSize);
ReadResponse();
}
@@ -816,6 +818,7 @@ void URLFetcherCore::ReleaseRequest() {
request_context_getter_->RemoveObserver(this);
upload_progress_checker_timer_.reset();
request_.reset();
+ buffer_ = nullptr;
g_registry.Get().RemoveURLFetcherCore(this);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698