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.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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
18 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
20 #include "base/values.h" | 21 #include "base/values.h" |
21 #include "net/base/completion_callback.h" | 22 #include "net/base/completion_callback.h" |
22 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
23 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // The reason we play this game is that our signal for detecting network | 68 // The reason we play this game is that our signal for detecting network |
68 // changes (NetworkChangeNotifier) may fire *before* the system's networking | 69 // changes (NetworkChangeNotifier) may fire *before* the system's networking |
69 // dependencies are fully configured. This is a problem since it means if | 70 // dependencies are fully configured. This is a problem since it means if |
70 // we were to run proxy auto-config right away, it could fail due to spurious | 71 // we were to run proxy auto-config right away, it could fail due to spurious |
71 // DNS failures. (see http://crbug.com/50779 for more details.) | 72 // DNS failures. (see http://crbug.com/50779 for more details.) |
72 // | 73 // |
73 // By adding the wait window, we give things a better chance to get properly | 74 // By adding the wait window, we give things a better chance to get properly |
74 // set up. Network failures can happen at any time though, so we additionally | 75 // set up. Network failures can happen at any time though, so we additionally |
75 // poll the PAC script for changes, which will allow us to recover from these | 76 // poll the PAC script for changes, which will allow us to recover from these |
76 // sorts of problems. | 77 // sorts of problems. |
77 const int64 kDelayAfterNetworkChangesMs = 2000; | 78 const int64_t kDelayAfterNetworkChangesMs = 2000; |
78 | 79 |
79 // This is the default policy for polling the PAC script. | 80 // This is the default policy for polling the PAC script. |
80 // | 81 // |
81 // In response to a failure, the poll intervals are: | 82 // In response to a failure, the poll intervals are: |
82 // 0: 8 seconds (scheduled on timer) | 83 // 0: 8 seconds (scheduled on timer) |
83 // 1: 32 seconds | 84 // 1: 32 seconds |
84 // 2: 2 minutes | 85 // 2: 2 minutes |
85 // 3+: 4 hours | 86 // 3+: 4 hours |
86 // | 87 // |
87 // In response to a success, the poll intervals are: | 88 // In response to a success, the poll intervals are: |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 State previous_state = ResetProxyConfig(false); | 1648 State previous_state = ResetProxyConfig(false); |
1648 if (previous_state != STATE_NONE) | 1649 if (previous_state != STATE_NONE) |
1649 ApplyProxyConfigIfAvailable(); | 1650 ApplyProxyConfigIfAvailable(); |
1650 } | 1651 } |
1651 | 1652 |
1652 void ProxyService::OnDNSChanged() { | 1653 void ProxyService::OnDNSChanged() { |
1653 OnIPAddressChanged(); | 1654 OnIPAddressChanged(); |
1654 } | 1655 } |
1655 | 1656 |
1656 } // namespace net | 1657 } // namespace net |
OLD | NEW |