| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 last_poll_time_ = base::TimeTicks::Now(); | 90 last_poll_time_ = base::TimeTicks::Now(); |
| 91 poll_task_outstanding_ = true; | 91 poll_task_outstanding_ = true; |
| 92 poll_task_queued_ = false; | 92 poll_task_queued_ = false; |
| 93 base::WorkerPool::PostTask( | 93 base::WorkerPool::PostTask( |
| 94 FROM_HERE, | 94 FROM_HERE, |
| 95 base::Bind(&Core::PollOnWorkerThread, this, get_config_func_), | 95 base::Bind(&Core::PollOnWorkerThread, this, get_config_func_), |
| 96 true); | 96 true); |
| 97 } | 97 } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 friend class base::RefCountedThreadSafe<Core>; |
| 101 ~Core() {} |
| 102 |
| 100 void PollOnWorkerThread(GetConfigFunction func) { | 103 void PollOnWorkerThread(GetConfigFunction func) { |
| 101 ProxyConfig config; | 104 ProxyConfig config; |
| 102 func(&config); | 105 func(&config); |
| 103 | 106 |
| 104 base::AutoLock l(lock_); | 107 base::AutoLock l(lock_); |
| 105 if (origin_loop_proxy_) { | 108 if (origin_loop_proxy_) { |
| 106 origin_loop_proxy_->PostTask( | 109 origin_loop_proxy_->PostTask( |
| 107 FROM_HERE, | 110 FROM_HERE, |
| 108 base::Bind(&Core::GetConfigCompleted, this, config)); | 111 base::Bind(&Core::GetConfigCompleted, this, config)); |
| 109 } | 112 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 186 |
| 184 PollingProxyConfigService::~PollingProxyConfigService() { | 187 PollingProxyConfigService::~PollingProxyConfigService() { |
| 185 core_->Orphan(); | 188 core_->Orphan(); |
| 186 } | 189 } |
| 187 | 190 |
| 188 void PollingProxyConfigService::CheckForChangesNow() { | 191 void PollingProxyConfigService::CheckForChangesNow() { |
| 189 core_->CheckForChangesNow(); | 192 core_->CheckForChangesNow(); |
| 190 } | 193 } |
| 191 | 194 |
| 192 } // namespace net | 195 } // namespace net |
| OLD | NEW |