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

Side by Side Diff: net/url_request/url_fetcher_core.cc

Issue 2653183006: Make URLFetcherCore::ReleaseRequest() release |buffer_|. (Closed)
Patch Set: Move to OnResponseStarted Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_fetcher_core.h" 5 #include "net/url_request/url_fetcher_core.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const GURL& original_url, 75 const GURL& original_url,
76 URLFetcher::RequestType request_type, 76 URLFetcher::RequestType request_type,
77 URLFetcherDelegate* d) 77 URLFetcherDelegate* d)
78 : fetcher_(fetcher), 78 : fetcher_(fetcher),
79 original_url_(original_url), 79 original_url_(original_url),
80 request_type_(request_type), 80 request_type_(request_type),
81 delegate_(d), 81 delegate_(d),
82 delegate_task_runner_(base::SequencedTaskRunnerHandle::Get()), 82 delegate_task_runner_(base::SequencedTaskRunnerHandle::Get()),
83 load_flags_(LOAD_NORMAL), 83 load_flags_(LOAD_NORMAL),
84 response_code_(URLFetcher::RESPONSE_CODE_INVALID), 84 response_code_(URLFetcher::RESPONSE_CODE_INVALID),
85 buffer_(new IOBuffer(kBufferSize)),
86 url_request_data_key_(NULL), 85 url_request_data_key_(NULL),
87 was_fetched_via_proxy_(false), 86 was_fetched_via_proxy_(false),
88 was_cached_(false), 87 was_cached_(false),
89 received_response_content_length_(0), 88 received_response_content_length_(0),
90 total_received_bytes_(0), 89 total_received_bytes_(0),
91 upload_content_set_(false), 90 upload_content_set_(false),
92 upload_range_offset_(0), 91 upload_range_offset_(0),
93 upload_range_length_(0), 92 upload_range_length_(0),
94 referrer_policy_( 93 referrer_policy_(
95 URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 94 URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 420
422 if (net_error == OK) { 421 if (net_error == OK) {
423 response_code_ = request_->GetResponseCode(); 422 response_code_ = request_->GetResponseCode();
424 response_headers_ = request_->response_headers(); 423 response_headers_ = request_->response_headers();
425 socket_address_ = request_->GetSocketAddress(); 424 socket_address_ = request_->GetSocketAddress();
426 was_fetched_via_proxy_ = request_->was_fetched_via_proxy(); 425 was_fetched_via_proxy_ = request_->was_fetched_via_proxy();
427 was_cached_ = request_->was_cached(); 426 was_cached_ = request_->was_cached();
428 total_response_bytes_ = request_->GetExpectedContentSize(); 427 total_response_bytes_ = request_->GetExpectedContentSize();
429 } 428 }
430 429
430 DCHECK(!buffer_);
431 if (request_type_ != URLFetcher::HEAD)
432 buffer_ = new IOBuffer(kBufferSize);
431 ReadResponse(); 433 ReadResponse();
432 } 434 }
433 435
434 void URLFetcherCore::OnCertificateRequested( 436 void URLFetcherCore::OnCertificateRequested(
435 URLRequest* request, 437 URLRequest* request,
436 SSLCertRequestInfo* cert_request_info) { 438 SSLCertRequestInfo* cert_request_info) {
437 DCHECK_EQ(request, request_.get()); 439 DCHECK_EQ(request, request_.get());
438 DCHECK(network_task_runner_->BelongsToCurrentThread()); 440 DCHECK(network_task_runner_->BelongsToCurrentThread());
439 441
440 if (g_ignore_certificate_requests) { 442 if (g_ignore_certificate_requests) {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 CancelURLRequest(result); 811 CancelURLRequest(result);
810 delegate_task_runner_->PostTask( 812 delegate_task_runner_->PostTask(
811 FROM_HERE, 813 FROM_HERE,
812 base::Bind(&URLFetcherCore::InformDelegateFetchIsComplete, this)); 814 base::Bind(&URLFetcherCore::InformDelegateFetchIsComplete, this));
813 } 815 }
814 816
815 void URLFetcherCore::ReleaseRequest() { 817 void URLFetcherCore::ReleaseRequest() {
816 request_context_getter_->RemoveObserver(this); 818 request_context_getter_->RemoveObserver(this);
817 upload_progress_checker_timer_.reset(); 819 upload_progress_checker_timer_.reset();
818 request_.reset(); 820 request_.reset();
821 buffer_ = nullptr;
819 g_registry.Get().RemoveURLFetcherCore(this); 822 g_registry.Get().RemoveURLFetcherCore(this);
820 } 823 }
821 824
822 base::TimeTicks URLFetcherCore::GetBackoffReleaseTime() { 825 base::TimeTicks URLFetcherCore::GetBackoffReleaseTime() {
823 DCHECK(network_task_runner_->BelongsToCurrentThread()); 826 DCHECK(network_task_runner_->BelongsToCurrentThread());
824 827
825 if (!original_url_throttler_entry_.get()) 828 if (!original_url_throttler_entry_.get())
826 return base::TimeTicks(); 829 return base::TimeTicks();
827 830
828 base::TimeTicks original_url_backoff = 831 base::TimeTicks original_url_backoff =
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 } 955 }
953 956
954 void URLFetcherCore::AssertHasNoUploadData() const { 957 void URLFetcherCore::AssertHasNoUploadData() const {
955 DCHECK(!upload_content_set_); 958 DCHECK(!upload_content_set_);
956 DCHECK(upload_content_.empty()); 959 DCHECK(upload_content_.empty());
957 DCHECK(upload_file_path_.empty()); 960 DCHECK(upload_file_path_.empty());
958 DCHECK(upload_stream_factory_.is_null()); 961 DCHECK(upload_stream_factory_.is_null());
959 } 962 }
960 963
961 } // namespace net 964 } // namespace net
OLDNEW
« 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