Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: net/url_request/url_request_simple_job.cc

Issue 1281943002: Reland https://codereview.chromium.org/1271593002/ which was reverted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/url_request/url_request_simple_job.h ('k') | net/url_request/url_request_simple_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698