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

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

Issue 1126513002: Add ProxyResolverFactoryV8Tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-proxy-refactor
Patch Set: Created 5 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
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing_unittest.cc ('k') | 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/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/thread_task_runner_handle.h"
9 #include "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 #include "net/proxy/network_delegate_error_observer.h" 10 #include "net/proxy/network_delegate_error_observer.h"
11 #include "net/proxy/proxy_resolver.h" 11 #include "net/proxy/proxy_resolver.h"
12 #include "net/proxy/proxy_resolver_factory.h" 12 #include "net/proxy/proxy_resolver_factory.h"
13 #include "net/proxy/proxy_resolver_v8_tracing.h" 13 #include "net/proxy/proxy_resolver_v8_tracing.h"
14 #include "net/proxy/proxy_service.h" 14 #include "net/proxy/proxy_service.h"
15 15
16 namespace net { 16 namespace net {
17 namespace {
18
19 class ProxyResolverFactoryForV8Resolver : public LegacyProxyResolverFactory {
20 public:
21 explicit ProxyResolverFactoryForV8Resolver(HostResolver* host_resolver,
22 NetLog* net_log,
23 NetworkDelegate* network_delegate)
24 : LegacyProxyResolverFactory(true),
25 host_resolver_(host_resolver),
26 net_log_(net_log),
27 network_delegate_(network_delegate) {}
28
29 // LegacyProxyResolverFactory override.
30 scoped_ptr<ProxyResolver> CreateProxyResolver() override {
31 DCHECK(thread_checker_.CalledOnValidThread());
32 ProxyResolverErrorObserver* error_observer =
33 new NetworkDelegateErrorObserver(
34 network_delegate_, base::ThreadTaskRunnerHandle::Get().get());
35 return make_scoped_ptr(
36 new ProxyResolverV8Tracing(host_resolver_, error_observer, net_log_));
37 }
38
39 private:
40 HostResolver* const host_resolver_;
41 NetLog* const net_log_;
42 NetworkDelegate* const network_delegate_;
43
44 base::ThreadChecker thread_checker_;
45
46 DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryForV8Resolver);
47 };
48 } // namespace
49 17
50 // static 18 // static
51 ProxyService* CreateProxyServiceUsingV8ProxyResolver( 19 ProxyService* CreateProxyServiceUsingV8ProxyResolver(
52 ProxyConfigService* proxy_config_service, 20 ProxyConfigService* proxy_config_service,
53 ProxyScriptFetcher* proxy_script_fetcher, 21 ProxyScriptFetcher* proxy_script_fetcher,
54 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, 22 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
55 HostResolver* host_resolver, 23 HostResolver* host_resolver,
56 NetLog* net_log, 24 NetLog* net_log,
57 NetworkDelegate* network_delegate) { 25 NetworkDelegate* network_delegate) {
58 DCHECK(proxy_config_service); 26 DCHECK(proxy_config_service);
59 DCHECK(proxy_script_fetcher); 27 DCHECK(proxy_script_fetcher);
60 DCHECK(dhcp_proxy_script_fetcher); 28 DCHECK(dhcp_proxy_script_fetcher);
61 DCHECK(host_resolver); 29 DCHECK(host_resolver);
62 30
63 ProxyService* proxy_service = 31 ProxyService* proxy_service = new ProxyService(
64 new ProxyService(proxy_config_service, 32 proxy_config_service,
65 make_scoped_ptr(new ProxyResolverFactoryForV8Resolver( 33 make_scoped_ptr(new ProxyResolverFactoryV8Tracing(
66 host_resolver, net_log, network_delegate)), 34 host_resolver, net_log, ProxyResolver::LoadStateChangedCallback(),
67 net_log); 35 base::Bind(&NetworkDelegateErrorObserver::Create, network_delegate,
36 base::ThreadTaskRunnerHandle::Get()))),
37 net_log);
68 38
69 // Configure fetchers to use for PAC script downloads and auto-detect. 39 // Configure fetchers to use for PAC script downloads and auto-detect.
70 proxy_service->SetProxyScriptFetchers(proxy_script_fetcher, 40 proxy_service->SetProxyScriptFetchers(proxy_script_fetcher,
71 dhcp_proxy_script_fetcher); 41 dhcp_proxy_script_fetcher);
72 42
73 return proxy_service; 43 return proxy_service;
74 } 44 }
75 45
76 } // namespace net 46 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698