OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 { | 247 { |
248 if (!document) | 248 if (!document) |
249 return false; | 249 return false; |
250 LinkHeaderSet headerSet(headerValue); | 250 LinkHeaderSet headerSet(headerValue); |
251 for (auto& header : headerSet) { | 251 for (auto& header : headerSet) { |
252 if (!header.valid() || header.url().isEmpty() || header.rel().isEmpty()) | 252 if (!header.valid() || header.url().isEmpty() || header.rel().isEmpty()) |
253 return false; | 253 return false; |
254 | 254 |
255 LinkRelAttribute relAttribute(header.rel()); | 255 LinkRelAttribute relAttribute(header.rel()); |
256 KURL url = document->completeURL(header.url()); | 256 KURL url = document->completeURL(header.url()); |
257 if (canLoadResources == DoNotLoadResources) { | 257 if (canLoadResources != OnlyLoadResources) { |
258 if (RuntimeEnabledFeatures::linkHeaderEnabled()) | 258 if (RuntimeEnabledFeatures::linkHeaderEnabled()) |
259 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsIn
terface, LinkCalledFromHeader); | 259 dnsPrefetchIfNeeded(relAttribute, url, *document, networkHintsIn
terface, LinkCalledFromHeader); |
260 | 260 |
261 if (RuntimeEnabledFeatures::linkPreconnectEnabled()) | 261 if (RuntimeEnabledFeatures::linkPreconnectEnabled()) |
262 preconnectIfNeeded(relAttribute, url, *document, header.crossOri
gin(), networkHintsInterface, LinkCalledFromHeader); | 262 preconnectIfNeeded(relAttribute, url, *document, header.crossOri
gin(), networkHintsInterface, LinkCalledFromHeader); |
263 } else { | 263 } |
| 264 if (canLoadResources != DoNotLoadResources) { |
264 if (RuntimeEnabledFeatures::linkPreloadEnabled()) | 265 if (RuntimeEnabledFeatures::linkPreloadEnabled()) |
265 preloadIfNeeded(relAttribute, url, *document, header.as(), LinkC
alledFromHeader); | 266 preloadIfNeeded(relAttribute, url, *document, header.as(), LinkC
alledFromHeader); |
266 } | 267 } |
267 // TODO(yoav): Add more supported headers as needed. | 268 // TODO(yoav): Add more supported headers as needed. |
268 } | 269 } |
269 return true; | 270 return true; |
270 } | 271 } |
271 | 272 |
272 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, CrossOriginAttri
buteValue crossOrigin, const String& type, const String& as, const KURL& href, D
ocument& document, const NetworkHintsInterface& networkHintsInterface) | 273 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, CrossOriginAttri
buteValue crossOrigin, const String& type, const String& as, const KURL& href, D
ocument& document, const NetworkHintsInterface& networkHintsInterface) |
273 { | 274 { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 333 |
333 DEFINE_TRACE(LinkLoader) | 334 DEFINE_TRACE(LinkLoader) |
334 { | 335 { |
335 visitor->trace(m_client); | 336 visitor->trace(m_client); |
336 visitor->trace(m_prerender); | 337 visitor->trace(m_prerender); |
337 visitor->trace(m_linkPreloadResourceClient); | 338 visitor->trace(m_linkPreloadResourceClient); |
338 ResourceOwner<Resource, ResourceClient>::trace(visitor); | 339 ResourceOwner<Resource, ResourceClient>::trace(visitor); |
339 } | 340 } |
340 | 341 |
341 } | 342 } |
OLD | NEW |