OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 visitor->trace(m_wrapper); | 374 visitor->trace(m_wrapper); |
375 visitor->trace(m_statementQueue); | 375 visitor->trace(m_statementQueue); |
376 } | 376 } |
377 | 377 |
378 void SQLTransactionBackend::doCleanup() | 378 void SQLTransactionBackend::doCleanup() |
379 { | 379 { |
380 if (!m_frontend) | 380 if (!m_frontend) |
381 return; | 381 return; |
382 m_frontend = nullptr; // Break the reference cycle. See comment about the li
fe-cycle above. | 382 m_frontend = nullptr; // Break the reference cycle. See comment about the li
fe-cycle above. |
383 | 383 |
384 ASSERT(database()->databaseContext()->databaseThread()->isDatabaseThread()); | 384 ASSERT(database()->getDatabaseContext()->databaseThread()->isDatabaseThread(
)); |
385 | 385 |
386 MutexLocker locker(m_statementMutex); | 386 MutexLocker locker(m_statementMutex); |
387 m_statementQueue.clear(); | 387 m_statementQueue.clear(); |
388 | 388 |
389 if (m_sqliteTransaction) { | 389 if (m_sqliteTransaction) { |
390 // In the event we got here because of an interruption or error (i.e. if | 390 // In the event we got here because of an interruption or error (i.e. if |
391 // the transaction is in progress), we should roll it back here. Clearin
g | 391 // the transaction is in progress), we should roll it back here. Clearin
g |
392 // m_sqliteTransaction invokes SQLiteTransaction's destructor which does | 392 // m_sqliteTransaction invokes SQLiteTransaction's destructor which does |
393 // just that. We might as well do this unconditionally and free up its | 393 // just that. We might as well do this unconditionally and free up its |
394 // resources because we're already terminating. | 394 // resources because we're already terminating. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 } | 518 } |
519 | 519 |
520 void SQLTransactionBackend::executeSQL(SQLStatement* statement, | 520 void SQLTransactionBackend::executeSQL(SQLStatement* statement, |
521 const String& sqlStatement, const Vector<SQLValue>& arguments, int permissio
ns) | 521 const String& sqlStatement, const Vector<SQLValue>& arguments, int permissio
ns) |
522 { | 522 { |
523 enqueueStatementBackend(SQLStatementBackend::create(statement, sqlStatement,
arguments, permissions)); | 523 enqueueStatementBackend(SQLStatementBackend::create(statement, sqlStatement,
arguments, permissions)); |
524 } | 524 } |
525 | 525 |
526 void SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown() | 526 void SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown() |
527 { | 527 { |
528 ASSERT(database()->databaseContext()->databaseThread()->isDatabaseThread()); | 528 ASSERT(database()->getDatabaseContext()->databaseThread()->isDatabaseThread(
)); |
529 | 529 |
530 // If the transaction is in progress, we should roll it back here, since thi
s | 530 // If the transaction is in progress, we should roll it back here, since thi
s |
531 // is our last opportunity to do something related to this transaction on th
e | 531 // is our last opportunity to do something related to this transaction on th
e |
532 // DB thread. Amongst other work, doCleanup() will clear m_sqliteTransaction | 532 // DB thread. Amongst other work, doCleanup() will clear m_sqliteTransaction |
533 // which invokes SQLiteTransaction's destructor, which will do the roll back | 533 // which invokes SQLiteTransaction's destructor, which will do the roll back |
534 // if necessary. | 534 // if necessary. |
535 doCleanup(); | 535 doCleanup(); |
536 } | 536 } |
537 | 537 |
538 SQLTransactionState SQLTransactionBackend::acquireLock() | 538 SQLTransactionState SQLTransactionBackend::acquireLock() |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 } | 818 } |
819 | 819 |
820 SQLTransactionState SQLTransactionBackend::sendToFrontendState() | 820 SQLTransactionState SQLTransactionBackend::sendToFrontendState() |
821 { | 821 { |
822 ASSERT(m_nextState != SQLTransactionState::Idle); | 822 ASSERT(m_nextState != SQLTransactionState::Idle); |
823 m_frontend->requestTransitToState(m_nextState); | 823 m_frontend->requestTransitToState(m_nextState); |
824 return SQLTransactionState::Idle; | 824 return SQLTransactionState::Idle; |
825 } | 825 } |
826 | 826 |
827 } // namespace blink | 827 } // namespace blink |
OLD | NEW |