| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if (!media.isEmpty()) { | 287 if (!media.isEmpty()) { |
| 288 MediaValues* mediaValues = | 288 MediaValues* mediaValues = |
| 289 MediaValues::createDynamicIfFrameExists(document.frame()); | 289 MediaValues::createDynamicIfFrameExists(document.frame()); |
| 290 if (viewportDescription) { | 290 if (viewportDescription) { |
| 291 mediaValues->overrideViewportDimensions( | 291 mediaValues->overrideViewportDimensions( |
| 292 viewportDescription->maxWidth.getFloatValue(), | 292 viewportDescription->maxWidth.getFloatValue(), |
| 293 viewportDescription->maxHeight.getFloatValue()); | 293 viewportDescription->maxHeight.getFloatValue()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 // Preload only if media matches | 296 // Preload only if media matches |
| 297 MediaQuerySet* mediaQueries = MediaQuerySet::create(media); | 297 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media); |
| 298 MediaQueryEvaluator evaluator(*mediaValues); | 298 MediaQueryEvaluator evaluator(*mediaValues); |
| 299 if (!evaluator.eval(mediaQueries)) | 299 if (!evaluator.eval(*mediaQueries)) |
| 300 return nullptr; | 300 return nullptr; |
| 301 } | 301 } |
| 302 if (caller == LinkCalledFromHeader) | 302 if (caller == LinkCalledFromHeader) |
| 303 UseCounter::count(document, UseCounter::LinkHeaderPreload); | 303 UseCounter::count(document, UseCounter::LinkHeaderPreload); |
| 304 Optional<Resource::Type> resourceType = | 304 Optional<Resource::Type> resourceType = |
| 305 LinkLoader::getResourceTypeFromAsAttribute(as); | 305 LinkLoader::getResourceTypeFromAsAttribute(as); |
| 306 if (resourceType == WTF::nullopt) { | 306 if (resourceType == WTF::nullopt) { |
| 307 document.addConsoleMessage(ConsoleMessage::create( | 307 document.addConsoleMessage(ConsoleMessage::create( |
| 308 OtherMessageSource, WarningMessageLevel, | 308 OtherMessageSource, WarningMessageLevel, |
| 309 String("<link rel=preload> must have a valid `as` value"))); | 309 String("<link rel=preload> must have a valid `as` value"))); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 DEFINE_TRACE(LinkLoader) { | 489 DEFINE_TRACE(LinkLoader) { |
| 490 visitor->trace(m_client); | 490 visitor->trace(m_client); |
| 491 visitor->trace(m_prerender); | 491 visitor->trace(m_prerender); |
| 492 visitor->trace(m_linkPreloadResourceClient); | 492 visitor->trace(m_linkPreloadResourceClient); |
| 493 ResourceOwner<Resource, ResourceClient>::trace(visitor); | 493 ResourceOwner<Resource, ResourceClient>::trace(visitor); |
| 494 PrerenderClient::trace(visitor); | 494 PrerenderClient::trace(visitor); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |