diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 01:53:38 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 01:53:38 +0000 |
commit | e87b8bbba3be2889489f5b4a94b708e67d0b8c67 (patch) | |
tree | 9c2b2210ab14fbc784b04cd0467d8f8b5bf42c68 /chrome/browser/browser_thread.cc | |
parent | 244c1077eef720364e988b013c1b9b7bd5776a92 (diff) | |
download | chromium_src-e87b8bbba3be2889489f5b4a94b708e67d0b8c67.zip chromium_src-e87b8bbba3be2889489f5b4a94b708e67d0b8c67.tar.gz chromium_src-e87b8bbba3be2889489f5b4a94b708e67d0b8c67.tar.bz2 |
Reland r65996. Disallows Singletons on non-joinable thread.
Test breakages caused by this change have been fixed here or in other changelists.
BUG=61753
TEST=none
Review URL: http://codereview.chromium.org/5024003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_thread.cc')
-rw-r--r-- | chrome/browser/browser_thread.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/browser_thread.cc b/chrome/browser/browser_thread.cc index 7ba53e0..e6edfd0 100644 --- a/chrome/browser/browser_thread.cc +++ b/chrome/browser/browser_thread.cc @@ -6,6 +6,7 @@ #include "base/message_loop.h" #include "base/message_loop_proxy.h" +#include "base/thread_restrictions.h" // Friendly names for the well-known threads. static const char* browser_thread_names[BrowserThread::ID_COUNT] = { @@ -112,6 +113,11 @@ bool BrowserThread::IsWellKnownThread(ID identifier) { // static bool BrowserThread::CurrentlyOn(ID identifier) { + // We shouldn't use MessageLoop::current() since it uses LazyInstance which + // may be deleted by ~AtExitManager when a WorkerPool thread calls this + // function. + // http://crbug.com/63678 + base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; AutoLock lock(lock_); DCHECK(identifier >= 0 && identifier < ID_COUNT); return browser_threads_[identifier] && @@ -160,6 +166,11 @@ bool BrowserThread::PostNonNestableDelayedTask( // static bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { + // We shouldn't use MessageLoop::current() since it uses LazyInstance which + // may be deleted by ~AtExitManager when a WorkerPool thread calls this + // function. + // http://crbug.com/63678 + base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; MessageLoop* cur_message_loop = MessageLoop::current(); for (int i = 0; i < ID_COUNT; ++i) { if (browser_threads_[i] && |