| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 response_info_.request_time = Time::Now(); | 259 response_info_.request_time = Time::Now(); |
| 260 response_info_.was_cached = false; | 260 response_info_.was_cached = false; |
| 261 | 261 |
| 262 // Don't allow errors to be sent from within Start(). | 262 // Don't allow errors to be sent from within Start(). |
| 263 // TODO(brettw) this may cause NotifyDone to be sent synchronously, | 263 // TODO(brettw) this may cause NotifyDone to be sent synchronously, |
| 264 // we probably don't want this: they should be sent asynchronously so | 264 // we probably don't want this: they should be sent asynchronously so |
| 265 // the caller does not get reentered. | 265 // the caller does not get reentered. |
| 266 job_->Start(); | 266 job_->Start(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void URLRequest::Restart() { | |
| 270 // Should only be called if the original job didn't make any progress. | |
| 271 DCHECK(job_ && !job_->has_response_started()); | |
| 272 RestartWithJob(GetJobManager()->CreateJob(this)); | |
| 273 } | |
| 274 | |
| 275 void URLRequest::RestartWithJob(URLRequestJob *job) { | 269 void URLRequest::RestartWithJob(URLRequestJob *job) { |
| 276 DCHECK(job->request() == this); | 270 DCHECK(job->request() == this); |
| 277 PrepareToRestart(); | 271 PrepareToRestart(); |
| 278 StartJob(job); | 272 StartJob(job); |
| 279 } | 273 } |
| 280 | 274 |
| 281 void URLRequest::Cancel() { | 275 void URLRequest::Cancel() { |
| 282 DoCancel(net::ERR_ABORTED, net::SSLInfo()); | 276 DoCancel(net::ERR_ABORTED, net::SSLInfo()); |
| 283 } | 277 } |
| 284 | 278 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 487 } |
| 494 | 488 |
| 495 #ifndef NDEBUG | 489 #ifndef NDEBUG |
| 496 | 490 |
| 497 URLRequestMetrics::~URLRequestMetrics() { | 491 URLRequestMetrics::~URLRequestMetrics() { |
| 498 DLOG_IF(WARNING, object_count != 0) << | 492 DLOG_IF(WARNING, object_count != 0) << |
| 499 "Leaking " << object_count << " URLRequest object(s)"; | 493 "Leaking " << object_count << " URLRequest object(s)"; |
| 500 } | 494 } |
| 501 | 495 |
| 502 #endif | 496 #endif |
| OLD | NEW |