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

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

Issue 1273813005: Revert of Fix cancellation of a pair of URLRequestJob subclasses (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
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
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
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