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.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 void URLRequestJob::Kill() { | 48 void URLRequestJob::Kill() { |
49 weak_factory_.InvalidateWeakPtrs(); | 49 weak_factory_.InvalidateWeakPtrs(); |
50 // Make sure the request is notified that we are done. We assume that the | 50 // Make sure the request is notified that we are done. We assume that the |
51 // request took care of setting its error status before calling Kill. | 51 // request took care of setting its error status before calling Kill. |
52 if (request_) | 52 if (request_) |
53 NotifyCanceled(); | 53 NotifyCanceled(); |
54 } | 54 } |
55 | 55 |
56 void URLRequestJob::DetachRequest() { | 56 void URLRequestJob::DetachRequest() { |
57 request_ = NULL; | 57 request_ = NULL; |
| 58 OnDetachRequest(); |
58 } | 59 } |
59 | 60 |
60 // This function calls ReadData to get stream data. If a filter exists, passes | 61 // This function calls ReadData to get stream data. If a filter exists, passes |
61 // the data to the attached filter. Then returns the output from filter back to | 62 // the data to the attached filter. Then returns the output from filter back to |
62 // the caller. | 63 // the caller. |
63 bool URLRequestJob::Read(IOBuffer* buf, int buf_size, int *bytes_read) { | 64 bool URLRequestJob::Read(IOBuffer* buf, int buf_size, int *bytes_read) { |
64 bool rv = false; | 65 bool rv = false; |
65 | 66 |
66 DCHECK_LT(buf_size, 1000000); // Sanity check. | 67 DCHECK_LT(buf_size, 1000000); // Sanity check. |
67 DCHECK(buf); | 68 DCHECK(buf); |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 } | 699 } |
699 | 700 |
700 bool URLRequestJob::FilterHasData() { | 701 bool URLRequestJob::FilterHasData() { |
701 return filter_.get() && filter_->stream_data_len(); | 702 return filter_.get() && filter_->stream_data_len(); |
702 } | 703 } |
703 | 704 |
704 void URLRequestJob::UpdatePacketReadTimes() { | 705 void URLRequestJob::UpdatePacketReadTimes() { |
705 } | 706 } |
706 | 707 |
707 } // namespace net | 708 } // namespace net |
OLD | NEW |