Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: remoting/host/policy_hack/policy_watcher_linux.cc

Issue 14299011: Remove all but one use of WeakPtrFactory::DetachFromThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove checks for death with correct error, which seem to fail on iOS Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/policy_hack/policy_watcher_linux.cc
diff --git a/remoting/host/policy_hack/policy_watcher_linux.cc b/remoting/host/policy_hack/policy_watcher_linux.cc
index 641af9c065cdc07a17450cbb5ae2e3dcd19b992b..f3cffeafb0f0f7a050b8bb1f3085f7d6f4ff0434 100644
--- a/remoting/host/policy_hack/policy_watcher_linux.cc
+++ b/remoting/host/policy_hack/policy_watcher_linux.cc
@@ -51,12 +51,6 @@ class PolicyWatcherLinux : public PolicyWatcher {
: PolicyWatcher(task_runner),
config_dir_(config_dir),
weak_factory_(this) {
- // Detach the factory because we ensure that only the policy thread ever
- // calls methods on this. Also, the API contract of having to call
- // StopWatching() (which signals completion) after StartWatching()
- // before this object can be destructed ensures there are no users of
- // this object before it is destructed.
- weak_factory_.DetachFromThread();
}
virtual ~PolicyWatcherLinux() {}
@@ -84,8 +78,12 @@ class PolicyWatcherLinux : public PolicyWatcher {
virtual void StopWatchingInternal() OVERRIDE {
DCHECK(OnPolicyWatcherThread());
- // Cancel any inflight requests.
+
+ // Stop watching for changes to files in the policies directory.
watcher_.reset();
+
+ // Orphan any pending OnFilePathChanged tasks.
+ weak_factory_.InvalidateWeakPtrs();
}
private:
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win.cc ('k') | ui/gl/gl_surface_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698