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/proxy/proxy_service_v8.h" | 5 #include "net/proxy/proxy_service_v8.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/thread_task_runner_handle.h" |
8 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
9 #include "net/proxy/network_delegate_error_observer.h" | 10 #include "net/proxy/network_delegate_error_observer.h" |
10 #include "net/proxy/proxy_resolver.h" | 11 #include "net/proxy/proxy_resolver.h" |
11 #include "net/proxy/proxy_resolver_factory.h" | 12 #include "net/proxy/proxy_resolver_factory.h" |
12 #include "net/proxy/proxy_resolver_v8_tracing.h" | 13 #include "net/proxy/proxy_resolver_v8_tracing.h" |
13 #include "net/proxy/proxy_service.h" | 14 #include "net/proxy/proxy_service.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 namespace { | 17 namespace { |
17 | 18 |
18 class ProxyResolverFactoryForV8Resolver : public LegacyProxyResolverFactory { | 19 class ProxyResolverFactoryForV8Resolver : public LegacyProxyResolverFactory { |
19 public: | 20 public: |
20 explicit ProxyResolverFactoryForV8Resolver(HostResolver* host_resolver, | 21 explicit ProxyResolverFactoryForV8Resolver(HostResolver* host_resolver, |
21 NetLog* net_log, | 22 NetLog* net_log, |
22 NetworkDelegate* network_delegate) | 23 NetworkDelegate* network_delegate) |
23 : LegacyProxyResolverFactory(true), | 24 : LegacyProxyResolverFactory(true), |
24 host_resolver_(host_resolver), | 25 host_resolver_(host_resolver), |
25 net_log_(net_log), | 26 net_log_(net_log), |
26 network_delegate_(network_delegate) {} | 27 network_delegate_(network_delegate) {} |
27 | 28 |
28 // LegacyProxyResolverFactory override. | 29 // LegacyProxyResolverFactory override. |
29 scoped_ptr<ProxyResolver> CreateProxyResolver() override { | 30 scoped_ptr<ProxyResolver> CreateProxyResolver() override { |
30 DCHECK(thread_checker_.CalledOnValidThread()); | 31 DCHECK(thread_checker_.CalledOnValidThread()); |
31 ProxyResolverErrorObserver* error_observer = | 32 ProxyResolverErrorObserver* error_observer = |
32 new NetworkDelegateErrorObserver( | 33 new NetworkDelegateErrorObserver( |
33 network_delegate_, base::MessageLoopProxy::current().get()); | 34 network_delegate_, base::ThreadTaskRunnerHandle::Get().get()); |
34 return make_scoped_ptr( | 35 return make_scoped_ptr( |
35 new ProxyResolverV8Tracing(host_resolver_, error_observer, net_log_)); | 36 new ProxyResolverV8Tracing(host_resolver_, error_observer, net_log_)); |
36 } | 37 } |
37 | 38 |
38 private: | 39 private: |
39 HostResolver* const host_resolver_; | 40 HostResolver* const host_resolver_; |
40 NetLog* const net_log_; | 41 NetLog* const net_log_; |
41 NetworkDelegate* const network_delegate_; | 42 NetworkDelegate* const network_delegate_; |
42 | 43 |
43 base::ThreadChecker thread_checker_; | 44 base::ThreadChecker thread_checker_; |
(...skipping 22 matching lines...) Expand all Loading... |
66 net_log); | 67 net_log); |
67 | 68 |
68 // Configure fetchers to use for PAC script downloads and auto-detect. | 69 // Configure fetchers to use for PAC script downloads and auto-detect. |
69 proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, | 70 proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, |
70 dhcp_proxy_script_fetcher); | 71 dhcp_proxy_script_fetcher); |
71 | 72 |
72 return proxy_service; | 73 return proxy_service; |
73 } | 74 } |
74 | 75 |
75 } // namespace net | 76 } // namespace net |
OLD | NEW |