OLD | NEW |
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_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 // FilterContext implementation. | 187 // FilterContext implementation. |
188 bool GetMimeType(std::string* mime_type) const override; | 188 bool GetMimeType(std::string* mime_type) const override; |
189 bool GetURL(GURL* gurl) const override; | 189 bool GetURL(GURL* gurl) const override; |
190 base::Time GetRequestTime() const override; | 190 base::Time GetRequestTime() const override; |
191 bool IsCachedContent() const override; | 191 bool IsCachedContent() const override; |
192 SdchManager::DictionarySet* SdchDictionariesAdvertised() const override; | 192 SdchManager::DictionarySet* SdchDictionariesAdvertised() const override; |
193 int64_t GetByteReadCount() const override; | 193 int64_t GetByteReadCount() const override; |
194 int GetResponseCode() const override; | 194 int GetResponseCode() const override; |
195 const URLRequestContext* GetURLRequestContext() const override; | 195 const URLRequestContext* GetURLRequestContext() const override; |
196 void RecordPacketStats(StatisticSelector statistic) const override; | 196 void RecordPacketStats(StatisticSelector statistic) const override; |
197 const BoundNetLog& GetNetLog() const override; | 197 const NetLogWithSource& GetNetLog() const override; |
198 | 198 |
199 private: | 199 private: |
200 URLRequestHttpJob* job_; | 200 URLRequestHttpJob* job_; |
201 | 201 |
202 // URLRequestHttpJob may be detached from URLRequest, but we still need to | 202 // URLRequestHttpJob may be detached from URLRequest, but we still need to |
203 // return something. | 203 // return something. |
204 BoundNetLog dummy_log_; | 204 NetLogWithSource dummy_log_; |
205 | 205 |
206 DISALLOW_COPY_AND_ASSIGN(HttpFilterContext); | 206 DISALLOW_COPY_AND_ASSIGN(HttpFilterContext); |
207 }; | 207 }; |
208 | 208 |
209 URLRequestHttpJob::HttpFilterContext::HttpFilterContext(URLRequestHttpJob* job) | 209 URLRequestHttpJob::HttpFilterContext::HttpFilterContext(URLRequestHttpJob* job) |
210 : job_(job) { | 210 : job_(job) { |
211 DCHECK(job_); | 211 DCHECK(job_); |
212 } | 212 } |
213 | 213 |
214 URLRequestHttpJob::HttpFilterContext::~HttpFilterContext() { | 214 URLRequestHttpJob::HttpFilterContext::~HttpFilterContext() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 const URLRequestContext* | 250 const URLRequestContext* |
251 URLRequestHttpJob::HttpFilterContext::GetURLRequestContext() const { | 251 URLRequestHttpJob::HttpFilterContext::GetURLRequestContext() const { |
252 return job_->request() ? job_->request()->context() : NULL; | 252 return job_->request() ? job_->request()->context() : NULL; |
253 } | 253 } |
254 | 254 |
255 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( | 255 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( |
256 StatisticSelector statistic) const { | 256 StatisticSelector statistic) const { |
257 job_->RecordPacketStats(statistic); | 257 job_->RecordPacketStats(statistic); |
258 } | 258 } |
259 | 259 |
260 const BoundNetLog& URLRequestHttpJob::HttpFilterContext::GetNetLog() const { | 260 const NetLogWithSource& URLRequestHttpJob::HttpFilterContext::GetNetLog() |
| 261 const { |
261 return job_->request() ? job_->request()->net_log() : dummy_log_; | 262 return job_->request() ? job_->request()->net_log() : dummy_log_; |
262 } | 263 } |
263 | 264 |
264 // TODO(darin): make sure the port blocking code is not lost | 265 // TODO(darin): make sure the port blocking code is not lost |
265 // static | 266 // static |
266 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, | 267 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request, |
267 NetworkDelegate* network_delegate, | 268 NetworkDelegate* network_delegate, |
268 const std::string& scheme) { | 269 const std::string& scheme) { |
269 DCHECK(scheme == "http" || scheme == "https" || scheme == "ws" || | 270 DCHECK(scheme == "http" || scheme == "https" || scheme == "ws" || |
270 scheme == "wss"); | 271 scheme == "wss"); |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 // Notify NetworkQualityEstimator. | 1601 // Notify NetworkQualityEstimator. |
1601 if (request()) { | 1602 if (request()) { |
1602 NetworkQualityEstimator* network_quality_estimator = | 1603 NetworkQualityEstimator* network_quality_estimator = |
1603 request()->context()->network_quality_estimator(); | 1604 request()->context()->network_quality_estimator(); |
1604 if (network_quality_estimator) | 1605 if (network_quality_estimator) |
1605 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1606 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
1606 } | 1607 } |
1607 } | 1608 } |
1608 | 1609 |
1609 } // namespace net | 1610 } // namespace net |
OLD | NEW |