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); }
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(); }
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); }
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(); } }
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); }