diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 09:51:34 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 09:51:34 +0000 |
commit | 1ade3f8634a12b3b149b5016d01a9b8b8c5979c5 (patch) | |
tree | d7647caa2218316eec4b591e4e4ffa251a39f2ca /remoting/host/policy_hack | |
parent | 1c98fddccecfa323f49bfe80c1c387be22494613 (diff) | |
download | chromium_src-1ade3f8634a12b3b149b5016d01a9b8b8c5979c5.zip chromium_src-1ade3f8634a12b3b149b5016d01a9b8b8c5979c5.tar.gz chromium_src-1ade3f8634a12b3b149b5016d01a9b8b8c5979c5.tar.bz2 |
Remove all but one use of WeakPtrFactory::DetachFromThread.
This CL changes WeakPtr in the following ways:
* Changes thread-bindings semantics so that WeakPtrs only become bound when the first one is dereferenced, or the owning factory invalidates them.
* Removes WeakPtrFactory::DetachFromThread.
* Renames SupportsWeakPtr::DetachFromThread to DetachFromThreadHack.
Calling code changes to allow this:
* Unnecessary DetachFromThread() calls removed from PluginInfoMessageFilter, DhcpProxyScript[Adapter]FetcherWin and (Chromoting's) PolicyWatcherLinux.
* DetachFromThread() calls rendered unnecessary by change in binding semantics removed from IOThread, SearchProviderInstallData, RuleRegistryWithCache and GLSurfaceGlx.
WebGraphicsContext3DInProcessCommandBufferImpl uses the re-named DetachFromThreadHack() - bug 234964 tracks work to remove that use.
BUG=232143, 234964
Review URL: https://chromiumcodereview.appspot.com/14299011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/policy_hack')
-rw-r--r-- | remoting/host/policy_hack/policy_watcher_linux.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/remoting/host/policy_hack/policy_watcher_linux.cc b/remoting/host/policy_hack/policy_watcher_linux.cc index 641af9c..f3cffea 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: |