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); }
bool NetworkResourceLoader::shouldUseCredentialStorage(ResourceHandle* handle) { ASSERT_UNUSED(handle, handle == m_handle || !m_handle); // m_handle will be 0 if called from ResourceHandle::start(). // When the WebProcess is handling loading a client is consulted each time this shouldUseCredentialStorage question is asked. // In NetworkProcess mode we ask the WebProcess client up front once and then reuse the cached answer. // We still need this sync version, because ResourceHandle itself uses it internally, even when the delegate uses an async one. return allowStoredCredentials() == AllowStoredCredentials; }
void ResourceHandleInternal::start() { if (m_state != ConnectionStateNew) CRASH(); m_state = ConnectionStateStarted; m_loader.set(webKitClient()->createURLLoader()); ASSERT(m_loader.get()); WrappedResourceRequest wrappedRequest(m_request); wrappedRequest.setAllowStoredCredentials(allowStoredCredentials()); m_loader->loadAsynchronously(wrappedRequest, this); }