示例#1
0
void SyncNetworkResourceLoader::start()
{
    // FIXME (NetworkProcess): This is called on the NetworkProcess main thread, blocking any other requests from being scheduled.
    // This should move to a background thread, but we'd either need to be sure that:
    //   A - ResourceHandle::loadResourceSynchronously is safe to run on a background thread.
    //   B - Write custom loading logic that is known to be safe on a background thread.
    
    ASSERT(isMainThread());

    ResourceError error;
    ResourceResponse response;
    Vector<char> data;
    
    // FIXME (NetworkProcess): Create RemoteNetworkingContext with actual settings.
    RefPtr<RemoteNetworkingContext> networkingContext = RemoteNetworkingContext::create(false, false, inPrivateBrowsingMode(), shouldClearReferrerOnHTTPSToHTTPRedirect());

    consumeSandboxExtensions();

    ResourceHandle::loadResourceSynchronously(networkingContext.get(), request(), allowStoredCredentials(), error, response, data);

    invalidateSandboxExtensions();

    m_delayedReply->send(error, response, CoreIPC::DataReference((uint8_t*)data.data(), data.size()));
    
    NetworkProcess::shared().networkResourceLoadScheduler().removeLoader(this);
}
示例#2
0
void NetworkResourceLoader::didFail(ResourceHandle* handle, const ResourceError& error)
{
    ASSERT_UNUSED(handle, handle == m_handle);

    // FIXME (NetworkProcess): For the memory cache we'll need to update the finished status of the cached resource here.
    // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread.
    invalidateSandboxExtensions();
    send(Messages::WebResourceLoader::DidFailResourceLoad(error));
    cleanup();
}
示例#3
0
void NetworkResourceLoader::cleanup()
{
    ASSERT(RunLoop::isMain());

    m_bufferingTimer.stop();

    invalidateSandboxExtensions();

    m_networkLoad = nullptr;

    // This will cause NetworkResourceLoader to be destroyed and therefore we do it last.
    m_connection->didCleanupResourceLoader(*this);
}
示例#4
0
void NetworkResourceLoader::cleanup()
{
    ASSERT(RunLoop::isMain());

    invalidateSandboxExtensions();

    // Tell the scheduler about this finished loader soon so it can start more network requests.
    NetworkProcess::shared().networkResourceLoadScheduler().scheduleRemoveLoader(this);

    if (m_handle) {
        // Explicit deref() balanced by a ref() in NetworkResourceLoader::start()
        // This might cause the NetworkResourceLoader to be destroyed and therefore we do it last.
        m_handle = 0;
        deref();
    }
}
void NetworkResourceLoader::cleanup()
{
    ASSERT(RunLoop::isMain());

    m_bufferingTimer.stop();

    invalidateSandboxExtensions();

    NetworkProcess::shared().networkResourceLoadScheduler().removeLoader(this);

    if (m_handle) {
        // Explicit deref() balanced by a ref() in NetworkResourceLoader::start()
        // This might cause the NetworkResourceLoader to be destroyed and therefore we do it last.
        m_handle = 0;
        deref();
    }
}
示例#6
0
void NetworkResourceLoader::cleanup()
{
    ASSERT(isMainThread());

    invalidateSandboxExtensions();

    if (FormData* formData = request().httpBody())
        formData->removeGeneratedFilesIfNeeded();

    // Tell the scheduler about this finished loader soon so it can start more network requests.
    NetworkProcess::shared().networkResourceLoadScheduler().scheduleRemoveLoader(this);

    if (m_handle) {
        // Explicit deref() balanced by a ref() in NetworkResourceLoader::start()
        // This might cause the NetworkResourceLoader to be destroyed and therefore we do it last.
        m_handle = 0;
        deref();
    }
}
void NetworkResourceLoader::cleanup()
{
    ASSERT(RunLoop::isMain());

    m_bufferingTimer.stop();

    invalidateSandboxExtensions();

#if USE(NETWORK_SESSION)
    if (m_task) {
        m_task->clearClient();
        m_task = nullptr;
    }
#else
    if (m_handle) {
        m_handle->clearClient();
        m_handle = nullptr;
    }
#endif

    // This will cause NetworkResourceLoader to be destroyed and therefore we do it last.
    m_connection->didCleanupResourceLoader(*this);
}