Chromium Code Reviews| Index: content/common/indexed_db/indexed_db_dispatcher.cc |
| diff --git a/content/common/indexed_db/indexed_db_dispatcher.cc b/content/common/indexed_db/indexed_db_dispatcher.cc |
| index b778ca2749435b088d526c2f638fe52794084979..ece670d3c7cbe2acc7b736492260bbf69a90733b 100644 |
| --- a/content/common/indexed_db/indexed_db_dispatcher.cc |
| +++ b/content/common/indexed_db/indexed_db_dispatcher.cc |
| @@ -38,6 +38,9 @@ static base::LazyInstance<ThreadLocalPointer<IndexedDBDispatcher> >::Leaky |
| namespace { |
| +IndexedDBDispatcher* const HAS_BEEN_DELETED = |
|
jam
2012/04/11 23:35:01
nit: constants in google style guide are of the fo
dgrogan
2012/04/12 02:27:49
Done.
|
| + reinterpret_cast<IndexedDBDispatcher*>(0x1); |
| + |
| int32 CurrentWorkerId() { |
| return WorkerTaskRunner::Instance()->CurrentWorkerId(); |
| } |
| @@ -51,10 +54,14 @@ IndexedDBDispatcher::IndexedDBDispatcher() { |
| } |
| IndexedDBDispatcher::~IndexedDBDispatcher() { |
| - g_idb_dispatcher_tls.Pointer()->Set(NULL); |
| + g_idb_dispatcher_tls.Pointer()->Set(HAS_BEEN_DELETED); |
| } |
| IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance() { |
| + if (g_idb_dispatcher_tls.Pointer()->Get() == HAS_BEEN_DELETED) { |
| + NOTREACHED() << "Re-instantiating TLS IndexedDBDispatcher."; |
| + g_idb_dispatcher_tls.Pointer()->Set(NULL); |
| + } |
| if (g_idb_dispatcher_tls.Pointer()->Get()) |
| return g_idb_dispatcher_tls.Pointer()->Get(); |