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

Unified Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 10052005: Add DCHECK to ensure IndexedDBDispatcher doesn't get re-created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: improved comment Created 8 years, 8 months 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 | « content/common/indexed_db/indexed_db_dispatcher.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « content/common/indexed_db/indexed_db_dispatcher.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698