Exemple #1
0
static void destroyOnContextThread(PassOwnPtr<ActiveDOMObjectCallbackImpl> impl)
{
    OwnPtr<ActiveDOMObjectCallbackImpl> implOwnPtr = impl;

    ScriptExecutionContext* context = implOwnPtr->scriptExecutionContext();
    MutexLocker locker(implOwnPtr->mutex());
    if (context && !context->isContextThread())
        context->postTask(DestroyOnContextThreadTask::create(implOwnPtr.release()));
}
void SQLTransactionClient::didCommitWriteTransaction(DatabaseBackendBase* database)
{
    ScriptExecutionContext* scriptExecutionContext = database->databaseContext()->scriptExecutionContext();
    if (!scriptExecutionContext->isContextThread()) {
        scriptExecutionContext->postTask(NotifyDatabaseChangedTask::create(database));
        return;
    }

    WebCore::DatabaseObserver::databaseModified(database);
}
JSSQLTransactionSyncCallback::~JSSQLTransactionSyncCallback()
{
    ScriptExecutionContext* context = scriptExecutionContext();
    // When the context is destroyed, all tasks with a reference to a callback
    // should be deleted. So if the context is 0, we are on the context thread.
    if (!context || context->isContextThread())
        delete m_data;
    else
        context->postTask(DeleteCallbackDataTask::create(m_data));
#ifndef NDEBUG
    m_data = 0;
#endif
}
JSTestCallbackFunction::~JSTestCallbackFunction()
{
    ScriptExecutionContext* context = scriptExecutionContext();
    // When the context is destroyed, all tasks with a reference to a callback
    // should be deleted. So if the context is 0, we are on the context thread.
    if (!context || context->isContextThread())
        delete m_data;
    else
        context->postTask(DeleteCallbackDataTask(m_data));
#ifndef NDEBUG
    m_data = nullptr;
#endif
}