OLD | NEW |
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.h" | 5 #include "net/url_request/url_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 StartJob(URLRequestJobManager::GetInstance()->CreateJob( | 512 StartJob(URLRequestJobManager::GetInstance()->CreateJob( |
513 this, network_delegate_)); | 513 this, network_delegate_)); |
514 } | 514 } |
515 | 515 |
516 /////////////////////////////////////////////////////////////////////////////// | 516 /////////////////////////////////////////////////////////////////////////////// |
517 | 517 |
518 URLRequest::URLRequest(const GURL& url, | 518 URLRequest::URLRequest(const GURL& url, |
519 RequestPriority priority, | 519 RequestPriority priority, |
520 Delegate* delegate, | 520 Delegate* delegate, |
521 const URLRequestContext* context, | 521 const URLRequestContext* context, |
522 CookieStore* cookie_store, | |
523 NetworkDelegate* network_delegate) | 522 NetworkDelegate* network_delegate) |
524 : context_(context), | 523 : context_(context), |
525 network_delegate_(network_delegate ? network_delegate | 524 network_delegate_(network_delegate ? network_delegate |
526 : context->network_delegate()), | 525 : context->network_delegate()), |
527 net_log_(BoundNetLog::Make(context->net_log(), | 526 net_log_( |
528 NetLog::SOURCE_URL_REQUEST)), | 527 BoundNetLog::Make(context->net_log(), NetLog::SOURCE_URL_REQUEST)), |
529 url_chain_(1, url), | 528 url_chain_(1, url), |
530 method_("GET"), | 529 method_("GET"), |
531 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), | 530 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), |
532 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), | 531 first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL), |
533 load_flags_(LOAD_NORMAL), | 532 load_flags_(LOAD_NORMAL), |
534 delegate_(delegate), | 533 delegate_(delegate), |
535 is_pending_(false), | 534 is_pending_(false), |
536 is_redirecting_(false), | 535 is_redirecting_(false), |
537 redirect_limit_(kMaxRedirects), | 536 redirect_limit_(kMaxRedirects), |
538 priority_(priority), | 537 priority_(priority), |
539 identifier_(GenerateURLRequestIdentifier()), | 538 identifier_(GenerateURLRequestIdentifier()), |
540 calling_delegate_(false), | 539 calling_delegate_(false), |
541 use_blocked_by_as_load_param_(false), | 540 use_blocked_by_as_load_param_(false), |
542 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, | 541 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, |
543 base::Unretained(this))), | 542 base::Unretained(this))), |
544 has_notified_completion_(false), | 543 has_notified_completion_(false), |
545 received_response_content_length_(0), | 544 received_response_content_length_(0), |
546 creation_time_(base::TimeTicks::Now()), | 545 creation_time_(base::TimeTicks::Now()), |
547 notified_before_network_start_(false), | 546 notified_before_network_start_(false) { |
548 cookie_store_(cookie_store ? cookie_store : context->cookie_store()) { | |
549 // Sanity check out environment. | 547 // Sanity check out environment. |
550 DCHECK(base::MessageLoop::current()) | 548 DCHECK(base::MessageLoop::current()) |
551 << "The current base::MessageLoop must exist"; | 549 << "The current base::MessageLoop must exist"; |
552 | 550 |
553 context->url_requests()->insert(this); | 551 context->url_requests()->insert(this); |
554 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); | 552 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); |
555 } | 553 } |
556 | 554 |
557 void URLRequest::BeforeRequestComplete(int error) { | 555 void URLRequest::BeforeRequestComplete(int error) { |
558 DCHECK(!job_.get()); | 556 DCHECK(!job_.get()); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 new base::debug::StackTrace(NULL, 0); | 1188 new base::debug::StackTrace(NULL, 0); |
1191 *stack_trace_copy = stack_trace; | 1189 *stack_trace_copy = stack_trace; |
1192 stack_trace_.reset(stack_trace_copy); | 1190 stack_trace_.reset(stack_trace_copy); |
1193 } | 1191 } |
1194 | 1192 |
1195 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1193 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1196 return stack_trace_.get(); | 1194 return stack_trace_.get(); |
1197 } | 1195 } |
1198 | 1196 |
1199 } // namespace net | 1197 } // namespace net |
OLD | NEW |