diff options
author | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 22:55:27 +0000 |
---|---|---|
committer | rsimha@chromium.org <rsimha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-20 22:55:27 +0000 |
commit | 221c38d7550e73529ca5b006a47d2026f6f5535e (patch) | |
tree | a74cba95453b5ad7f5fbf978d842977f80be53a2 /net/base/network_config_watcher_mac.cc | |
parent | bff3df1ed12fd08156019b2f4f2df5b7e8b14f2d (diff) | |
download | chromium_src-221c38d7550e73529ca5b006a47d2026f6f5535e.zip chromium_src-221c38d7550e73529ca5b006a47d2026f6f5535e.tar.gz chromium_src-221c38d7550e73529ca5b006a47d2026f6f5535e.tar.bz2 |
Allow IO operations in destructor of net::NetworkConfigWatcherMacThread
The destructor of net::NetworkConfigWatcherMacThread ends up calling
PlatformThread::Join(), an operation that needs to be done only from an
IO thread. This currently causes a DCHECK to fire in base::ThreadRestrictions.
The bug was discovered by running the sync integration tests on a mac trybot.
The tests create Profile objects during setup, that indirectly call
~NetworkConfigWatcherMacThread() from their destructors.
This patch allows IO operations in ~NetworkConfigWatcherMacThread()
using a ScopedAllowIO.
BUG=70190
TEST=sync_integration_tests
Review URL: http://codereview.chromium.org/6353008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_config_watcher_mac.cc')
-rw-r--r-- | net/base/network_config_watcher_mac.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc index afec17d..5cc41b1 100644 --- a/net/base/network_config_watcher_mac.cc +++ b/net/base/network_config_watcher_mac.cc @@ -11,6 +11,7 @@ #include "base/compiler_specific.h" #include "base/threading/thread.h" #include "base/mac/scoped_cftyperef.h" +#include "base/threading/thread_restrictions.h" namespace net { @@ -54,10 +55,18 @@ NetworkConfigWatcherMacThread::NetworkConfigWatcherMacThread( ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {} NetworkConfigWatcherMacThread::~NetworkConfigWatcherMacThread() { + // Allow IO because Stop() calls PlatformThread::Join(), which is a blocking + // operation. This is expected during shutdown. + base::ThreadRestrictions::ScopedAllowIO allow_io; + Stop(); } void NetworkConfigWatcherMacThread::Init() { + // Disallow IO to make sure NetworkConfigWatcherMacThread's helper thread does + // not perform blocking operations. + base::ThreadRestrictions::SetIOAllowed(false); + // TODO(willchan): Look to see if there's a better signal for when it's ok to // initialize this, rather than just delaying it by a fixed time. const int kInitializationDelayMS = 1000; |