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_simple_job.h" | 5 #include "net/url_request/url_request_simple_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 void URLRequestSimpleJob::Start() { | 43 void URLRequestSimpleJob::Start() { |
44 // Start reading asynchronously so that all error reporting and data | 44 // Start reading asynchronously so that all error reporting and data |
45 // callbacks happen as they would for network requests. | 45 // callbacks happen as they would for network requests. |
46 base::ThreadTaskRunnerHandle::Get()->PostTask( | 46 base::ThreadTaskRunnerHandle::Get()->PostTask( |
47 FROM_HERE, | 47 FROM_HERE, |
48 base::Bind(&URLRequestSimpleJob::StartAsync, weak_factory_.GetWeakPtr())); | 48 base::Bind(&URLRequestSimpleJob::StartAsync, weak_factory_.GetWeakPtr())); |
49 } | 49 } |
50 | 50 |
| 51 void URLRequestSimpleJob::Kill() { |
| 52 weak_factory_.InvalidateWeakPtrs(); |
| 53 URLRangeRequestJob::Kill(); |
| 54 } |
| 55 |
51 bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) const { | 56 bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) const { |
52 *mime_type = mime_type_; | 57 *mime_type = mime_type_; |
53 return true; | 58 return true; |
54 } | 59 } |
55 | 60 |
56 bool URLRequestSimpleJob::GetCharset(std::string* charset) { | 61 bool URLRequestSimpleJob::GetCharset(std::string* charset) { |
57 *charset = charset_; | 62 *charset = charset_; |
58 return true; | 63 return true; |
59 } | 64 } |
60 | 65 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 next_data_offset_ = byte_range_.first_byte_position(); | 150 next_data_offset_ = byte_range_.first_byte_position(); |
146 set_expected_content_size(byte_range_.last_byte_position() - | 151 set_expected_content_size(byte_range_.last_byte_position() - |
147 next_data_offset_ + 1); | 152 next_data_offset_ + 1); |
148 NotifyHeadersComplete(); | 153 NotifyHeadersComplete(); |
149 } else { | 154 } else { |
150 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | 155 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); |
151 } | 156 } |
152 } | 157 } |
153 | 158 |
154 } // namespace net | 159 } // namespace net |
OLD | NEW |