| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "net/proxy/proxy_resolver_js_bindings.h" | 29 #include "net/proxy/proxy_resolver_js_bindings.h" |
| 30 #include "net/proxy/proxy_resolver_v8.h" | 30 #include "net/proxy/proxy_resolver_v8.h" |
| 31 #include "net/proxy/single_threaded_proxy_resolver.h" | 31 #include "net/proxy/single_threaded_proxy_resolver.h" |
| 32 #include "net/url_request/url_request_context.h" | 32 #include "net/url_request/url_request_context.h" |
| 33 | 33 |
| 34 using base::TimeDelta; | 34 using base::TimeDelta; |
| 35 using base::TimeTicks; | 35 using base::TimeTicks; |
| 36 | 36 |
| 37 namespace net { | 37 namespace net { |
| 38 | 38 |
| 39 static const size_t kMaxNumLoadLogEntries = 100; |
| 40 |
| 39 // Config getter that fails every time. | 41 // Config getter that fails every time. |
| 40 class ProxyConfigServiceNull : public ProxyConfigService { | 42 class ProxyConfigServiceNull : public ProxyConfigService { |
| 41 public: | 43 public: |
| 42 // ProxyConfigService implementation: | 44 // ProxyConfigService implementation: |
| 43 virtual int GetProxyConfig(ProxyConfig* config) { | 45 virtual int GetProxyConfig(ProxyConfig* config) { |
| 44 return ERR_NOT_IMPLEMENTED; | 46 return ERR_NOT_IMPLEMENTED; |
| 45 } | 47 } |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 // Proxy resolver that fails every time. | 50 // Proxy resolver that fails every time. |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 if (config_.MayRequirePACResolver()) { | 625 if (config_.MayRequirePACResolver()) { |
| 624 // Since InitProxyResolver will be playing around with the proxy resolver | 626 // Since InitProxyResolver will be playing around with the proxy resolver |
| 625 // as it tests the parsing of various PAC scripts, make sure there is | 627 // as it tests the parsing of various PAC scripts, make sure there is |
| 626 // nothing in-flight in |resolver_|. These paused requests are resumed by | 628 // nothing in-flight in |resolver_|. These paused requests are resumed by |
| 627 // OnInitProxyResolverComplete(). | 629 // OnInitProxyResolverComplete(). |
| 628 SuspendAllPendingRequests(); | 630 SuspendAllPendingRequests(); |
| 629 | 631 |
| 630 init_proxy_resolver_.reset( | 632 init_proxy_resolver_.reset( |
| 631 new InitProxyResolver(resolver_.get(), proxy_script_fetcher_.get())); | 633 new InitProxyResolver(resolver_.get(), proxy_script_fetcher_.get())); |
| 632 | 634 |
| 633 init_proxy_resolver_log_ = new LoadLog; | 635 init_proxy_resolver_log_ = new LoadLog(kMaxNumLoadLogEntries); |
| 634 | 636 |
| 635 int rv = init_proxy_resolver_->Init( | 637 int rv = init_proxy_resolver_->Init( |
| 636 config_, &init_proxy_resolver_callback_, init_proxy_resolver_log_); | 638 config_, &init_proxy_resolver_callback_, init_proxy_resolver_log_); |
| 637 | 639 |
| 638 if (rv != ERR_IO_PENDING) | 640 if (rv != ERR_IO_PENDING) |
| 639 OnInitProxyResolverComplete(rv); | 641 OnInitProxyResolverComplete(rv); |
| 640 } | 642 } |
| 641 } | 643 } |
| 642 | 644 |
| 643 void ProxyService::UpdateConfigIfOld() { | 645 void ProxyService::UpdateConfigIfOld() { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 OnCompletion(result_); | 795 OnCompletion(result_); |
| 794 } | 796 } |
| 795 } | 797 } |
| 796 | 798 |
| 797 void SyncProxyServiceHelper::OnCompletion(int rv) { | 799 void SyncProxyServiceHelper::OnCompletion(int rv) { |
| 798 result_ = rv; | 800 result_ = rv; |
| 799 event_.Signal(); | 801 event_.Signal(); |
| 800 } | 802 } |
| 801 | 803 |
| 802 } // namespace net | 804 } // namespace net |
| OLD | NEW |