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

Unified Diff: chrome/browser/browser_thread.cc

Issue 5242002: Reland 66791 (change was innocent)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « ceee/ie/broker/executors_manager.h ('k') | net/base/dns_reload_timer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_thread.cc
===================================================================
--- chrome/browser/browser_thread.cc (revision 66806)
+++ chrome/browser/browser_thread.cc (working copy)
@@ -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 @@
// 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 @@
// 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] &&
« no previous file with comments | « ceee/ie/broker/executors_manager.h ('k') | net/base/dns_reload_timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698