Exemple #1
0
void NetworkResourceLoader::start()
{
    ASSERT(isMainThread());

    // Explicit ref() balanced by a deref() in NetworkResourceLoader::resourceHandleStopped()
    ref();
    
    // FIXME (NetworkProcess): Create RemoteNetworkingContext with actual settings.
    m_networkingContext = RemoteNetworkingContext::create(false, false, inPrivateBrowsingMode(), shouldClearReferrerOnHTTPSToHTTPRedirect());

    consumeSandboxExtensions();

    // FIXME (NetworkProcess): Pass an actual value for defersLoading
    m_handle = ResourceHandle::create(m_networkingContext.get(), request(), this, false /* defersLoading */, contentSniffingPolicy() == SniffContent);
}
Exemple #2
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);
}