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

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

Issue 596083005: DatabaseBackend should not post a task to an already terminated database thread (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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/DatabaseContext.h ('k') | Source/modules/webdatabase/DatabaseTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webdatabase/DatabaseContext.cpp
diff --git a/Source/modules/webdatabase/DatabaseContext.cpp b/Source/modules/webdatabase/DatabaseContext.cpp
index 456087abd8cf1966d3cf3df6aa1164b1affae824..b327f4c395b29d23963d714de3ca851644af63f4 100644
--- a/Source/modules/webdatabase/DatabaseContext.cpp
+++ b/Source/modules/webdatabase/DatabaseContext.cpp
@@ -165,6 +165,11 @@ DatabaseThread* DatabaseContext::databaseThread()
return m_databaseThread.get();
}
+bool DatabaseContext::databaseThreadAvailable()
+{
+ return databaseThread() && !m_hasRequestedTermination;
+}
+
void DatabaseContext::stopDatabases()
{
// Though we initiate termination of the DatabaseThread here in
@@ -177,7 +182,7 @@ void DatabaseContext::stopDatabases()
// m_databaseThread RefPtr destructor will deref and delete the
// DatabaseThread.
- if (m_databaseThread && !m_hasRequestedTermination) {
+ if (databaseThreadAvailable()) {
TaskSynchronizer sync;
m_databaseThread->requestTermination(&sync);
m_hasRequestedTermination = true;
« no previous file with comments | « Source/modules/webdatabase/DatabaseContext.h ('k') | Source/modules/webdatabase/DatabaseTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698