| 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 | |
| 56 bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) const { | 51 bool URLRequestSimpleJob::GetMimeType(std::string* mime_type) const { |
| 57 *mime_type = mime_type_; | 52 *mime_type = mime_type_; |
| 58 return true; | 53 return true; |
| 59 } | 54 } |
| 60 | 55 |
| 61 bool URLRequestSimpleJob::GetCharset(std::string* charset) { | 56 bool URLRequestSimpleJob::GetCharset(std::string* charset) { |
| 62 *charset = charset_; | 57 *charset = charset_; |
| 63 return true; | 58 return true; |
| 64 } | 59 } |
| 65 | 60 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 next_data_offset_ = byte_range_.first_byte_position(); | 145 next_data_offset_ = byte_range_.first_byte_position(); |
| 151 set_expected_content_size(byte_range_.last_byte_position() - | 146 set_expected_content_size(byte_range_.last_byte_position() - |
| 152 next_data_offset_ + 1); | 147 next_data_offset_ + 1); |
| 153 NotifyHeadersComplete(); | 148 NotifyHeadersComplete(); |
| 154 } else { | 149 } else { |
| 155 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | 150 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); |
| 156 } | 151 } |
| 157 } | 152 } |
| 158 | 153 |
| 159 } // namespace net | 154 } // namespace net |
| OLD | NEW |