OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/init_proxy_resolver.h" | 5 #include "net/proxy/init_proxy_resolver.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "net/base/net_log.h" | 11 #include "net/base/net_log.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/proxy/proxy_config.h" | 13 #include "net/proxy/proxy_config.h" |
14 #include "net/proxy/proxy_resolver.h" | 14 #include "net/proxy/proxy_resolver.h" |
15 #include "net/proxy/proxy_script_fetcher.h" | 15 #include "net/proxy/proxy_script_fetcher.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 InitProxyResolver::InitProxyResolver(ProxyResolver* resolver, | 19 InitProxyResolver::InitProxyResolver(ProxyResolver* resolver, |
20 ProxyScriptFetcher* proxy_script_fetcher) | 20 ProxyScriptFetcher* proxy_script_fetcher, |
| 21 NetLog* net_log) |
21 : resolver_(resolver), | 22 : resolver_(resolver), |
22 proxy_script_fetcher_(proxy_script_fetcher), | 23 proxy_script_fetcher_(proxy_script_fetcher), |
23 ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_( | 24 ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_( |
24 this, &InitProxyResolver::OnIOCompletion)), | 25 this, &InitProxyResolver::OnIOCompletion)), |
25 user_callback_(NULL), | 26 user_callback_(NULL), |
26 current_pac_url_index_(0u), | 27 current_pac_url_index_(0u), |
27 next_state_(STATE_NONE) { | 28 next_state_(STATE_NONE), |
| 29 net_log_(BoundNetLog::Make( |
| 30 net_log, NetLog::SOURCE_INIT_PROXY_RESOLVER)) { |
28 } | 31 } |
29 | 32 |
30 InitProxyResolver::~InitProxyResolver() { | 33 InitProxyResolver::~InitProxyResolver() { |
31 if (next_state_ != STATE_NONE) | 34 if (next_state_ != STATE_NONE) |
32 Cancel(); | 35 Cancel(); |
33 } | 36 } |
34 | 37 |
35 int InitProxyResolver::Init(const ProxyConfig& config, | 38 int InitProxyResolver::Init(const ProxyConfig& config, |
36 CompletionCallback* callback, | 39 CompletionCallback* callback) { |
37 const BoundNetLog& net_log) { | |
38 DCHECK_EQ(STATE_NONE, next_state_); | 40 DCHECK_EQ(STATE_NONE, next_state_); |
39 DCHECK(callback); | 41 DCHECK(callback); |
40 DCHECK(config.MayRequirePACResolver()); | 42 DCHECK(config.MayRequirePACResolver()); |
41 DCHECK(!net_log_.net_log()); | |
42 | |
43 net_log_ = net_log; | |
44 | 43 |
45 net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER, NULL); | 44 net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER, NULL); |
46 | 45 |
47 pac_urls_ = BuildPacUrlsFallbackList(config); | 46 pac_urls_ = BuildPacUrlsFallbackList(config); |
48 DCHECK(!pac_urls_.empty()); | 47 DCHECK(!pac_urls_.empty()); |
49 | 48 |
50 next_state_ = GetStartState(); | 49 next_state_ = GetStartState(); |
51 | 50 |
52 int rv = DoLoop(OK); | 51 int rv = DoLoop(OK); |
53 if (rv == ERR_IO_PENDING) | 52 if (rv == ERR_IO_PENDING) |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 break; | 224 break; |
226 default: | 225 default: |
227 NOTREACHED(); | 226 NOTREACHED(); |
228 break; | 227 break; |
229 } | 228 } |
230 | 229 |
231 DidCompleteInit(); | 230 DidCompleteInit(); |
232 } | 231 } |
233 | 232 |
234 } // namespace net | 233 } // namespace net |
OLD | NEW |