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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 job_->GetCharset(charset); | 505 job_->GetCharset(charset); |
506 } | 506 } |
507 | 507 |
508 int URLRequest::GetResponseCode() const { | 508 int URLRequest::GetResponseCode() const { |
509 DCHECK(job_.get()); | 509 DCHECK(job_.get()); |
510 return job_->GetResponseCode(); | 510 return job_->GetResponseCode(); |
511 } | 511 } |
512 | 512 |
513 void URLRequest::SetLoadFlags(int flags) { | 513 void URLRequest::SetLoadFlags(int flags) { |
514 if ((load_flags_ & LOAD_IGNORE_LIMITS) != (flags & LOAD_IGNORE_LIMITS)) { | 514 if ((load_flags_ & LOAD_IGNORE_LIMITS) != (flags & LOAD_IGNORE_LIMITS)) { |
515 DCHECK(!job_); | 515 DCHECK(!job_.get()); |
516 DCHECK(flags & LOAD_IGNORE_LIMITS); | 516 DCHECK(flags & LOAD_IGNORE_LIMITS); |
517 DCHECK_EQ(priority_, MAXIMUM_PRIORITY); | 517 DCHECK_EQ(priority_, MAXIMUM_PRIORITY); |
518 } | 518 } |
519 load_flags_ = flags; | 519 load_flags_ = flags; |
520 | 520 |
521 // This should be a no-op given the above DCHECKs, but do this | 521 // This should be a no-op given the above DCHECKs, but do this |
522 // anyway for release mode. | 522 // anyway for release mode. |
523 if ((load_flags_ & LOAD_IGNORE_LIMITS) != 0) | 523 if ((load_flags_ & LOAD_IGNORE_LIMITS) != 0) |
524 SetPriority(MAXIMUM_PRIORITY); | 524 SetPriority(MAXIMUM_PRIORITY); |
525 } | 525 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 if (delegate_ && !notified_before_network_start_) { | 832 if (delegate_ && !notified_before_network_start_) { |
833 OnCallToDelegate(); | 833 OnCallToDelegate(); |
834 delegate_->OnBeforeNetworkStart(this, defer); | 834 delegate_->OnBeforeNetworkStart(this, defer); |
835 if (!*defer) | 835 if (!*defer) |
836 OnCallToDelegateComplete(); | 836 OnCallToDelegateComplete(); |
837 notified_before_network_start_ = true; | 837 notified_before_network_start_ = true; |
838 } | 838 } |
839 } | 839 } |
840 | 840 |
841 void URLRequest::ResumeNetworkStart() { | 841 void URLRequest::ResumeNetworkStart() { |
842 DCHECK(job_); | 842 DCHECK(job_.get()); |
843 DCHECK(notified_before_network_start_); | 843 DCHECK(notified_before_network_start_); |
844 | 844 |
845 OnCallToDelegateComplete(); | 845 OnCallToDelegateComplete(); |
846 job_->ResumeNetworkStart(); | 846 job_->ResumeNetworkStart(); |
847 } | 847 } |
848 | 848 |
849 void URLRequest::NotifyResponseStarted() { | 849 void URLRequest::NotifyResponseStarted() { |
850 int net_error = OK; | 850 int net_error = OK; |
851 if (!status_.is_success()) | 851 if (!status_.is_success()) |
852 net_error = status_.error(); | 852 net_error = status_.error(); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 new base::debug::StackTrace(NULL, 0); | 1220 new base::debug::StackTrace(NULL, 0); |
1221 *stack_trace_copy = stack_trace; | 1221 *stack_trace_copy = stack_trace; |
1222 stack_trace_.reset(stack_trace_copy); | 1222 stack_trace_.reset(stack_trace_copy); |
1223 } | 1223 } |
1224 | 1224 |
1225 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1225 const base::debug::StackTrace* URLRequest::stack_trace() const { |
1226 return stack_trace_.get(); | 1226 return stack_trace_.get(); |
1227 } | 1227 } |
1228 | 1228 |
1229 } // namespace net | 1229 } // namespace net |
OLD | NEW |