void HTMLConstructionSite::executeQueuedTasks() { const size_t size = m_taskQueue.size(); if (!size) return; // Copy the task queue into a local variable in case executeTask // re-enters the parser. TaskQueue queue; queue.swap(m_taskQueue); for (size_t i = 0; i < size; ++i) executeTask(queue[i]); // We might be detached now. }
void HTMLConstructionSite::executeQueuedTasks() { // This has no affect on pendingText, and we may have pendingText // remaining after executing all other queued tasks. const size_t size = m_taskQueue.size(); if (!size) return; // Copy the task queue into a local variable in case executeTask // re-enters the parser. TaskQueue queue; queue.swap(m_taskQueue); for (size_t i = 0; i < size; ++i) executeTask(queue[i]); // We might be detached now. }
void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*) { IDB_TRACE("IDBTransactionBackendImpl::taskTimerFired"); ASSERT(!m_taskQueue.isEmpty()); if (m_state == StartPending) { m_transaction->begin(); m_state = Running; } TaskQueue queue; queue.swap(m_taskQueue); while (!queue.isEmpty() && m_state != Finished) { ASSERT(m_state == Running); OwnPtr<ScriptExecutionContext::Task> task(queue.first().release()); queue.removeFirst(); m_pendingEvents++; task->performTask(0); } }