Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: net/url_request/url_request.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: platform specific dchecks should be platform specific Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 220 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
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(MessageLoop::current()) << "The current MessageLoop must exist"; 228 DCHECK(MessageLoop::current()) << "The current MessageLoop must exist";
229 229
230 DCHECK(MessageLoop::current()->IsType(MessageLoop::TYPE_IO)) << ""
231 "The current MessageLoop must be TYPE_IO";
232
233 CHECK(context); 230 CHECK(context);
234 context->url_requests()->insert(this); 231 context->url_requests()->insert(this);
235 232
236 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); 233 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
237 } 234 }
238 235
239 URLRequest::URLRequest(const GURL& url, 236 URLRequest::URLRequest(const GURL& url,
240 Delegate* delegate, 237 Delegate* delegate,
241 const URLRequestContext* context, 238 const URLRequestContext* context,
242 NetworkDelegate* network_delegate) 239 NetworkDelegate* network_delegate)
(...skipping 15 matching lines...) Expand all
258 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 255 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
259 base::Unretained(this))), 256 base::Unretained(this))),
260 has_notified_completion_(false), 257 has_notified_completion_(false),
261 received_response_content_length_(0), 258 received_response_content_length_(0),
262 creation_time_(base::TimeTicks::Now()) { 259 creation_time_(base::TimeTicks::Now()) {
263 SIMPLE_STATS_COUNTER("URLRequestCount"); 260 SIMPLE_STATS_COUNTER("URLRequestCount");
264 261
265 // Sanity check out environment. 262 // Sanity check out environment.
266 DCHECK(MessageLoop::current()) << "The current MessageLoop must exist"; 263 DCHECK(MessageLoop::current()) << "The current MessageLoop must exist";
267 264
268 DCHECK(MessageLoop::current()->IsType(MessageLoop::TYPE_IO)) << ""
269 "The current MessageLoop must be TYPE_IO";
270
271 CHECK(context); 265 CHECK(context);
272 context->url_requests()->insert(this); 266 context->url_requests()->insert(this);
273 267
274 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE); 268 net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
275 } 269 }
276 270
277 URLRequest::~URLRequest() { 271 URLRequest::~URLRequest() {
278 Cancel(); 272 Cancel();
279 273
280 if (network_delegate_) { 274 if (network_delegate_) {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 new base::debug::StackTrace(NULL, 0); 1088 new base::debug::StackTrace(NULL, 0);
1095 *stack_trace_copy = stack_trace; 1089 *stack_trace_copy = stack_trace;
1096 stack_trace_.reset(stack_trace_copy); 1090 stack_trace_.reset(stack_trace_copy);
1097 } 1091 }
1098 1092
1099 const base::debug::StackTrace* URLRequest::stack_trace() const { 1093 const base::debug::StackTrace* URLRequest::stack_trace() const {
1100 return stack_trace_.get(); 1094 return stack_trace_.get();
1101 } 1095 }
1102 1096
1103 } // namespace net 1097 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698