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_job.h" | 5 #include "net/url_request/url_request_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 // new one has none. This duplicates mozilla's behavior. | 312 // new one has none. This duplicates mozilla's behavior. |
313 if (url.is_valid() && url.has_ref() && !new_location.has_ref()) { | 313 if (url.is_valid() && url.has_ref() && !new_location.has_ref()) { |
314 GURL::Replacements replacements; | 314 GURL::Replacements replacements; |
315 // Reference the |ref| directly out of the original URL to avoid a | 315 // Reference the |ref| directly out of the original URL to avoid a |
316 // malloc. | 316 // malloc. |
317 replacements.SetRef(url.spec().data(), | 317 replacements.SetRef(url.spec().data(), |
318 url.parsed_for_possibly_invalid_spec().ref); | 318 url.parsed_for_possibly_invalid_spec().ref); |
319 new_location = new_location.ReplaceComponents(replacements); | 319 new_location = new_location.ReplaceComponents(replacements); |
320 } | 320 } |
321 | 321 |
322 // Tell lower-level layers to ignore the response body. This is | |
323 // both so the request is cached and to release the cache entry | |
rvargas (doing something else)
2013/09/17 19:53:25
nit: this comment ties this to the actual implemen
davidben
2013/09/17 22:16:04
Done.
| |
324 // for future requests to access. | |
325 DoneReading(); | |
326 | |
322 bool defer_redirect = false; | 327 bool defer_redirect = false; |
323 request_->NotifyReceivedRedirect(new_location, &defer_redirect); | 328 request_->NotifyReceivedRedirect(new_location, &defer_redirect); |
324 | 329 |
325 // Ensure that the request wasn't detached or destroyed in | 330 // Ensure that the request wasn't detached or destroyed in |
326 // NotifyReceivedRedirect | 331 // NotifyReceivedRedirect |
327 if (!request_ || !request_->has_delegate()) | 332 if (!request_ || !request_->has_delegate()) |
328 return; | 333 return; |
329 | 334 |
330 // If we were not cancelled, then maybe follow the redirect. | 335 // If we were not cancelled, then maybe follow the redirect. |
331 if (request_->status().is_success()) { | 336 if (request_->status().is_success()) { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
727 } | 732 } |
728 | 733 |
729 bool URLRequestJob::FilterHasData() { | 734 bool URLRequestJob::FilterHasData() { |
730 return filter_.get() && filter_->stream_data_len(); | 735 return filter_.get() && filter_->stream_data_len(); |
731 } | 736 } |
732 | 737 |
733 void URLRequestJob::UpdatePacketReadTimes() { | 738 void URLRequestJob::UpdatePacketReadTimes() { |
734 } | 739 } |
735 | 740 |
736 } // namespace net | 741 } // namespace net |
OLD | NEW |