| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 // TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAt
tributeValue. crbug.com/486689 | 276 // TODO(yoav): Convert all uses of the CrossOriginAttribute to CrossOriginAt
tributeValue. crbug.com/486689 |
| 277 // FIXME(crbug.com/463266): We're ignoring type here. Maybe we shouldn't. | 277 // FIXME(crbug.com/463266): We're ignoring type here. Maybe we shouldn't. |
| 278 dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface, Lin
kCalledFromMarkup); | 278 dnsPrefetchIfNeeded(relAttribute, href, document, networkHintsInterface, Lin
kCalledFromMarkup); |
| 279 | 279 |
| 280 preconnectIfNeeded(relAttribute, href, document, crossOrigin, networkHintsIn
terface, LinkCalledFromMarkup); | 280 preconnectIfNeeded(relAttribute, href, document, crossOrigin, networkHintsIn
terface, LinkCalledFromMarkup); |
| 281 | 281 |
| 282 if (m_client->shouldLoadLink()) | 282 if (m_client->shouldLoadLink()) |
| 283 createLinkPreloadResourceClient(preloadIfNeeded(relAttribute, href, docu
ment, as, LinkCalledFromMarkup)); | 283 createLinkPreloadResourceClient(preloadIfNeeded(relAttribute, href, docu
ment, as, LinkCalledFromMarkup)); |
| 284 | 284 |
| 285 if (href.isEmpty() || !href.isValid()) |
| 286 released(); |
| 287 |
| 285 // FIXME(crbug.com/323096): Should take care of import. | 288 // FIXME(crbug.com/323096): Should take care of import. |
| 286 if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && h
ref.isValid() && document.frame()) { | 289 if ((relAttribute.isLinkPrefetch() || relAttribute.isLinkSubresource()) && h
ref.isValid() && document.frame()) { |
| 287 if (!m_client->shouldLoadLink()) | 290 if (!m_client->shouldLoadLink()) |
| 288 return false; | 291 return false; |
| 289 Resource::Type type = Resource::LinkPrefetch; | 292 Resource::Type type = Resource::LinkPrefetch; |
| 290 if (relAttribute.isLinkSubresource()) { | 293 if (relAttribute.isLinkSubresource()) { |
| 291 type = Resource::LinkSubresource; | 294 type = Resource::LinkSubresource; |
| 292 UseCounter::count(document, UseCounter::LinkRelSubresource); | 295 UseCounter::count(document, UseCounter::LinkRelSubresource); |
| 293 } else { | 296 } else { |
| 294 UseCounter::count(document, UseCounter::LinkRelPrefetch); | 297 UseCounter::count(document, UseCounter::LinkRelPrefetch); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 316 } | 319 } |
| 317 | 320 |
| 318 void LinkLoader::released() | 321 void LinkLoader::released() |
| 319 { | 322 { |
| 320 // Only prerenders need treatment here; other links either use the Resource
interface, or are notionally | 323 // Only prerenders need treatment here; other links either use the Resource
interface, or are notionally |
| 321 // atomic (dns prefetch). | 324 // atomic (dns prefetch). |
| 322 if (m_prerender) { | 325 if (m_prerender) { |
| 323 m_prerender->cancel(); | 326 m_prerender->cancel(); |
| 324 m_prerender.clear(); | 327 m_prerender.clear(); |
| 325 } | 328 } |
| 329 if (m_linkPreloadResourceClient) |
| 330 m_linkPreloadResourceClient->clear(); |
| 326 } | 331 } |
| 327 | 332 |
| 328 DEFINE_TRACE(LinkLoader) | 333 DEFINE_TRACE(LinkLoader) |
| 329 { | 334 { |
| 330 visitor->trace(m_client); | 335 visitor->trace(m_client); |
| 331 visitor->trace(m_prerender); | 336 visitor->trace(m_prerender); |
| 332 visitor->trace(m_linkPreloadResourceClient); | 337 visitor->trace(m_linkPreloadResourceClient); |
| 333 ResourceOwner<Resource, ResourceClient>::trace(visitor); | 338 ResourceOwner<Resource, ResourceClient>::trace(visitor); |
| 334 } | 339 } |
| 335 | 340 |
| 336 } | 341 } |
| OLD | NEW |