| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 URLRequest::InstanceTrackerNode::~InstanceTrackerNode() { | 353 URLRequest::InstanceTrackerNode::~InstanceTrackerNode() { |
| 354 InstanceTracker::Get()->Remove(this); | 354 InstanceTracker::Get()->Remove(this); |
| 355 } | 355 } |
| 356 | 356 |
| 357 /////////////////////////////////////////////////////////////////////////////// | 357 /////////////////////////////////////////////////////////////////////////////// |
| 358 | 358 |
| 359 void URLRequest::StartJob(URLRequestJob* job) { | 359 void URLRequest::StartJob(URLRequestJob* job) { |
| 360 DCHECK(!is_pending_); | 360 DCHECK(!is_pending_); |
| 361 DCHECK(!job_); | 361 DCHECK(!job_); |
| 362 | 362 |
| 363 net::LoadLog::BeginEvent(load_log_, net::LoadLog::TYPE_URL_REQUEST_START); |
| 364 |
| 363 job_ = job; | 365 job_ = job; |
| 364 job_->SetExtraRequestHeaders(extra_request_headers_); | 366 job_->SetExtraRequestHeaders(extra_request_headers_); |
| 365 | 367 |
| 366 if (upload_.get()) | 368 if (upload_.get()) |
| 367 job_->SetUpload(upload_.get()); | 369 job_->SetUpload(upload_.get()); |
| 368 | 370 |
| 369 is_pending_ = true; | 371 is_pending_ = true; |
| 370 | 372 |
| 371 response_info_.request_time = Time::Now(); | 373 response_info_.request_time = Time::Now(); |
| 372 response_info_.was_cached = false; | 374 response_info_.was_cached = false; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 void URLRequest::ReceivedRedirect(const GURL& location, bool* defer_redirect) { | 454 void URLRequest::ReceivedRedirect(const GURL& location, bool* defer_redirect) { |
| 453 URLRequestJob* job = GetJobManager()->MaybeInterceptRedirect(this, location); | 455 URLRequestJob* job = GetJobManager()->MaybeInterceptRedirect(this, location); |
| 454 if (job) { | 456 if (job) { |
| 455 RestartWithJob(job); | 457 RestartWithJob(job); |
| 456 } else if (delegate_) { | 458 } else if (delegate_) { |
| 457 delegate_->OnReceivedRedirect(this, location, defer_redirect); | 459 delegate_->OnReceivedRedirect(this, location, defer_redirect); |
| 458 } | 460 } |
| 459 } | 461 } |
| 460 | 462 |
| 461 void URLRequest::ResponseStarted() { | 463 void URLRequest::ResponseStarted() { |
| 464 net::LoadLog::EndEvent(load_log_, net::LoadLog::TYPE_URL_REQUEST_START); |
| 465 |
| 462 URLRequestJob* job = GetJobManager()->MaybeInterceptResponse(this); | 466 URLRequestJob* job = GetJobManager()->MaybeInterceptResponse(this); |
| 463 if (job) { | 467 if (job) { |
| 464 RestartWithJob(job); | 468 RestartWithJob(job); |
| 465 } else if (delegate_) { | 469 } else if (delegate_) { |
| 466 delegate_->OnResponseStarted(this); | 470 delegate_->OnResponseStarted(this); |
| 467 } | 471 } |
| 468 } | 472 } |
| 469 | 473 |
| 470 void URLRequest::FollowDeferredRedirect() { | 474 void URLRequest::FollowDeferredRedirect() { |
| 471 DCHECK(job_); | 475 DCHECK(job_); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { | 601 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { |
| 598 UserDataMap::const_iterator found = user_data_.find(key); | 602 UserDataMap::const_iterator found = user_data_.find(key); |
| 599 if (found != user_data_.end()) | 603 if (found != user_data_.end()) |
| 600 return found->second.get(); | 604 return found->second.get(); |
| 601 return NULL; | 605 return NULL; |
| 602 } | 606 } |
| 603 | 607 |
| 604 void URLRequest::SetUserData(const void* key, UserData* data) { | 608 void URLRequest::SetUserData(const void* key, UserData* data) { |
| 605 user_data_[key] = linked_ptr<UserData>(data); | 609 user_data_[key] = linked_ptr<UserData>(data); |
| 606 } | 610 } |
| OLD | NEW |