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

Side by Side Diff: net/proxy/proxy_service.cc

Issue 545633002: Don't preresolve DNS if a fixed proxy configuration is in place. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo no-longer-needed virtual marking Created 6 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
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/proxy/proxy_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 } 973 }
974 974
975 int ProxyService::ResolveProxy(const GURL& raw_url, 975 int ProxyService::ResolveProxy(const GURL& raw_url,
976 int load_flags, 976 int load_flags,
977 ProxyInfo* result, 977 ProxyInfo* result,
978 const net::CompletionCallback& callback, 978 const net::CompletionCallback& callback,
979 PacRequest** pac_request, 979 PacRequest** pac_request,
980 NetworkDelegate* network_delegate, 980 NetworkDelegate* network_delegate,
981 const BoundNetLog& net_log) { 981 const BoundNetLog& net_log) {
982 DCHECK(CalledOnValidThread()); 982 DCHECK(CalledOnValidThread());
983 DCHECK(!callback.is_null());
984 983
985 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); 984 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE);
986 985
987 // Notify our polling-based dependencies that a resolve is taking place. 986 // Notify our polling-based dependencies that a resolve is taking place.
988 // This way they can schedule their polls in response to network activity. 987 // This way they can schedule their polls in response to network activity.
989 config_service_->OnLazyPoll(); 988 config_service_->OnLazyPoll();
990 if (script_poller_.get()) 989 if (script_poller_.get())
991 script_poller_->OnLazyPoll(); 990 script_poller_->OnLazyPoll();
992 991
993 if (current_state_ == STATE_NONE) 992 if (current_state_ == STATE_NONE)
994 ApplyProxyConfigIfAvailable(); 993 ApplyProxyConfigIfAvailable();
995 994
996 // Strip away any reference fragments and the username/password, as they 995 // Strip away any reference fragments and the username/password, as they
997 // are not relevant to proxy resolution. 996 // are not relevant to proxy resolution.
998 GURL url = SimplifyUrlForRequest(raw_url); 997 GURL url = SimplifyUrlForRequest(raw_url);
999 998
1000 // Check if the request can be completed right away. (This is the case when 999 // Check if the request can be completed right away. (This is the case when
1001 // using a direct connection for example). 1000 // using a direct connection for example).
1002 int rv = TryToCompleteSynchronously(url, load_flags, 1001 int rv = TryToCompleteSynchronously(url, load_flags,
1003 network_delegate, result); 1002 network_delegate, result);
1004 if (rv != ERR_IO_PENDING) 1003 if (rv != ERR_IO_PENDING)
1005 return DidFinishResolvingProxy(url, load_flags, network_delegate, 1004 return DidFinishResolvingProxy(url, load_flags, network_delegate,
1006 result, rv, net_log); 1005 result, rv, net_log);
1007 1006
1007 if (callback.is_null())
1008 return ERR_IO_PENDING;
eroman 2014/09/23 20:50:42 This calling contract is confusing, since the requ
bemasc 2014/09/24 18:34:37 Done.
1009
1008 scoped_refptr<PacRequest> req( 1010 scoped_refptr<PacRequest> req(
1009 new PacRequest(this, url, load_flags, network_delegate, 1011 new PacRequest(this, url, load_flags, network_delegate,
1010 result, callback, net_log)); 1012 result, callback, net_log));
1011 1013
1012 if (current_state_ == STATE_READY) { 1014 if (current_state_ == STATE_READY) {
1013 // Start the resolve request. 1015 // Start the resolve request.
1014 rv = req->Start(); 1016 rv = req->Start();
1015 if (rv != ERR_IO_PENDING) 1017 if (rv != ERR_IO_PENDING)
1016 return req->QueryDidComplete(rv); 1018 return req->QueryDidComplete(rv);
1017 } else { 1019 } else {
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 State previous_state = ResetProxyConfig(false); 1556 State previous_state = ResetProxyConfig(false);
1555 if (previous_state != STATE_NONE) 1557 if (previous_state != STATE_NONE)
1556 ApplyProxyConfigIfAvailable(); 1558 ApplyProxyConfigIfAvailable();
1557 } 1559 }
1558 1560
1559 void ProxyService::OnDNSChanged() { 1561 void ProxyService::OnDNSChanged() {
1560 OnIPAddressChanged(); 1562 OnIPAddressChanged();
1561 } 1563 }
1562 1564
1563 } // namespace net 1565 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698