예제 #1
0
void DatabaseThread::cleanupDatabaseThread() {
  DCHECK(isDatabaseThread());

  STORAGE_DVLOG(1) << "Cleaning up DatabaseThread " << this;

  // Clean up the list of all pending transactions on this database thread
  m_transactionCoordinator->shutdown();

  // Close the databases that we ran transactions on. This ensures that if any
  // transactions are still open, they are rolled back and we don't leave the
  // database in an inconsistent or locked state.
  if (m_openDatabaseSet.size() > 0) {
    // As the call to close will modify the original set, we must take a copy to
    // iterate over.
    HashSet<CrossThreadPersistent<Database>> openSetCopy;
    openSetCopy.swap(m_openDatabaseSet);
    HashSet<CrossThreadPersistent<Database>>::iterator end = openSetCopy.end();
    for (HashSet<CrossThreadPersistent<Database>>::iterator it =
             openSetCopy.begin();
         it != end; ++it)
      (*it)->close();
  }
  m_openDatabaseSet.clear();

  m_thread->postTask(BLINK_FROM_HERE,
                     WTF::bind(&DatabaseThread::cleanupDatabaseThreadCompleted,
                               wrapCrossThreadPersistent(this)));
}
예제 #2
0
bool DatabaseThread::isDatabaseOpen(DatabaseBackend* database)
{
    ASSERT(isDatabaseThread());
    ASSERT(database);
    MutexLocker lock(m_terminationRequestedMutex);
    return !m_terminationRequested && m_openDatabaseSet.contains(database);
}
예제 #3
0
void DatabaseThread::recordDatabaseOpen(DatabaseBackend* database)
{
    ASSERT(isDatabaseThread());
    ASSERT(database);
    ASSERT(!m_openDatabaseSet.contains(database));
    m_openDatabaseSet.add(database);
}
예제 #4
0
void DatabaseThread::recordDatabaseOpen(Database* database) {
  ASSERT(isDatabaseThread());
  ASSERT(database);
  ASSERT(!m_openDatabaseSet.contains(database));
  MutexLocker lock(m_terminationRequestedMutex);
  if (!m_terminationRequested)
    m_openDatabaseSet.add(database);
}
예제 #5
0
void DatabaseThread::recordDatabaseClosed(DatabaseBackend* database)
{
#ifndef ASSERT_DISABLED
    MutexLocker lock(m_terminationRequestedMutex);
#endif
    ASSERT(isDatabaseThread());
    ASSERT(database);
    ASSERT(m_terminationRequested || m_openDatabaseSet.contains(database));
    m_openDatabaseSet.remove(database);
}
예제 #6
0
void DatabaseThread::recordDatabaseClosed(Database* database) {
  ASSERT(isDatabaseThread());
  ASSERT(database);
#if ENABLE(ASSERT)
  {
    MutexLocker lock(m_terminationRequestedMutex);
    ASSERT(m_terminationRequested || m_openDatabaseSet.contains(database));
  }
#endif
  m_openDatabaseSet.remove(database);
}