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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // notifyDatabaseThreadIsShuttingDown(). | 333 // notifyDatabaseThreadIsShuttingDown(). |
334 // | 334 // |
335 // Phase 5: After state CleanupAndTerminate | 335 // Phase 5: After state CleanupAndTerminate |
336 // | 336 // |
337 // - This is how a transaction ends normally. | 337 // - This is how a transaction ends normally. |
338 // - state CleanupAndTerminate calls doCleanup(). | 338 // - state CleanupAndTerminate calls doCleanup(). |
339 | 339 |
340 | 340 |
341 namespace WebCore { | 341 namespace WebCore { |
342 | 342 |
343 PassRefPtr<SQLTransactionBackend> SQLTransactionBackend::create(DatabaseBackend*
db, | 343 PassRefPtrWillBeRawPtr<SQLTransactionBackend> SQLTransactionBackend::create(Data
baseBackend* db, |
344 PassRefPtrWillBeRawPtr<AbstractSQLTransaction> frontend, PassRefPtr<SQLTrans
actionWrapper> wrapper, bool readOnly) | 344 PassRefPtrWillBeRawPtr<AbstractSQLTransaction> frontend, PassRefPtr<SQLTrans
actionWrapper> wrapper, bool readOnly) |
345 { | 345 { |
346 return adoptRef(new SQLTransactionBackend(db, frontend, wrapper, readOnly)); | 346 return adoptRefWillBeNoop(new SQLTransactionBackend(db, frontend, wrapper, r
eadOnly)); |
347 } | 347 } |
348 | 348 |
349 SQLTransactionBackend::SQLTransactionBackend(DatabaseBackend* db, | 349 SQLTransactionBackend::SQLTransactionBackend(DatabaseBackend* db, |
350 PassRefPtrWillBeRawPtr<AbstractSQLTransaction> frontend, PassRefPtr<SQLTrans
actionWrapper> wrapper, bool readOnly) | 350 PassRefPtrWillBeRawPtr<AbstractSQLTransaction> frontend, PassRefPtr<SQLTrans
actionWrapper> wrapper, bool readOnly) |
351 : m_frontend(frontend) | 351 : m_frontend(frontend) |
352 , m_database(db) | 352 , m_database(db) |
353 , m_wrapper(wrapper) | 353 , m_wrapper(wrapper) |
354 , m_hasCallback(m_frontend->hasCallback()) | 354 , m_hasCallback(m_frontend->hasCallback()) |
355 , m_hasSuccessCallback(m_frontend->hasSuccessCallback()) | 355 , m_hasSuccessCallback(m_frontend->hasSuccessCallback()) |
356 , m_hasErrorCallback(m_frontend->hasErrorCallback()) | 356 , m_hasErrorCallback(m_frontend->hasErrorCallback()) |
357 , m_shouldRetryCurrentStatement(false) | 357 , m_shouldRetryCurrentStatement(false) |
358 , m_modifiedDatabase(false) | 358 , m_modifiedDatabase(false) |
359 , m_lockAcquired(false) | 359 , m_lockAcquired(false) |
360 , m_readOnly(readOnly) | 360 , m_readOnly(readOnly) |
361 , m_hasVersionMismatch(false) | 361 , m_hasVersionMismatch(false) |
362 { | 362 { |
363 ASSERT(m_database); | 363 ASSERT(m_database); |
364 m_frontend->setBackend(this); | 364 m_frontend->setBackend(this); |
365 m_requestedState = SQLTransactionState::AcquireLock; | 365 m_requestedState = SQLTransactionState::AcquireLock; |
366 } | 366 } |
367 | 367 |
368 SQLTransactionBackend::~SQLTransactionBackend() | 368 SQLTransactionBackend::~SQLTransactionBackend() |
369 { | 369 { |
370 ASSERT(!m_sqliteTransaction); | 370 ASSERT(!m_sqliteTransaction); |
371 } | 371 } |
372 | 372 |
| 373 void SQLTransactionBackend::trace(Visitor* visitor) |
| 374 { |
| 375 visitor->trace(m_frontend); |
| 376 visitor->trace(m_database); |
| 377 } |
| 378 |
373 void SQLTransactionBackend::doCleanup() | 379 void SQLTransactionBackend::doCleanup() |
374 { | 380 { |
375 if (!m_frontend) | 381 if (!m_frontend) |
376 return; | 382 return; |
377 m_frontend = nullptr; // Break the reference cycle. See comment about the li
fe-cycle above. | 383 m_frontend = nullptr; // Break the reference cycle. See comment about the li
fe-cycle above. |
378 | 384 |
379 ASSERT(database()->databaseContext()->databaseThread()->isDatabaseThread()); | 385 ASSERT(database()->databaseContext()->databaseThread()->isDatabaseThread()); |
380 | 386 |
381 MutexLocker locker(m_statementMutex); | 387 MutexLocker locker(m_statementMutex); |
382 m_statementQueue.clear(); | 388 m_statementQueue.clear(); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 } | 818 } |
813 | 819 |
814 SQLTransactionState SQLTransactionBackend::sendToFrontendState() | 820 SQLTransactionState SQLTransactionBackend::sendToFrontendState() |
815 { | 821 { |
816 ASSERT(m_nextState != SQLTransactionState::Idle); | 822 ASSERT(m_nextState != SQLTransactionState::Idle); |
817 m_frontend->requestTransitToState(m_nextState); | 823 m_frontend->requestTransitToState(m_nextState); |
818 return SQLTransactionState::Idle; | 824 return SQLTransactionState::Idle; |
819 } | 825 } |
820 | 826 |
821 } // namespace WebCore | 827 } // namespace WebCore |
OLD | NEW |