Remove the concept of initiatorDocument from CachedResourceRequest
authorsimonjam@chromium.org <simonjam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2012 00:18:35 +0000 (00:18 +0000)
committersimonjam@chromium.org <simonjam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Nov 2012 00:18:35 +0000 (00:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102855

Reviewed by Sam Weinig.

It turns out this isn't necessary for the new implementation of Resource Timing. Instead,
we can get at it from the CachedResourceLoader. I don't think anyone else needed it either.

No new tests. This was never used.

* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::cachedFont):
* css/CSSImageSetValue.cpp:
(WebCore::CSSImageSetValue::cachedImageSet):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::cachedImage):
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::requestStyleSheet):
* css/WebKitCSSSVGDocumentValue.cpp:
(WebCore::WebKitCSSSVGDocumentValue::load):
* css/WebKitCSSShaderValue.cpp:
(WebCore::WebKitCSSShaderValue::cachedShader):
* html/parser/CSSPreloadScanner.cpp:
(WebCore::CSSPreloadScanner::emitRule):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::PreloadTask::preload):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::setInitiator):
* loader/cache/CachedResourceRequest.h:
(CachedResourceRequest):
* loader/icon/IconLoader.cpp:
(WebCore::IconLoader::startLoading):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSFontFaceSrcValue.cpp
Source/WebCore/css/CSSImageSetValue.cpp
Source/WebCore/css/CSSImageValue.cpp
Source/WebCore/css/StyleRuleImport.cpp
Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp
Source/WebCore/css/WebKitCSSShaderValue.cpp
Source/WebCore/html/parser/CSSPreloadScanner.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebCore/loader/cache/CachedResourceRequest.cpp
Source/WebCore/loader/cache/CachedResourceRequest.h
Source/WebCore/loader/icon/IconLoader.cpp

index cbbd30c..515cc2c 100644 (file)
@@ -1,3 +1,38 @@
+2012-11-21  James Simonsen  <simonjam@chromium.org>
+
+        Remove the concept of initiatorDocument from CachedResourceRequest
+        https://bugs.webkit.org/show_bug.cgi?id=102855
+
+        Reviewed by Sam Weinig.
+
+        It turns out this isn't necessary for the new implementation of Resource Timing. Instead,
+        we can get at it from the CachedResourceLoader. I don't think anyone else needed it either.
+
+        No new tests. This was never used.
+
+        * css/CSSFontFaceSrcValue.cpp:
+        (WebCore::CSSFontFaceSrcValue::cachedFont):
+        * css/CSSImageSetValue.cpp:
+        (WebCore::CSSImageSetValue::cachedImageSet):
+        * css/CSSImageValue.cpp:
+        (WebCore::CSSImageValue::cachedImage):
+        * css/StyleRuleImport.cpp:
+        (WebCore::StyleRuleImport::requestStyleSheet):
+        * css/WebKitCSSSVGDocumentValue.cpp:
+        (WebCore::WebKitCSSSVGDocumentValue::load):
+        * css/WebKitCSSShaderValue.cpp:
+        (WebCore::WebKitCSSShaderValue::cachedShader):
+        * html/parser/CSSPreloadScanner.cpp:
+        (WebCore::CSSPreloadScanner::emitRule):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::PreloadTask::preload):
+        * loader/cache/CachedResourceRequest.cpp:
+        (WebCore::CachedResourceRequest::setInitiator):
+        * loader/cache/CachedResourceRequest.h:
+        (CachedResourceRequest):
+        * loader/icon/IconLoader.cpp:
+        (WebCore::IconLoader::startLoading):
+
 2012-11-21  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r135437.
index 07782ac..0d1fa10 100644 (file)
@@ -98,7 +98,7 @@ CachedFont* CSSFontFaceSrcValue::cachedFont(Document* document)
 {
     if (!m_cachedFont) {
         CachedResourceRequest request(ResourceRequest(document->completeURL(m_resource)));
-        request.setInitiator(cachedResourceRequestInitiators().css, document);
+        request.setInitiator(cachedResourceRequestInitiators().css);
         m_cachedFont = document->cachedResourceLoader()->requestFont(request);
     }
     return m_cachedFont.get();
index ebc74c7..050f201 100644 (file)
@@ -110,8 +110,8 @@ StyleCachedImageSet* CSSImageSetValue::cachedImageSet(CachedResourceLoader* load
         // All forms of scale should be included: Page::pageScaleFactor(), Frame::pageZoomFactor(),
         // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
         ImageWithScale image = bestImageForScaleFactor();
-        CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(image.imageURL)));
-        request.setInitiator(cachedResourceRequestInitiators().css, document);
+        CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)));
+        request.setInitiator(cachedResourceRequestInitiators().css);
         if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request)) {
             m_imageSet = StyleCachedImageSet::create(cachedImage.get(), image.scaleFactor, this);
             m_accessedBestFitImage = true;
index 957a221..c3f4f63 100644 (file)
@@ -89,7 +89,7 @@ StyleCachedImage* CSSImageValue::cachedImage(CachedResourceLoader* loader, const
         if (initiatorElement)
             request.setInitiator(initiatorElement);
         else
-            request.setInitiator(cachedResourceRequestInitiators().css, loader->document());
+            request.setInitiator(cachedResourceRequestInitiators().css);
         if (CachedResourceHandle<CachedImage> cachedImage = loader->requestImage(request))
             m_image = StyleCachedImage::create(cachedImage.get());
     }
index 3146ec3..cd6a197 100644 (file)
@@ -118,7 +118,7 @@ void StyleRuleImport::requestStyleSheet()
     }
 
     CachedResourceRequest request(ResourceRequest(absURL), m_parentStyleSheet->charset());
-    request.setInitiator(cachedResourceRequestInitiators().css, document);
+    request.setInitiator(cachedResourceRequestInitiators().css);
     if (m_parentStyleSheet->isUserStyleSheet())
         m_cachedSheet = cachedResourceLoader->requestUserCSSStyleSheet(request);
     else
index 6fe948d..b434eec 100644 (file)
@@ -55,7 +55,7 @@ CachedSVGDocument* WebKitCSSSVGDocumentValue::load(CachedResourceLoader* loader)
         m_loadRequested = true;
 
         CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)));
-        request.setInitiator(cachedResourceRequestInitiators().css, loader->document());
+        request.setInitiator(cachedResourceRequestInitiators().css);
         m_document = loader->requestSVGDocument(request);
     }
 
index 35187f8..91bdde2 100644 (file)
@@ -62,7 +62,7 @@ StyleCachedShader* WebKitCSSShaderValue::cachedShader(CachedResourceLoader* load
         m_accessedShader = true;
 
         CachedResourceRequest request(ResourceRequest(loader->document()->completeURL(m_url)));
-        request.setInitiator(cachedResourceRequestInitiators().css, loader->document());
+        request.setInitiator(cachedResourceRequestInitiators().css);
         if (CachedResourceHandle<CachedShader> cachedShader = loader->requestShader(request))
             m_shader = StyleCachedShader::create(cachedShader.get());
     }
index 150ce8a..c2014fe 100644 (file)
@@ -199,7 +199,7 @@ void CSSPreloadScanner::emitRule()
         String value = parseCSSStringOrURL(m_ruleValue.characters(), m_ruleValue.length());
         if (!value.isEmpty()) {
             CachedResourceRequest request(ResourceRequest(m_document->completeURL(value)));
-            request.setInitiator(cachedResourceRequestInitiators().css, m_document);
+            request.setInitiator(cachedResourceRequestInitiators().css);
             m_document->cachedResourceLoader()->preload(CachedResource::CSSStyleSheet, request, String(), m_scanningBody);
         }
         m_state = Initial;
index 68dd932..5a4634a 100644 (file)
@@ -130,7 +130,7 @@ public:
 
         CachedResourceLoader* cachedResourceLoader = document->cachedResourceLoader();
         CachedResourceRequest request(ResourceRequest(document->completeURL(m_urlToLoad, baseURL)));
-        request.setInitiator(tagName(), document);
+        request.setInitiator(tagName());
         if (m_tagName == scriptTag) {
             request.mutableResourceRequest().setAllowCookies(crossOriginModeAllowsCookies());
             cachedResourceLoader->preload(CachedResource::Script, request, m_charset, scanningBody);
index 7be7349..c92e3a7 100644 (file)
@@ -66,15 +66,14 @@ CachedResourceRequest::~CachedResourceRequest()
 
 void CachedResourceRequest::setInitiator(PassRefPtr<Element> element)
 {
-    ASSERT(!m_initiatorElement && !m_initiatorDocument);
+    ASSERT(!m_initiatorElement && m_initiatorName.isEmpty());
     m_initiatorElement = element;
 }
 
-void CachedResourceRequest::setInitiator(const AtomicString& name, PassRefPtr<Document> document)
+void CachedResourceRequest::setInitiator(const AtomicString& name)
 {
-    ASSERT(!m_initiatorElement && !m_initiatorDocument);
+    ASSERT(!m_initiatorElement && m_initiatorName.isEmpty());
     m_initiatorName = name;
-    m_initiatorDocument = document;
 }
 
 const AtomicString& CachedResourceRequest::initiatorName() const
@@ -88,13 +87,6 @@ const AtomicString& CachedResourceRequest::initiatorName() const
     return defaultName;
 }
 
-PassRefPtr<Document> CachedResourceRequest::initiatorDocument()
-{
-    if (m_initiatorElement)
-        return m_initiatorElement->document();
-    return m_initiatorDocument;
-}
-
 PassRefPtr<Element> CachedResourceRequest::initiatorElement()
 {
     return m_initiatorElement;
index 4aa30d4..9d408e6 100644 (file)
@@ -57,9 +57,8 @@ public:
     DeferOption defer() const { return m_defer; }
     void setDefer(DeferOption defer) { m_defer = defer; }
     void setInitiator(PassRefPtr<Element>);
-    void setInitiator(const AtomicString& name, PassRefPtr<Document>);
+    void setInitiator(const AtomicString& name);
     const AtomicString& initiatorName() const;
-    PassRefPtr<Document> initiatorDocument();
     PassRefPtr<Element> initiatorElement();
 
 private:
@@ -70,7 +69,6 @@ private:
     bool m_forPreload;
     DeferOption m_defer;
     RefPtr<Element> m_initiatorElement;
-    RefPtr<Document> m_initiatorDocument;
     AtomicString m_initiatorName;
 };
 
index e07108e..5714513 100644 (file)
@@ -67,7 +67,7 @@ void IconLoader::startLoading()
     request.mutableResourceRequest().setTargetType(ResourceRequest::TargetIsFavicon);
 #endif
     request.mutableResourceRequest().setPriority(ResourceLoadPriorityLow);
-    request.setInitiator(cachedResourceRequestInitiators().icon, m_frame->document());
+    request.setInitiator(cachedResourceRequestInitiators().icon);
 
     m_resource = m_frame->document()->cachedResourceLoader()->requestRawResource(request);
     if (m_resource)