diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp')
-rw-r--r-- | chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp b/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp index 08e70a6a278..76857627141 100644 --- a/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp +++ b/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp @@ -29,9 +29,7 @@ #include "core/dom/Document.h" #include "core/fetch/FetchInitiatorInfo.h" #include "core/fetch/ResourceFetcher.h" -#include "core/html/HTMLImport.h" -#include "core/css/MediaList.h" -#include "core/css/MediaQueryEvaluator.h" +#include "core/html/imports/HTMLImport.h" #include "core/rendering/RenderObject.h" #include "public/platform/Platform.h" @@ -42,20 +40,19 @@ bool PreloadRequest::isSafeToSendToAnotherThread() const return m_initiatorName.isSafeToSendToAnotherThread() && m_charset.isSafeToSendToAnotherThread() && m_resourceURL.isSafeToSendToAnotherThread() - && m_mediaAttribute.isSafeToSendToAnotherThread() && m_baseURL.isSafeToSendToAnotherThread(); } KURL PreloadRequest::completeURL(Document* document) { - return document->completeURL(m_resourceURL, m_baseURL.isEmpty() ? document->url() : m_baseURL); + return document->completeURLWithOverride(m_resourceURL, m_baseURL.isEmpty() ? document->url() : m_baseURL); } FetchRequest PreloadRequest::resourceRequest(Document* document) { ASSERT(isMainThread()); FetchInitiatorInfo initiatorInfo; - initiatorInfo.name = m_initiatorName; + initiatorInfo.name = AtomicString(m_initiatorName); initiatorInfo.position = m_initiatorPosition; FetchRequest request(ResourceRequest(completeURL(document)), initiatorInfo); @@ -73,28 +70,11 @@ void HTMLResourcePreloader::takeAndPreload(PreloadRequestStream& r) preload(it->release()); } -static bool mediaAttributeMatches(Frame* frame, RenderStyle* renderStyle, const String& attributeValue) -{ - RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(attributeValue); - MediaQueryEvaluator mediaQueryEvaluator("screen", frame, renderStyle); - return mediaQueryEvaluator.eval(mediaQueries.get()); -} - void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload) { - Document* executingDocument = m_document->import() ? m_document->import()->master() : m_document; - Document* loadingDocument = m_document; - - ASSERT(executingDocument->frame()); - ASSERT(executingDocument->renderer()); - ASSERT(executingDocument->renderer()->style()); - if (!preload->media().isEmpty() && !mediaAttributeMatches(executingDocument->frame(), executingDocument->renderer()->style(), preload->media())) - return; - FetchRequest request = preload->resourceRequest(m_document); blink::Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20); - loadingDocument->fetcher()->preload(preload->resourceType(), request, preload->charset()); + m_document->fetcher()->preload(preload->resourceType(), request, preload->charset()); } - } |