Chromium Code Reviews| Index: remoting/host/policy_hack/policy_watcher.cc |
| diff --git a/remoting/host/policy_hack/policy_watcher.cc b/remoting/host/policy_hack/policy_watcher.cc |
| index e603cf5032459caaea20f88d40671df5d4aaa0cc..93a5497ac339c5567f2da72909718eef6081f9c9 100644 |
| --- a/remoting/host/policy_hack/policy_watcher.cc |
| +++ b/remoting/host/policy_hack/policy_watcher.cc |
| @@ -12,7 +12,6 @@ |
| #include "base/location.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/single_thread_task_runner.h" |
| -#include "base/synchronization/waitable_event.h" |
| #include "base/time/time.h" |
| #include "base/values.h" |
| #include "remoting/host/dns_blackhole_checker.h" |
| @@ -165,19 +164,23 @@ void PolicyWatcher::StartWatching(const PolicyCallback& policy_callback) { |
| StartWatchingInternal(); |
| } |
| -void PolicyWatcher::StopWatching(base::WaitableEvent* done) { |
| +void PolicyWatcher::StopWatching(const base::Closure& stopped_callback) { |
| if (!OnPolicyWatcherThread()) { |
|
Wez
2014/10/17 17:58:01
This kind of trampoline doesn't need a separate fu
kelvinp
2014/10/20 00:21:18
I use PostTaskAndReply as I want the callback is b
|
| - task_runner_->PostTask(FROM_HERE, |
| - base::Bind(&PolicyWatcher::StopWatching, |
| - base::Unretained(this), done)); |
| + task_runner_->PostTaskAndReply( |
| + FROM_HERE, |
| + base::Bind(&PolicyWatcher::StopWatchingOnPolicyWatcherThread, |
| + base::Unretained(this)), |
| + stopped_callback); |
| return; |
| } |
| + StopWatchingOnPolicyWatcherThread(); |
| + stopped_callback.Run(); |
| +} |
| +void PolicyWatcher::StopWatchingOnPolicyWatcherThread() { |
| StopWatchingInternal(); |
| weak_factory_.InvalidateWeakPtrs(); |
| policy_callback_.Reset(); |
| - |
| - done->Signal(); |
| } |
| void PolicyWatcher::ScheduleFallbackReloadTask() { |