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..a914f9e22ccabf9fe136d2d050fe8b0cac14a8a4 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 kHasBeenDeleted = |
+ 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(kHasBeenDeleted); |
} |
IndexedDBDispatcher* IndexedDBDispatcher::ThreadSpecificInstance() { |
+ if (g_idb_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) { |
+ 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(); |