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

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

Issue 6881106: Treat ERR_CONNECTION_CLOSED as end-of-data marker for downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment & decreased logging verbosity. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_request_job.h" 5 #include "net/url_request/url_request_job.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // The headers should be complete before reads complete 299 // The headers should be complete before reads complete
300 DCHECK(has_handled_response_); 300 DCHECK(has_handled_response_);
301 301
302 OnRawReadComplete(bytes_read); 302 OnRawReadComplete(bytes_read);
303 303
304 // Don't notify if we had an error. 304 // Don't notify if we had an error.
305 if (!request_->status().is_success()) 305 if (!request_->status().is_success())
306 return; 306 return;
307 307
308 // When notifying the delegate, the delegate can release the request 308 // When notifying the delegate, the delegate can release the request
309 // (and thus release 'this'). After calling to the delgate, we must 309 // (and thus release 'this'). After calling to the delegate, we must
310 // check the request pointer to see if it still exists, and return 310 // check the request pointer to see if it still exists, and return
311 // immediately if it has been destroyed. self_preservation ensures our 311 // immediately if it has been destroyed. self_preservation ensures our
312 // survival until we can get out of this method. 312 // survival until we can get out of this method.
313 scoped_refptr<URLRequestJob> self_preservation(this); 313 scoped_refptr<URLRequestJob> self_preservation(this);
314 314
315 prefilter_bytes_read_ += bytes_read; 315 prefilter_bytes_read_ += bytes_read;
316 if (filter_.get()) { 316 if (filter_.get()) {
317 // Tell the filter that it has more data 317 // Tell the filter that it has more data
318 FilteredDataRead(bytes_read); 318 FilteredDataRead(bytes_read);
319 319
320 // Filter the data. 320 // Filter the data.
321 int filter_bytes_read = 0; 321 int filter_bytes_read = 0;
322 if (ReadFilteredData(&filter_bytes_read)) { 322 if (ReadFilteredData(&filter_bytes_read)) {
323 postfilter_bytes_read_ += filter_bytes_read; 323 postfilter_bytes_read_ += filter_bytes_read;
324 request_->delegate()->OnReadCompleted(request_, filter_bytes_read); 324 request_->delegate()->OnReadCompleted(request_, filter_bytes_read);
325 } 325 }
326 } else { 326 } else {
327 postfilter_bytes_read_ += bytes_read; 327 postfilter_bytes_read_ += bytes_read;
328 request_->delegate()->OnReadCompleted(request_, bytes_read); 328 request_->delegate()->OnReadCompleted(request_, bytes_read);
329 } 329 }
330 VLOG(20) << __FUNCTION__ << "() "
darin (slow to review) 2011/05/16 17:47:16 would it be more helpful if this were output to th
ahendrickson 2011/05/16 19:37:40 I find it useful to use VLOG, as I have a lot of o
331 << "\"" << (request_ ? request_->url().spec() : "???") << "\""
332 << " bytes read = " << bytes_read
333 << " total = " << postfilter_bytes_read_;
330 } 334 }
331 335
332 void URLRequestJob::NotifyStartError(const URLRequestStatus &status) { 336 void URLRequestJob::NotifyStartError(const URLRequestStatus &status) {
333 DCHECK(!has_handled_response_); 337 DCHECK(!has_handled_response_);
334 has_handled_response_ = true; 338 has_handled_response_ = true;
335 if (request_) { 339 if (request_) {
336 request_->set_status(status); 340 request_->set_status(status);
337 request_->ResponseStarted(); 341 request_->ResponseStarted();
338 } 342 }
339 } 343 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 605 }
602 606
603 bool URLRequestJob::FilterHasData() { 607 bool URLRequestJob::FilterHasData() {
604 return filter_.get() && filter_->stream_data_len(); 608 return filter_.get() && filter_->stream_data_len();
605 } 609 }
606 610
607 void URLRequestJob::UpdatePacketReadTimes() { 611 void URLRequestJob::UpdatePacketReadTimes() {
608 } 612 }
609 613
610 } // namespace net 614 } // namespace net
OLDNEW
« net/http/http_stream_parser.cc ('K') | « net/url_request/url_request_http_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698