Changeset 87020 in webkit
- Timestamp:
- May 21, 2011 12:24:56 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r87017 r87020 1 2011-05-21 Gavin Peters <gavinp@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Add rel type prerender to distinguish prerender from prefetch 6 https://bugs.webkit.org/show_bug.cgi?id=61079 7 8 Chrome right now uses <link rel=prefetch ...> for one of two things, 9 to warm the cache in the same way as firefox, or to launch a speculative 10 rendering of a web page, for faster "loading" when the user navigates to it. 11 12 This new rel type will let us distinguish the two cases; the rel type prerender 13 isn't used on the web today, but the Google Web Search example prerendering application 14 is ready to experiment with it. 15 16 * fast/dom/HTMLLinkElement/prerender-expected.txt: Added. 17 * fast/dom/HTMLLinkElement/prerender.html: Added. 18 * platform/gtk/Skipped: 19 * platform/mac/Skipped: 20 * platform/qt/Skipped: 21 * platform/win/Skipped: 22 1 23 2011-05-21 Kent Tamura <tkent@chromium.org> 2 24 -
trunk/LayoutTests/platform/gtk/Skipped
r86911 r87020 944 944 fast/dom/HTMLLinkElement/prefetch-onload.html 945 945 fast/dom/HTMLLinkElement/prefetch-beforeload.html 946 fast/dom/HTMLLinkElement/prerender.html 946 947 fast/dom/HTMLLinkElement/subresource.html 947 948 -
trunk/LayoutTests/platform/mac/Skipped
r86764 r87020 187 187 fast/dom/HTMLLinkElement/prefetch-onerror.html 188 188 fast/dom/HTMLLinkElement/prefetch-onload.html 189 fast/dom/HTMLLinkElement/prerender.html 189 190 fast/dom/HTMLLinkElement/subresource.html 190 191 http/tests/misc/link-rel-prefetch-and-subresource.html -
trunk/LayoutTests/platform/qt/Skipped
r86959 r87020 1971 1971 fast/dom/HTMLLinkElement/prefetch-onerror.html 1972 1972 fast/dom/HTMLLinkElement/prefetch-onload.html 1973 fast/dom/HTMLLinkElement/prerender.html 1973 1974 fast/dom/HTMLLinkElement/subresource.html 1974 1975 http/tests/misc/link-rel-prefetch-and-subresource.html -
trunk/LayoutTests/platform/win/Skipped
r86962 r87020 1007 1007 fast/dom/HTMLLinkElement/prefetch-onerror.html 1008 1008 fast/dom/HTMLLinkElement/prefetch-onload.html 1009 http/tests/misc/link-rel-prefetch-and-subresource.html 1010 fast/dom/HTMLLinkElement/prerender.html 1009 1011 fast/dom/HTMLLinkElement/subresource.html 1010 http/tests/misc/link-rel-prefetch-and-subresource.html1011 1012 http/tests/misc/prefetch-purpose.html 1012 1013 -
trunk/Source/WebCore/ChangeLog
r87019 r87020 1 2011-05-21 Gavin Peters <gavinp@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Add rel type prerender to distinguish prerender from prefetch 6 https://bugs.webkit.org/show_bug.cgi?id=61079 7 8 Chrome right now uses <link rel=prefetch ...> for one of two things, 9 to warm the cache in the same way as firefox, or to launch a speculative 10 rendering of a web page, for faster "loading" when the user navigates to it. 11 12 This new rel type will let us distinguish the two cases; the rel type prerender 13 isn't used on the web today, but the Google Web Search example prerendering application 14 is ready to experiment with it. 15 16 Test: fast/dom/HTMLLinkElement/prerender.html 17 18 * html/HTMLLinkElement.cpp: 19 (WebCore::HTMLLinkElement::tokenizeRelAttribute): 20 (WebCore::HTMLLinkElement::process): 21 * html/HTMLLinkElement.h: 22 (WebCore::HTMLLinkElement::RelAttribute::RelAttribute): 23 * loader/cache/CachedResource.cpp: 24 (WebCore::defaultPriorityForResourceType): 25 * loader/cache/CachedResource.h: 26 (WebCore::CachedResource::isLinkResource): 27 * loader/cache/CachedResourceLoader.cpp: 28 (WebCore::createResource): 29 (WebCore::CachedResourceLoader::requestLinkResource): 30 (WebCore::CachedResourceLoader::canRequest): 31 * loader/cache/CachedResourceLoader.h: 32 * loader/cache/CachedResourceRequest.cpp: 33 (WebCore::cachedResourceTypeToTargetType): 34 (WebCore::CachedResourceRequest::load): 35 * platform/network/ResourceRequestBase.h: 36 1 37 2011-05-21 Emil A Eklund <eae@chromium.org> 2 38 -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r85785 r87020 166 166 #if ENABLE(LINK_PREFETCH) 167 167 relAttribute.m_isLinkPrefetch = false; 168 relAttribute.m_isLinkPrerender = false; 168 169 relAttribute.m_isLinkSubresource = false; 169 170 #endif … … 206 207 else if (equalIgnoringCase(*it, "prefetch")) 207 208 relAttribute.m_isLinkPrefetch = true; 209 else if (equalIgnoringCase(*it, "prerender")) 210 relAttribute.m_isLinkPrerender = true; 208 211 else if (equalIgnoringCase(*it, "subresource")) 209 212 relAttribute.m_isLinkSubresource = true; … … 250 253 251 254 #if ENABLE(LINK_PREFETCH) 252 if ((m_relAttribute.m_isLinkPrefetch || m_relAttribute.m_isLink Subresource) && m_url.isValid() && document()->frame()) {255 if ((m_relAttribute.m_isLinkPrefetch || m_relAttribute.m_isLinkPrerender || m_relAttribute.m_isLinkSubresource) && m_url.isValid() && document()->frame()) { 253 256 if (!checkBeforeLoadEvent()) 254 257 return; 255 258 ResourceLoadPriority priority = ResourceLoadPriorityUnresolved; 256 if (m_relAttribute.m_isLinkSubresource) 259 CachedResource::Type type = CachedResource::LinkPrefetch; 260 // We only make one request to the cachedresourcelodaer if multiple rel types are 261 // specified, 262 if (m_relAttribute.m_isLinkSubresource) { 257 263 priority = ResourceLoadPriorityLow; 258 259 m_cachedLinkResource = document()->cachedResourceLoader()->requestLinkResource(m_url, priority); 264 type = CachedResource::LinkSubresource; 265 } else if (m_relAttribute.m_isLinkPrerender) 266 type = CachedResource::LinkPrerender; 267 268 m_cachedLinkResource = document()->cachedResourceLoader()->requestLinkResource(type, m_url, priority); 260 269 if (m_cachedLinkResource) 261 270 m_cachedLinkResource->addClient(this); -
trunk/Source/WebCore/html/HTMLLinkElement.h
r85785 r87020 46 46 #if ENABLE(LINK_PREFETCH) 47 47 bool m_isLinkPrefetch; 48 bool m_isLinkPrerender; 48 49 bool m_isLinkSubresource; 49 50 #endif … … 56 57 #if ENABLE(LINK_PREFETCH) 57 58 , m_isLinkPrefetch(false) 59 , m_isLinkPrerender(false) 58 60 , m_isLinkSubresource(false) 59 61 #endif -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r85375 r87020 63 63 return ResourceLoadPriorityLow; 64 64 #if ENABLE(LINK_PREFETCH) 65 case CachedResource::LinkResource: 65 case CachedResource::LinkPrefetch: 66 return ResourceLoadPriorityVeryLow; 67 case CachedResource::LinkPrerender: 68 return ResourceLoadPriorityVeryLow; 69 case CachedResource::LinkSubresource: 66 70 return ResourceLoadPriorityVeryLow; 67 71 #endif -
trunk/Source/WebCore/loader/cache/CachedResource.h
r84110 r87020 66 66 #endif 67 67 #if ENABLE(LINK_PREFETCH) 68 , LinkResource 68 , LinkPrefetch 69 , LinkPrerender 70 , LinkSubresource 69 71 #endif 70 72 }; … … 133 135 { 134 136 #if ENABLE(LINK_PREFETCH) 135 return type() == Link Resource;137 return type() == LinkPrefetch || type() == LinkPrerender || type() == LinkSubresource; 136 138 #else 137 139 return false; -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r86542 r87020 72 72 #endif 73 73 #if ENABLE(LINK_PREFETCH) 74 case CachedResource::LinkResource: 75 return new CachedResource(url.string(), CachedResource::LinkResource); 74 case CachedResource::LinkPrefetch: 75 return new CachedResource(url.string(), CachedResource::LinkPrefetch); 76 case CachedResource::LinkPrerender: 77 return new CachedResource(url.string(), CachedResource::LinkPrerender); 78 case CachedResource::LinkSubresource: 79 return new CachedResource(url.string(), CachedResource::LinkSubresource); 76 80 #endif 77 81 } … … 189 193 190 194 #if ENABLE(LINK_PREFETCH) 191 CachedResource* CachedResourceLoader::requestLinkResource( const String& url, ResourceLoadPriority priority)195 CachedResource* CachedResourceLoader::requestLinkResource(CachedResource::Type type, const String& url, ResourceLoadPriority priority) 192 196 { 193 197 ASSERT(frame()); 194 return requestResource(CachedResource::LinkResource, url, String(), priority); 198 ASSERT(type == CachedResource::LinkPrefetch || type == CachedResource::LinkPrerender || type == CachedResource::LinkSubresource); 199 return requestResource(type, url, String(), priority); 195 200 } 196 201 #endif … … 214 219 case CachedResource::FontResource: 215 220 #if ENABLE(LINK_PREFETCH) 216 case CachedResource::LinkResource: 221 case CachedResource::LinkPrefetch: 222 case CachedResource::LinkPrerender: 223 case CachedResource::LinkSubresource: 217 224 #endif 218 225 // These types of resources can be loaded from any origin. … … 261 268 } 262 269 #if ENABLE(LINK_PREFETCH) 263 case CachedResource::LinkResource: 270 case CachedResource::LinkPrefetch: 271 case CachedResource::LinkPrerender: 272 case CachedResource::LinkSubresource: 264 273 // Prefetch cannot affect the current document. 265 274 break; … … 290 299 } 291 300 #if ENABLE(LINK_PREFETCH) 292 case CachedResource::LinkResource: 301 case CachedResource::LinkPrefetch: 302 case CachedResource::LinkPrerender: 303 case CachedResource::LinkSubresource: 293 304 break; 294 305 #endif -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.h
r86601 r87020 71 71 #endif 72 72 #if ENABLE(LINK_PREFETCH) 73 CachedResource* requestLinkResource( const String &url, ResourceLoadPriority priority = ResourceLoadPriorityUnresolved);73 CachedResource* requestLinkResource(CachedResource::Type, const String &url, ResourceLoadPriority priority = ResourceLoadPriorityUnresolved); 74 74 #endif 75 75 -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp
r86949 r87020 46 46 namespace WebCore { 47 47 48 static ResourceRequest::TargetType cachedResourceTypeToTargetType(CachedResource::Type type, ResourceLoadPriority priority) 49 { 50 #if !ENABLE(LINK_PREFETCH) 51 UNUSED_PARAM(priority); 52 #endif 48 static ResourceRequest::TargetType cachedResourceTypeToTargetType(CachedResource::Type type) 49 { 53 50 switch (type) { 54 51 case CachedResource::CSSStyleSheet: … … 64 61 return ResourceRequest::TargetIsImage; 65 62 #if ENABLE(LINK_PREFETCH) 66 case CachedResource::LinkResource: 67 if (priority == ResourceLoadPriorityLowest) 68 return ResourceRequest::TargetIsPrefetch; 63 case CachedResource::LinkPrefetch: 64 return ResourceRequest::TargetIsPrefetch; 65 case CachedResource::LinkPrerender: 66 return ResourceRequest::TargetIsSubresource; 67 case CachedResource::LinkSubresource: 69 68 return ResourceRequest::TargetIsSubresource; 70 69 #endif … … 94 93 95 94 ResourceRequest resourceRequest(resource->url()); 96 resourceRequest.setTargetType(cachedResourceTypeToTargetType(resource->type() , resource->loadPriority()));95 resourceRequest.setTargetType(cachedResourceTypeToTargetType(resource->type())); 97 96 98 97 if (!resource->accept().isEmpty()) … … 117 116 118 117 #if ENABLE(LINK_PREFETCH) 119 if (resource->type() == CachedResource::Link Resource)118 if (resource->type() == CachedResource::LinkPrefetch || resource->type() == CachedResource::LinkPrerender || resource->type() == CachedResource::LinkSubresource) 120 119 resourceRequest.setHTTPHeaderField("Purpose", "prefetch"); 121 120 #endif -
trunk/Source/WebCore/platform/network/ResourceRequestBase.h
r84120 r87020 66 66 TargetIsSharedWorker, 67 67 TargetIsPrefetch, 68 TargetIsPrerender, 68 69 TargetIsFavicon, 69 70 };
Note: See TracChangeset
for help on using the changeset viewer.