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

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

Issue 2404313002: Remove MessageLoop::current() from url_request.cc. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/message_loop/message_loop.h"
16 #include "base/profiler/scoped_tracker.h" 15 #include "base/profiler/scoped_tracker.h"
17 #include "base/rand_util.h" 16 #include "base/rand_util.h"
18 #include "base/stl_util.h" 17 #include "base/stl_util.h"
19 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
20 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "net/base/auth.h" 22 #include "net/base/auth.h"
23 #include "net/base/host_port_pair.h" 23 #include "net/base/host_port_pair.h"
24 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
25 #include "net/base/load_timing_info.h" 25 #include "net/base/load_timing_info.h"
26 #include "net/base/net_errors.h" 26 #include "net/base/net_errors.h"
27 #include "net/base/network_change_notifier.h" 27 #include "net/base/network_change_notifier.h"
28 #include "net/base/network_delegate.h" 28 #include "net/base/network_delegate.h"
29 #include "net/base/upload_data_stream.h" 29 #include "net/base/upload_data_stream.h"
30 #include "net/http/http_response_headers.h" 30 #include "net/http/http_response_headers.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 priority_(priority), 571 priority_(priority),
572 identifier_(GenerateURLRequestIdentifier()), 572 identifier_(GenerateURLRequestIdentifier()),
573 calling_delegate_(false), 573 calling_delegate_(false),
574 use_blocked_by_as_load_param_(false), 574 use_blocked_by_as_load_param_(false),
575 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 575 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
576 base::Unretained(this))), 576 base::Unretained(this))),
577 has_notified_completion_(false), 577 has_notified_completion_(false),
578 received_response_content_length_(0), 578 received_response_content_length_(0),
579 creation_time_(base::TimeTicks::Now()) { 579 creation_time_(base::TimeTicks::Now()) {
580 // Sanity check out environment. 580 // Sanity check out environment.
581 DCHECK(base::MessageLoop::current()) 581 DCHECK(base::ThreadTaskRunnerHandle::IsSet());
582 << "The current base::MessageLoop must exist";
583 582
584 context->url_requests()->insert(this); 583 context->url_requests()->insert(this);
585 net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE); 584 net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE);
586 } 585 }
587 586
588 void URLRequest::BeforeRequestComplete(int error) { 587 void URLRequest::BeforeRequestComplete(int error) {
589 DCHECK(!job_.get()); 588 DCHECK(!job_.get());
590 DCHECK_NE(ERR_IO_PENDING, error); 589 DCHECK_NE(ERR_IO_PENDING, error);
591 590
592 // Check that there are no callbacks to already canceled requests. 591 // Check that there are no callbacks to already canceled requests.
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 out->clear(); 1223 out->clear();
1225 } 1224 }
1226 1225
1227 void URLRequest::set_status(URLRequestStatus status) { 1226 void URLRequest::set_status(URLRequestStatus status) {
1228 DCHECK(status_.is_io_pending() || status_.is_success() || 1227 DCHECK(status_.is_io_pending() || status_.is_success() ||
1229 (!status.is_success() && !status.is_io_pending())); 1228 (!status.is_success() && !status.is_io_pending()));
1230 status_ = status; 1229 status_ = status;
1231 } 1230 }
1232 1231
1233 } // namespace net 1232 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698