|
Lines 260-266
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec1
|
| 260 |
// |
260 |
// |
| 261 |
// When executing the transaction (in DatabaseThread::databaseThread()): |
261 |
// When executing the transaction (in DatabaseThread::databaseThread()): |
| 262 |
// ==================================================================== |
262 |
// ==================================================================== |
| 263 |
// OwnPtr<DatabaseTask> task; // points to ... |
263 |
// std::unique_ptr<DatabaseTask> task; // points to ... |
| 264 |
// --> DatabaseTransactionTask // RefPtr<SQLTransactionBackend> m_transaction points to ... |
264 |
// --> DatabaseTransactionTask // RefPtr<SQLTransactionBackend> m_transaction points to ... |
| 265 |
// --> SQLTransactionBackend // RefPtr<SQLTransaction> m_frontend; |
265 |
// --> SQLTransactionBackend // RefPtr<SQLTransaction> m_frontend; |
| 266 |
// --> SQLTransaction // RefPtr<SQLTransactionBackend> m_backend points to ... |
266 |
// --> SQLTransaction // RefPtr<SQLTransactionBackend> m_backend points to ... |
|
Lines 284-290
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec2
|
| 284 |
// However, there will still be a DatabaseTask pointing to the SQLTransactionBackend (see |
284 |
// However, there will still be a DatabaseTask pointing to the SQLTransactionBackend (see |
| 285 |
// the "When executing the transaction" chain above). This will keep the |
285 |
// the "When executing the transaction" chain above). This will keep the |
| 286 |
// SQLTransactionBackend alive until DatabaseThread::databaseThread() releases its |
286 |
// SQLTransactionBackend alive until DatabaseThread::databaseThread() releases its |
| 287 |
// task OwnPtr. |
287 |
// task std::unique_ptr. |
| 288 |
// |
288 |
// |
| 289 |
// What happens if a transaction is interrupted? |
289 |
// What happens if a transaction is interrupted? |
| 290 |
// ============================================ |
290 |
// ============================================ |
|
Lines 393-399
void SQLTransactionBackend::doCleanup()
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec3
|
| 393 |
// m_sqliteTransaction invokes SQLiteTransaction's destructor which does |
393 |
// m_sqliteTransaction invokes SQLiteTransaction's destructor which does |
| 394 |
// just that. We might as well do this unconditionally and free up its |
394 |
// just that. We might as well do this unconditionally and free up its |
| 395 |
// resources because we're already terminating. |
395 |
// resources because we're already terminating. |
| 396 |
m_sqliteTransaction.clear(); |
396 |
m_sqliteTransaction.reset(); |
| 397 |
} |
397 |
} |
| 398 |
|
398 |
|
| 399 |
// Release the lock on this database |
399 |
// Release the lock on this database |
|
Lines 500-506
void SQLTransactionBackend::computeNextStateAndCleanupIfNeeded()
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec4
|
| 500 |
// The current SQLite transaction should be stopped, as well |
500 |
// The current SQLite transaction should be stopped, as well |
| 501 |
if (m_sqliteTransaction) { |
501 |
if (m_sqliteTransaction) { |
| 502 |
m_sqliteTransaction->stop(); |
502 |
m_sqliteTransaction->stop(); |
| 503 |
m_sqliteTransaction.clear(); |
503 |
m_sqliteTransaction.reset(); |
| 504 |
} |
504 |
} |
| 505 |
|
505 |
|
| 506 |
// Terminate the frontend state machine. This also gets the frontend to |
506 |
// Terminate the frontend state machine. This also gets the frontend to |
|
Lines 526-536
bool SQLTransactionBackend::shouldPerformWhilePaused() const
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec5
|
| 526 |
} |
526 |
} |
| 527 |
#endif |
527 |
#endif |
| 528 |
|
528 |
|
| 529 |
void SQLTransactionBackend::executeSQL(PassOwnPtr<AbstractSQLStatement> statement, |
529 |
void SQLTransactionBackend::executeSQL(std::unique_ptr<AbstractSQLStatement> statement, |
| 530 |
const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions) |
530 |
const String& sqlStatement, const Vector<SQLValue>& arguments, int permissions) |
| 531 |
{ |
531 |
{ |
| 532 |
RefPtr<SQLStatementBackend> statementBackend; |
532 |
RefPtr<SQLStatementBackend> statementBackend; |
| 533 |
statementBackend = SQLStatementBackend::create(statement, sqlStatement, arguments, permissions); |
533 |
statementBackend = SQLStatementBackend::create(std::forward<std::unique_ptr<AbstractSQLStatement>>(statement), |
|
|
534 |
sqlStatement, arguments, permissions); |
| 534 |
|
535 |
|
| 535 |
if (Database::from(m_database.get())->deleted()) |
536 |
if (Database::from(m_database.get())->deleted()) |
| 536 |
statementBackend->setDatabaseDeletedError(); |
537 |
statementBackend->setDatabaseDeletedError(); |
|
Lines 582-588
SQLTransactionState SQLTransactionBackend::openTransactionAndPreflight()
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec6
|
| 582 |
} |
583 |
} |
| 583 |
|
584 |
|
| 584 |
ASSERT(!m_sqliteTransaction); |
585 |
ASSERT(!m_sqliteTransaction); |
| 585 |
m_sqliteTransaction = adoptPtr(new SQLiteTransaction(m_database->sqliteDatabase(), m_readOnly)); |
586 |
m_sqliteTransaction = std::make_unique<SQLiteTransaction>(m_database->sqliteDatabase(), m_readOnly); |
| 586 |
|
587 |
|
| 587 |
m_database->resetDeletes(); |
588 |
m_database->resetDeletes(); |
| 588 |
m_database->disableAuthorizer(); |
589 |
m_database->disableAuthorizer(); |
|
Lines 594-600
SQLTransactionState SQLTransactionBackend::openTransactionAndPreflight()
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec7
|
| 594 |
ASSERT(!m_database->sqliteDatabase().transactionInProgress()); |
595 |
ASSERT(!m_database->sqliteDatabase().transactionInProgress()); |
| 595 |
m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to begin transaction", |
596 |
m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to begin transaction", |
| 596 |
m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg()); |
597 |
m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg()); |
| 597 |
m_sqliteTransaction.clear(); |
598 |
m_sqliteTransaction.reset(); |
| 598 |
return nextStateForTransactionError(); |
599 |
return nextStateForTransactionError(); |
| 599 |
} |
600 |
} |
| 600 |
|
601 |
|
|
Lines 606-612
SQLTransactionState SQLTransactionBackend::openTransactionAndPreflight()
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec8
|
| 606 |
m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to read version", |
607 |
m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to read version", |
| 607 |
m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg()); |
608 |
m_database->sqliteDatabase().lastError(), m_database->sqliteDatabase().lastErrorMsg()); |
| 608 |
m_database->disableAuthorizer(); |
609 |
m_database->disableAuthorizer(); |
| 609 |
m_sqliteTransaction.clear(); |
610 |
m_sqliteTransaction.reset(); |
| 610 |
m_database->enableAuthorizer(); |
611 |
m_database->enableAuthorizer(); |
| 611 |
return nextStateForTransactionError(); |
612 |
return nextStateForTransactionError(); |
| 612 |
} |
613 |
} |
|
Lines 615-621
SQLTransactionState SQLTransactionBackend::openTransactionAndPreflight()
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec9
|
| 615 |
// Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail |
616 |
// Spec 4.3.2.3: Perform preflight steps, jumping to the error callback if they fail |
| 616 |
if (m_wrapper && !m_wrapper->performPreflight(this)) { |
617 |
if (m_wrapper && !m_wrapper->performPreflight(this)) { |
| 617 |
m_database->disableAuthorizer(); |
618 |
m_database->disableAuthorizer(); |
| 618 |
m_sqliteTransaction.clear(); |
619 |
m_sqliteTransaction.reset(); |
| 619 |
m_database->enableAuthorizer(); |
620 |
m_database->enableAuthorizer(); |
| 620 |
m_transactionError = m_wrapper->sqlError(); |
621 |
m_transactionError = m_wrapper->sqlError(); |
| 621 |
if (!m_transactionError) |
622 |
if (!m_transactionError) |
|
Lines 799-805
SQLTransactionState SQLTransactionBackend::cleanupAfterTransactionErrorCallback(
a/Source/WebCore/Modules/webdatabase/SQLTransactionBackend.cpp_sec10
|
| 799 |
m_sqliteTransaction->rollback(); |
800 |
m_sqliteTransaction->rollback(); |
| 800 |
|
801 |
|
| 801 |
ASSERT(!m_database->sqliteDatabase().transactionInProgress()); |
802 |
ASSERT(!m_database->sqliteDatabase().transactionInProgress()); |
| 802 |
m_sqliteTransaction.clear(); |
803 |
m_sqliteTransaction.reset(); |
| 803 |
} |
804 |
} |
| 804 |
m_database->enableAuthorizer(); |
805 |
m_database->enableAuthorizer(); |
| 805 |
|
806 |
|