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

Unified Diff: Source/modules/webdatabase/DatabaseManager.cpp

Issue 930793002: Merge 190021 "Web SQL: Termiante database thread before finalizi..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2272/
Patch Set: Created 5 years, 10 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 | « Source/modules/webdatabase/DatabaseManager.h ('k') | Source/web/WebKit.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webdatabase/DatabaseManager.cpp
===================================================================
--- Source/modules/webdatabase/DatabaseManager.cpp (revision 190224)
+++ Source/modules/webdatabase/DatabaseManager.cpp (working copy)
@@ -44,13 +44,26 @@
namespace blink {
+static DatabaseManager* s_databaseManager;
+
DatabaseManager& DatabaseManager::manager()
{
ASSERT(isMainThread());
- DEFINE_STATIC_LOCAL(DatabaseManager, dbManager, ());
- return dbManager;
+ if (!s_databaseManager)
+ s_databaseManager = new DatabaseManager();
+ return *s_databaseManager;
}
+void DatabaseManager::terminateDatabaseThread()
+{
+ ASSERT(isMainThread());
+ if (!s_databaseManager || s_databaseManager->m_contextMap.isEmpty())
+ return;
+ // We have at most one DatabaseContext, which is for the main thread.
+ ASSERT(s_databaseManager->m_contextMap.size() == 1);
+ (*s_databaseManager->m_contextMap.values().begin())->stopDatabases();
+}
+
DatabaseManager::DatabaseManager()
#if ENABLE(ASSERT)
: m_databaseContextRegisteredCount(0)
« no previous file with comments | « Source/modules/webdatabase/DatabaseManager.h ('k') | Source/web/WebKit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698