| 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/polling_proxy_config_service.h" | 5 #include "net/proxy/polling_proxy_config_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 if (!origin_task_runner_.get()) | 119 if (!origin_task_runner_.get()) |
| 120 return; // Was orphaned (parent has already been destroyed). | 120 return; // Was orphaned (parent has already been destroyed). |
| 121 | 121 |
| 122 DCHECK(origin_task_runner_->BelongsToCurrentThread()); | 122 DCHECK(origin_task_runner_->BelongsToCurrentThread()); |
| 123 | 123 |
| 124 if (!has_config_ || !last_config_.Equals(config)) { | 124 if (!has_config_ || !last_config_.Equals(config)) { |
| 125 // If the configuration has changed, notify the observers. | 125 // If the configuration has changed, notify the observers. |
| 126 has_config_ = true; | 126 has_config_ = true; |
| 127 last_config_ = config; | 127 last_config_ = config; |
| 128 FOR_EACH_OBSERVER(Observer, observers_, | 128 for (auto& observer : observers_) |
| 129 OnProxyConfigChanged(config, | 129 observer.OnProxyConfigChanged(config, ProxyConfigService::CONFIG_VALID); |
| 130 ProxyConfigService::CONFIG_VALID)); | |
| 131 } | 130 } |
| 132 | 131 |
| 133 if (poll_task_queued_) | 132 if (poll_task_queued_) |
| 134 CheckForChangesNow(); | 133 CheckForChangesNow(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 void LazyInitializeOriginLoop() { | 136 void LazyInitializeOriginLoop() { |
| 138 // TODO(eroman): Really this should be done in the constructor, but right | 137 // TODO(eroman): Really this should be done in the constructor, but right |
| 139 // now chrome is constructing the ProxyConfigService on the | 138 // now chrome is constructing the ProxyConfigService on the |
| 140 // UI thread so we can't cache the IO thread for the purpose | 139 // UI thread so we can't cache the IO thread for the purpose |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 184 |
| 186 PollingProxyConfigService::~PollingProxyConfigService() { | 185 PollingProxyConfigService::~PollingProxyConfigService() { |
| 187 core_->Orphan(); | 186 core_->Orphan(); |
| 188 } | 187 } |
| 189 | 188 |
| 190 void PollingProxyConfigService::CheckForChangesNow() { | 189 void PollingProxyConfigService::CheckForChangesNow() { |
| 191 core_->CheckForChangesNow(); | 190 core_->CheckForChangesNow(); |
| 192 } | 191 } |
| 193 | 192 |
| 194 } // namespace net | 193 } // namespace net |
| OLD | NEW |