CachedResource* DocLoader::requestResource(CachedResource::Type type, const String& url, const String* charset, bool skipCanLoadCheck, bool sendResourceLoadCallbacks) { KURL fullURL = m_doc->completeURL(url.deprecatedString()); if (cache()->disabled()) { HashMap<String, CachedResource*>::iterator it = m_docResources.find(fullURL.url()); if (it != m_docResources.end()) { it->second->setDocLoader(0); m_docResources.remove(it); } } if (m_frame && m_frame->loader()->isReloading()) setCachePolicy(CachePolicyReload); checkForReload(fullURL); CachedResource* resource = cache()->requestResource(this, type, fullURL, charset, skipCanLoadCheck, sendResourceLoadCallbacks); if (resource) { m_docResources.set(resource->url(), resource); checkCacheObjectStatus(resource); } return resource; }
void ResourceRequestBase::setAsIsolatedCopy(const ResourceRequest& other) { setURL(other.url().isolatedCopy()); setCachePolicy(other.cachePolicy()); setTimeoutInterval(other.timeoutInterval()); setFirstPartyForCookies(other.firstPartyForCookies().isolatedCopy()); setHTTPMethod(other.httpMethod().isolatedCopy()); setPriority(other.priority()); setRequester(other.requester()); updateResourceRequest(); m_httpHeaderFields = other.httpHeaderFields().isolatedCopy(); size_t encodingCount = other.m_responseContentDispositionEncodingFallbackArray.size(); if (encodingCount > 0) { String encoding1 = other.m_responseContentDispositionEncodingFallbackArray[0].isolatedCopy(); String encoding2; String encoding3; if (encodingCount > 1) { encoding2 = other.m_responseContentDispositionEncodingFallbackArray[1].isolatedCopy(); if (encodingCount > 2) encoding3 = other.m_responseContentDispositionEncodingFallbackArray[2].isolatedCopy(); } ASSERT(encodingCount <= 3); setResponseContentDispositionEncodingFallbackArray(encoding1, encoding2, encoding3); } if (other.m_httpBody) setHTTPBody(other.m_httpBody->isolatedCopy()); setAllowCookies(other.m_allowCookies); const_cast<ResourceRequest&>(asResourceRequest()).doPlatformSetAsIsolatedCopy(other); }
PlotSpectr::PlotSpectr() { setRenderThreadCount(0); // use system specific thread count QList<double> contourLevels; contourLevels += 0.99; setContourLevels( contourLevels ); setAlpha(0); setDisplayMode( QwtPlotSpectrogram::ContourMode, true ); setCachePolicy( QwtPlotRasterItem::PaintCache ); setRenderHint(QwtPlotItem::RenderAntialiased); }
ResourceRequest::ResourceRequest(CrossThreadResourceRequestData* data) : ResourceRequest() { setURL(data->m_url); setCachePolicy(data->m_cachePolicy); setTimeoutInterval(data->m_timeoutInterval); setFirstPartyForCookies(data->m_firstPartyForCookies); setRequestorOrigin(data->m_requestorOrigin); setHTTPMethod(AtomicString(data->m_httpMethod)); setPriority(data->m_priority, data->m_intraPriorityValue); m_httpHeaderFields.adopt(data->m_httpHeaders.release()); setHTTPBody(data->m_httpBody); setAllowStoredCredentials(data->m_allowStoredCredentials); setReportUploadProgress(data->m_reportUploadProgress); setHasUserGesture(data->m_hasUserGesture); setDownloadToFile(data->m_downloadToFile); setUseStreamOnResponse(data->m_useStreamOnResponse); setSkipServiceWorker(data->m_skipServiceWorker); setShouldResetAppCache(data->m_shouldResetAppCache); setRequestorID(data->m_requestorID); setRequestorProcessID(data->m_requestorProcessID); setAppCacheHostID(data->m_appCacheHostID); setRequestContext(data->m_requestContext); setFrameType(data->m_frameType); setFetchRequestMode(data->m_fetchRequestMode); setFetchCredentialsMode(data->m_fetchCredentialsMode); setFetchRedirectMode(data->m_fetchRedirectMode); setLoFiState(data->m_loFiState); m_referrerPolicy = data->m_referrerPolicy; m_didSetHTTPReferrer = data->m_didSetHTTPReferrer; m_checkForBrowserSideNavigation = data->m_checkForBrowserSideNavigation; m_uiStartTime = data->m_uiStartTime; m_isExternalRequest = data->m_isExternalRequest; m_inputPerfMetricReportPolicy = data->m_inputPerfMetricReportPolicy; m_followedRedirect = data->m_followedRedirect; }
/* * Extraction d'une page du cache * Cache page extraction */ Page* getNextPage() { CacheEntry *entry = NULL; unsigned long nr=0; bool notUnregister = false; Page *page; // Get the next page number switch (_policy) { case EveryPagesIncreasing: nr = _lastPageRequested + 1; break; case EvenDecreasing: if (_lastPageRequested > 2) nr = _lastPageRequested - 2; else { nr = 1; setCachePolicy(OddIncreasing); } break; case OddIncreasing: if (!_lastPageRequested) nr = 1; else nr = _lastPageRequested + 2; break; } DEBUGMSG(_("Next requested page : %lu (# pages into memory=%lu/%u)"), nr, _pagesInMemory, CACHESIZE); // Wait for the page while (nr && (!_numberOfPages || _numberOfPages >= nr)) { { _pageTableLock.lock(); if (_maxPagesInTable >= nr && _pages[nr - 1] && !_pages[nr - 1]->isSwapped()) { entry = _pages[nr - 1]; _pages[nr - 1] = NULL; if (!entry->previous() && !entry->next() && entry != _inMemory) notUnregister = true; if (entry->previous()) entry->previous()->setNext(entry->next()); if (entry->next()) entry->next()->setPrevious(entry->previous()); if (entry == _inMemory) _inMemory = entry->next(); if (entry == _inMemoryLast) _inMemoryLast = NULL; _pageTableLock.unlock(); break; } else if (_maxPagesInTable >= nr && _pages[nr - 1] && _pages[nr - 1]->isSwapped()) _work++; _pageRequested = nr; _pageTableLock.unlock(); } _pageAvailable--; }; // Extract the page instance if (!entry) return NULL; _pagesInTable--; _lastPageRequested = nr; page = entry->page(); delete entry; // Preload a new page if (!notUnregister) _pagesInMemory--; _work++; return page; }