void SharedWorkerScriptLoader::load(const KURL& url)
{
    // Mark this object as active for the duration of the load.
    ASSERT(!hasPendingActivity());
    m_scriptLoader = new WorkerScriptLoader();
    m_scriptLoader->loadAsynchronously(scriptExecutionContext(), url, DenyCrossOriginRedirect, this);

    // Stay alive until the load finishes.
    setPendingActivity(this);
}
Esempio n. 2
0
void FileReader::stop()
{
    // The delayed abort task tidies up and advances to the DONE state.
    if (m_loadingState == LoadingStateAborted)
        return;

    if (hasPendingActivity())
        ThrottlingController::finishReader(executionContext(), this, ThrottlingController::removeReader(executionContext(), this));
    terminate();
}
Esempio n. 3
0
void WebSocket::stop()
{
    bool pending = hasPendingActivity();
    if (m_channel)
        m_channel->disconnect();
    m_channel = 0;
    m_state = CLOSED;
    ActiveDOMObject::stop();
    if (pending)
        ActiveDOMObject::unsetPendingActivity(this);
}
void IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()
{
    LOG(IndexedDB, "IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()");

    ASSERT(hasPendingActivity());
    ASSERT(m_result);
    ASSERT(m_result->type() == IDBAny::Type::IDBDatabase);
    m_transaction->addRequest(*this);

    enqueueEvent(Event::create(eventNames().successEvent, false, false));
}
Esempio n. 5
0
void WebSocket::stop()
{
    bool pending = hasPendingActivity();
    if (m_channel)
        m_channel->disconnect();
    m_channel = nullptr;
    m_state = CLOSED;
    m_pendingEvents.clear();
    ActiveDOMObject::stop();
    if (pending)
        ActiveDOMObject::unsetPendingActivity(this);
}
void IDBOpenDBRequest::fireErrorAfterVersionChangeAbort()
{
    LOG(IndexedDB, "IDBOpenDBRequest::fireErrorAfterVersionChangeAbort()");

    ASSERT(hasPendingActivity());

    IDBError idbError(IDBDatabaseException::AbortError);
    m_domError = DOMError::create(idbError.name());

    m_transaction->addRequest(*this);
    enqueueEvent(Event::create(eventNames().errorEvent, true, true));
}
Esempio n. 7
0
void WebSocket::didClose(unsigned long unhandledBufferedAmount)
{
    LOG(Network, "WebSocket %p didClose", this);
    if (!m_channel)
        return;
    m_state = CLOSED;
    m_bufferedAmountAfterClose += unhandledBufferedAmount;
    ASSERT(scriptExecutionContext());
    dispatchEvent(Event::create(eventNames().closeEvent, false, false));
    m_channel = 0;
    if (hasPendingActivity())
        ActiveDOMObject::unsetPendingActivity(this);
}
void IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit()
{
    LOG(IndexedDB, "IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit() - %s", resourceIdentifier().loggingString().utf8().data());

    ASSERT(currentThread() == originThreadID());
    ASSERT(hasPendingActivity());
    m_transaction->addRequest(*this);

    auto event = IDBRequestCompletionEvent::create(eventNames().successEvent, false, false, *this);
    m_openDatabaseSuccessEvent = &event.get();

    enqueueEvent(WTFMove(event));
}
void IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()
{
    LOG(IndexedDB, "IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion() - %s", resourceIdentifier().loggingString().utf8().data());

    ASSERT(currentThread() == originThreadID());
    ASSERT(hasPendingActivity());

    IDBError idbError(IDBDatabaseException::AbortError);
    m_domError = DOMError::create(idbError.name(), idbError.message());
    setResultToUndefined();

    m_transaction->addRequest(*this);
    enqueueEvent(IDBRequestCompletionEvent::create(eventNames().errorEvent, true, true, *this));
}
Esempio n. 10
0
void WebSocket::didClose(unsigned long unhandledBufferedAmount, ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsigned short code, const String& reason)
{
    LOG(Network, "WebSocket %p didClose", this);
    if (!m_channel)
        return;
    bool wasClean = m_state == CLOSING && !unhandledBufferedAmount && closingHandshakeCompletion == ClosingHandshakeComplete;
    m_state = CLOSED;
    m_bufferedAmount = unhandledBufferedAmount;
    ASSERT(scriptExecutionContext());
    RefPtr<CloseEvent> event = CloseEvent::create(wasClean, code, reason);
    dispatchEvent(event);
    if (m_channel) {
        m_channel->disconnect();
        m_channel = 0;
    }
    if (hasPendingActivity())
        ActiveDOMObject::unsetPendingActivity(this);
}
void DedicatedWorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState& exceptionState)
{
    Base::importScripts(urls, exceptionState);
    thread()->workerObjectProxy().reportPendingActivity(hasPendingActivity());
}
Esempio n. 12
0
void SpeechRecognition::stop()
{
    m_stoppedByActiveDOMObject = true;
    if (hasPendingActivity())
        abort();
}
void DedicatedWorkerContext::importScripts(const Vector<String>& urls, ExceptionCode& ec)
{
    Base::importScripts(urls, ec);
    thread()->workerObjectProxy().reportPendingActivity(hasPendingActivity());
}