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

Unified Diff: Source/modules/webdatabase/Database.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 | « no previous file | Source/modules/webdatabase/DatabaseContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webdatabase/Database.cpp
diff --git a/Source/modules/webdatabase/Database.cpp b/Source/modules/webdatabase/Database.cpp
index 632f94a102358ab407efaec6a9febe20a7cf26fb..dedc365679fc915602e8a55d2ba99185c9d094be 100644
--- a/Source/modules/webdatabase/Database.cpp
+++ b/Source/modules/webdatabase/Database.cpp
@@ -259,7 +259,7 @@ void Database::trace(Visitor* visitor)
bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseError& error, String& errorMessage)
{
TaskSynchronizer synchronizer;
- if (!databaseContext()->databaseThread() || databaseContext()->databaseThread()->terminationRequested(&synchronizer))
+ if (!databaseContext()->databaseThreadAvailable())
return false;
DatabaseTracker::tracker().prepareToOpenDatabase(this);
@@ -330,7 +330,7 @@ void Database::scheduleTransaction()
if (m_isTransactionQueueEnabled && !m_transactionQueue.isEmpty())
transaction = m_transactionQueue.takeFirst();
- if (transaction && databaseContext()->databaseThread()) {
+ if (transaction && databaseContext()->databaseThreadAvailable()) {
OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction);
WTF_LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transaction %p\n", task.get(), task->transaction());
m_transactionInProgress = true;
@@ -342,7 +342,7 @@ void Database::scheduleTransaction()
void Database::scheduleTransactionStep(SQLTransactionBackend* transaction)
{
- if (!databaseContext()->databaseThread())
+ if (!databaseContext()->databaseThreadAvailable())
return;
OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction);
@@ -783,10 +783,9 @@ ExecutionContext* Database::executionContext() const
void Database::closeImmediately()
{
ASSERT(executionContext()->isContextThread());
- DatabaseThread* databaseThread = databaseContext()->databaseThread();
- if (databaseThread && !databaseThread->terminationRequested() && opened()) {
+ if (databaseContext()->databaseThreadAvailable() && opened()) {
logErrorMessage("forcibly closing database");
- databaseThread->scheduleTask(DatabaseCloseTask::create(this, 0));
+ databaseContext()->databaseThread()->scheduleTask(DatabaseCloseTask::create(this, 0));
}
}
@@ -913,7 +912,7 @@ Vector<String> Database::tableNames()
// this may not be true anymore.
Vector<String> result;
TaskSynchronizer synchronizer;
- if (!databaseContext()->databaseThread() || databaseContext()->databaseThread()->terminationRequested(&synchronizer))
+ if (!databaseContext()->databaseThreadAvailable())
return result;
OwnPtr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result);
« no previous file with comments | « no previous file | Source/modules/webdatabase/DatabaseContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698