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

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

Issue 7084007: Adds URLRequestJob bytes read to NetLog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 9 years, 6 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 break; 523 break;
524 } 524 }
525 } 525 }
526 DVLOG(2) << __FUNCTION__ << "() " 526 DVLOG(2) << __FUNCTION__ << "() "
527 << "\"" << (request_ ? request_->url().spec() : "???") << "\"" 527 << "\"" << (request_ ? request_->url().spec() : "???") << "\""
528 << " rv = " << rv 528 << " rv = " << rv
529 << " post bytes read = " << filtered_data_len 529 << " post bytes read = " << filtered_data_len
530 << " pre total = " << prefilter_bytes_read_ 530 << " pre total = " << prefilter_bytes_read_
531 << " post total = " 531 << " post total = "
532 << postfilter_bytes_read_; 532 << postfilter_bytes_read_;
533 // If logging all bytes is enabled, log the filtered bytes read.
534 if (rv && request() && request()->net_log().IsLoggingBytes() &&
535 filtered_data_len > 0) {
536 request()->net_log().AddByteTransferEvent(
537 NetLog::TYPE_URL_REQUEST_JOB_FILTERED_BYTES_READ,
538 filtered_data_len, filtered_read_buffer_->data());
539 }
533 } else { 540 } else {
534 // we are done, or there is no data left. 541 // we are done, or there is no data left.
535 rv = true; 542 rv = true;
536 } 543 }
537 544
538 if (rv) { 545 if (rv) {
539 // When we successfully finished a read, we no longer need to 546 // When we successfully finished a read, we no longer need to
540 // save the caller's buffers. Release our reference. 547 // save the caller's buffers. Release our reference.
541 filtered_read_buffer_ = NULL; 548 filtered_read_buffer_ = NULL;
542 filtered_read_buffer_len_ = 0; 549 filtered_read_buffer_len_ = 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 DCHECK(!request_->status().is_io_pending()); 588 DCHECK(!request_->status().is_io_pending());
582 DCHECK(raw_read_buffer_ == NULL); 589 DCHECK(raw_read_buffer_ == NULL);
583 590
584 // Keep a pointer to the read buffer, so we have access to it in the 591 // Keep a pointer to the read buffer, so we have access to it in the
585 // OnRawReadComplete() callback in the event that the read completes 592 // OnRawReadComplete() callback in the event that the read completes
586 // asynchronously. 593 // asynchronously.
587 raw_read_buffer_ = buf; 594 raw_read_buffer_ = buf;
588 bool rv = ReadRawData(buf, buf_size, bytes_read); 595 bool rv = ReadRawData(buf, buf_size, bytes_read);
589 596
590 if (!request_->status().is_io_pending()) { 597 if (!request_->status().is_io_pending()) {
598 // If |filter_| is NULL, and logging all bytes is enabled, log the raw
599 // bytes read.
600 if (!filter_.get() && request() && request()->net_log().IsLoggingBytes() &&
601 *bytes_read > 0) {
602 request()->net_log().AddByteTransferEvent(
603 NetLog::TYPE_URL_REQUEST_JOB_BYTES_READ,
604 *bytes_read, raw_read_buffer_->data());
605 }
606
591 // If the read completes synchronously, either success or failure, 607 // If the read completes synchronously, either success or failure,
592 // invoke the OnRawReadComplete callback so we can account for the 608 // invoke the OnRawReadComplete callback so we can account for the
593 // completed read. 609 // completed read.
594 OnRawReadComplete(*bytes_read); 610 OnRawReadComplete(*bytes_read);
595 } 611 }
596 return rv; 612 return rv;
597 } 613 }
598 614
599 void URLRequestJob::FollowRedirect(const GURL& location, int http_status_code) { 615 void URLRequestJob::FollowRedirect(const GURL& location, int http_status_code) {
600 int rv = request_->Redirect(location, http_status_code); 616 int rv = request_->Redirect(location, http_status_code);
(...skipping 26 matching lines...) Expand all
627 } 643 }
628 644
629 bool URLRequestJob::FilterHasData() { 645 bool URLRequestJob::FilterHasData() {
630 return filter_.get() && filter_->stream_data_len(); 646 return filter_.get() && filter_->stream_data_len();
631 } 647 }
632 648
633 void URLRequestJob::UpdatePacketReadTimes() { 649 void URLRequestJob::UpdatePacketReadTimes() {
634 } 650 }
635 651
636 } // namespace net 652 } // namespace net
OLDNEW
« chrome/browser/net/passive_log_collector.cc ('K') | « net/socket/tcp_client_socket_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698