| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 base::Unretained(this))), | 221 base::Unretained(this))), |
| 222 has_notified_completion_(false), | 222 has_notified_completion_(false), |
| 223 received_response_content_length_(0), | 223 received_response_content_length_(0), |
| 224 creation_time_(base::TimeTicks::Now()) { | 224 creation_time_(base::TimeTicks::Now()) { |
| 225 SIMPLE_STATS_COUNTER("URLRequestCount"); | 225 SIMPLE_STATS_COUNTER("URLRequestCount"); |
| 226 | 226 |
| 227 // Sanity check out environment. | 227 // Sanity check out environment. |
| 228 DCHECK(base::MessageLoop::current()) | 228 DCHECK(base::MessageLoop::current()) |
| 229 << "The current base::MessageLoop must exist"; | 229 << "The current base::MessageLoop must exist"; |
| 230 | 230 |
| 231 DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)) | |
| 232 << "" | |
| 233 "The current base::MessageLoop must be TYPE_IO"; | |
| 234 | |
| 235 CHECK(context); | 231 CHECK(context); |
| 236 context->url_requests()->insert(this); | 232 context->url_requests()->insert(this); |
| 237 | 233 |
| 238 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); | 234 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); |
| 239 } | 235 } |
| 240 | 236 |
| 241 URLRequest::URLRequest(const GURL& url, | 237 URLRequest::URLRequest(const GURL& url, |
| 242 Delegate* delegate, | 238 Delegate* delegate, |
| 243 const URLRequestContext* context, | 239 const URLRequestContext* context, |
| 244 NetworkDelegate* network_delegate) | 240 NetworkDelegate* network_delegate) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 261 base::Unretained(this))), | 257 base::Unretained(this))), |
| 262 has_notified_completion_(false), | 258 has_notified_completion_(false), |
| 263 received_response_content_length_(0), | 259 received_response_content_length_(0), |
| 264 creation_time_(base::TimeTicks::Now()) { | 260 creation_time_(base::TimeTicks::Now()) { |
| 265 SIMPLE_STATS_COUNTER("URLRequestCount"); | 261 SIMPLE_STATS_COUNTER("URLRequestCount"); |
| 266 | 262 |
| 267 // Sanity check out environment. | 263 // Sanity check out environment. |
| 268 DCHECK(base::MessageLoop::current()) | 264 DCHECK(base::MessageLoop::current()) |
| 269 << "The current base::MessageLoop must exist"; | 265 << "The current base::MessageLoop must exist"; |
| 270 | 266 |
| 271 DCHECK(base::MessageLoop::current()->IsType(base::MessageLoop::TYPE_IO)) | |
| 272 << "" | |
| 273 "The current base::MessageLoop must be TYPE_IO"; | |
| 274 | |
| 275 CHECK(context); | 267 CHECK(context); |
| 276 context->url_requests()->insert(this); | 268 context->url_requests()->insert(this); |
| 277 | 269 |
| 278 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); | 270 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); |
| 279 } | 271 } |
| 280 | 272 |
| 281 URLRequest::~URLRequest() { | 273 URLRequest::~URLRequest() { |
| 282 Cancel(); | 274 Cancel(); |
| 283 | 275 |
| 284 if (network_delegate_) { | 276 if (network_delegate_) { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 new base::debug::StackTrace(NULL, 0); | 1090 new base::debug::StackTrace(NULL, 0); |
| 1099 *stack_trace_copy = stack_trace; | 1091 *stack_trace_copy = stack_trace; |
| 1100 stack_trace_.reset(stack_trace_copy); | 1092 stack_trace_.reset(stack_trace_copy); |
| 1101 } | 1093 } |
| 1102 | 1094 |
| 1103 const base::debug::StackTrace* URLRequest::stack_trace() const { | 1095 const base::debug::StackTrace* URLRequest::stack_trace() const { |
| 1104 return stack_trace_.get(); | 1096 return stack_trace_.get(); |
| 1105 } | 1097 } |
| 1106 | 1098 |
| 1107 } // namespace net | 1099 } // namespace net |
| OLD | NEW |