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

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

Issue 122453002: Allows deferral of a URLRequest just before talking to the network, at (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated content-length in test to actual length Created 6 years, 11 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
« no previous file with comments | « net/url_request/url_request_job.h ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 GURL redirect_url = deferred_redirect_url_; 206 GURL redirect_url = deferred_redirect_url_;
207 int redirect_status_code = deferred_redirect_status_code_; 207 int redirect_status_code = deferred_redirect_status_code_;
208 208
209 deferred_redirect_url_ = GURL(); 209 deferred_redirect_url_ = GURL();
210 deferred_redirect_status_code_ = -1; 210 deferred_redirect_status_code_ = -1;
211 211
212 FollowRedirect(redirect_url, redirect_status_code); 212 FollowRedirect(redirect_url, redirect_status_code);
213 } 213 }
214 214
215 void URLRequestJob::ResumeNetworkStart() {
216 // This should only be called for HTTP Jobs, and implemented in the derived
217 // class.
218 NOTREACHED();
219 }
220
215 bool URLRequestJob::GetMimeType(std::string* mime_type) const { 221 bool URLRequestJob::GetMimeType(std::string* mime_type) const {
216 return false; 222 return false;
217 } 223 }
218 224
219 int URLRequestJob::GetResponseCode() const { 225 int URLRequestJob::GetResponseCode() const {
220 return -1; 226 return -1;
221 } 227 }
222 228
223 HostPortPair URLRequestJob::GetSocketAddress() const { 229 HostPortPair URLRequestJob::GetSocketAddress() const {
224 return HostPortPair(); 230 return HostPortPair();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return request_->CanSetCookie(cookie_line, options); 274 return request_->CanSetCookie(cookie_line, options);
269 } 275 }
270 276
271 bool URLRequestJob::CanEnablePrivacyMode() const { 277 bool URLRequestJob::CanEnablePrivacyMode() const {
272 if (!request_) 278 if (!request_)
273 return false; // The request was destroyed, so there is no more work to do. 279 return false; // The request was destroyed, so there is no more work to do.
274 280
275 return request_->CanEnablePrivacyMode(); 281 return request_->CanEnablePrivacyMode();
276 } 282 }
277 283
284 void URLRequestJob::NotifyBeforeNetworkStart(bool* defer) {
285 if (!request_)
286 return;
287
288 request_->NotifyBeforeNetworkStart(defer);
289 }
290
278 void URLRequestJob::NotifyHeadersComplete() { 291 void URLRequestJob::NotifyHeadersComplete() {
279 if (!request_ || !request_->has_delegate()) 292 if (!request_ || !request_->has_delegate())
280 return; // The request was destroyed, so there is no more work to do. 293 return; // The request was destroyed, so there is no more work to do.
281 294
282 if (has_handled_response_) 295 if (has_handled_response_)
283 return; 296 return;
284 297
285 DCHECK(!request_->status().is_io_pending()); 298 DCHECK(!request_->status().is_io_pending());
286 299
287 // Initialize to the current time, and let the subclass optionally override 300 // Initialize to the current time, and let the subclass optionally override
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 } 740 }
728 741
729 bool URLRequestJob::FilterHasData() { 742 bool URLRequestJob::FilterHasData() {
730 return filter_.get() && filter_->stream_data_len(); 743 return filter_.get() && filter_->stream_data_len();
731 } 744 }
732 745
733 void URLRequestJob::UpdatePacketReadTimes() { 746 void URLRequestJob::UpdatePacketReadTimes() {
734 } 747 }
735 748
736 } // namespace net 749 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_job.h ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698