diff options
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_http_job.cc | 5 | ||||
-rw-r--r-- | net/url_request/url_request_job.cc | 8 | ||||
-rw-r--r-- | net/url_request/url_request_job.h | 8 | ||||
-rw-r--r-- | net/url_request/url_request_job_metrics.cc | 5 | ||||
-rw-r--r-- | net/url_request/url_request_job_metrics.h | 2 |
5 files changed, 19 insertions, 9 deletions
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 657af1b..cf380de 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -204,10 +204,7 @@ bool URLRequestHttpJob::GetContentEncodings( } if (!encoding_types->empty()) { - std::string mime_type; - GetMimeType(&mime_type); - // TODO(jar): Need to change this call to use the FilterContext interfaces. - Filter::FixupEncodingTypes(IsSdchResponse(), mime_type, encoding_types); + Filter::FixupEncodingTypes(*this, encoding_types); } return !encoding_types->empty(); } diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 2873ae2..4075ede 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -28,7 +28,8 @@ URLRequestJob::URLRequestJob(URLRequest* request) read_buffer_(NULL), read_buffer_len_(0), has_handled_response_(false), - expected_content_size_(-1) { + expected_content_size_(-1), + filter_input_byte_count_(0) { is_profiling_ = request->enable_profiling(); if (is_profiling()) { metrics_.reset(new URLRequestJobMetrics()); @@ -86,6 +87,10 @@ void URLRequestJob::ContinueDespiteLastError() { NOTREACHED(); } +int64 URLRequestJob::GetByteReadCount() const { + return filter_input_byte_count_ ; +} + bool URLRequestJob::GetURL(GURL* gurl) const { if (!request_) return false; @@ -505,6 +510,7 @@ void URLRequestJob::RecordBytesRead(int bytes_read) { ++(metrics_->number_of_read_IO_); metrics_->total_bytes_read_ += bytes_read; } + filter_input_byte_count_ += bytes_read; g_url_request_job_tracker.OnBytesRead(this, bytes_read); } diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 121519e..f99ffdf 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h @@ -195,10 +195,11 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob>, // FilterContext methods: // These methods are not applicable to all connections. virtual bool GetMimeType(std::string* mime_type) const { return false; } + virtual int64 GetByteReadCount() const; virtual bool GetURL(GURL* gurl) const; virtual base::Time GetRequestTime() const; virtual bool IsCachedContent() const; - virtual int GetInputStreambufferSize() const { return kFilterBufSize; } + virtual int GetInputStreamBufferSize() const { return kFilterBufSize; } protected: // Notifies the job that headers have been received. @@ -315,6 +316,11 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob>, // Expected content size int64 expected_content_size_; + // Total number of bytes read from network (or cache) and and typically handed + // to filter to process. Used to histogram compression ratios, and error + // recovery scenarios in filters. + int64 filter_input_byte_count_; + DISALLOW_COPY_AND_ASSIGN(URLRequestJob); }; diff --git a/net/url_request/url_request_job_metrics.cc b/net/url_request/url_request_job_metrics.cc index 69a0605..eea21fa 100644 --- a/net/url_request/url_request_job_metrics.cc +++ b/net/url_request/url_request_job_metrics.cc @@ -23,8 +23,9 @@ void URLRequestJobMetrics::AppendText(std::wstring* text) { TimeDelta elapsed = end_time_ - start_time_; StringAppendF(text, - L"; total bytes read = %d; read calls = %d; time = %lld ms;", - total_bytes_read_, number_of_read_IO_, elapsed.InMilliseconds()); + L"; total bytes read = %ld; read calls = %d; time = %lld ms;", + static_cast<long>(total_bytes_read_), + number_of_read_IO_, elapsed.InMilliseconds()); if (success_) { text->append(L" success."); diff --git a/net/url_request/url_request_job_metrics.h b/net/url_request/url_request_job_metrics.h index 42108db..11ee288 100644 --- a/net/url_request/url_request_job_metrics.h +++ b/net/url_request/url_request_job_metrics.h @@ -34,7 +34,7 @@ class URLRequestJobMetrics { base::TimeTicks end_time_; // Total number of bytes the job reads from underline IO. - int total_bytes_read_; + int64 total_bytes_read_; // Number of IO read operations the job issues. int number_of_read_IO_; |