| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return nullptr; | 256 return nullptr; |
| 257 | 257 |
| 258 UseCounter::count(document, UseCounter::LinkRelPreload); | 258 UseCounter::count(document, UseCounter::LinkRelPreload); |
| 259 ASSERT(RuntimeEnabledFeatures::linkPreloadEnabled()); | 259 ASSERT(RuntimeEnabledFeatures::linkPreloadEnabled()); |
| 260 if (!href.isValid() || href.isEmpty()) { | 260 if (!href.isValid() || href.isEmpty()) { |
| 261 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, Wa
rningMessageLevel, String("<link rel=preload> has an invalid `href` value"))); | 261 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, Wa
rningMessageLevel, String("<link rel=preload> has an invalid `href` value"))); |
| 262 return nullptr; | 262 return nullptr; |
| 263 } | 263 } |
| 264 | 264 |
| 265 if (!media.isEmpty()) { | 265 if (!media.isEmpty()) { |
| 266 RefPtrWillBeRawPtr<MediaValues> mediaValues = MediaValues::createDynamic
IfFrameExists(document.frame()); | 266 RawPtr<MediaValues> mediaValues = MediaValues::createDynamicIfFrameExist
s(document.frame()); |
| 267 if (viewportDescription) | 267 if (viewportDescription) |
| 268 mediaValues->overrideViewportDimensions(viewportDescription->maxWidt
h.getFloatValue(), viewportDescription->maxHeight.getFloatValue()); | 268 mediaValues->overrideViewportDimensions(viewportDescription->maxWidt
h.getFloatValue(), viewportDescription->maxHeight.getFloatValue()); |
| 269 | 269 |
| 270 // Preload only if media matches | 270 // Preload only if media matches |
| 271 RefPtrWillBeRawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(m
edia); | 271 RawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media); |
| 272 MediaQueryEvaluator evaluator(*mediaValues); | 272 MediaQueryEvaluator evaluator(*mediaValues); |
| 273 if (!evaluator.eval(mediaQueries.get())) | 273 if (!evaluator.eval(mediaQueries.get())) |
| 274 return nullptr; | 274 return nullptr; |
| 275 } | 275 } |
| 276 if (caller == LinkCalledFromHeader) | 276 if (caller == LinkCalledFromHeader) |
| 277 UseCounter::count(document, UseCounter::LinkHeaderPreload); | 277 UseCounter::count(document, UseCounter::LinkHeaderPreload); |
| 278 Resource::Type resourceType; | 278 Resource::Type resourceType; |
| 279 if (!LinkLoader::getResourceTypeFromAsAttribute(as, resourceType)) { | 279 if (!LinkLoader::getResourceTypeFromAsAttribute(as, resourceType)) { |
| 280 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, Wa
rningMessageLevel, String("<link rel=preload> must have a valid `as` value"))); | 280 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, Wa
rningMessageLevel, String("<link rel=preload> must have a valid `as` value"))); |
| 281 errorOccurred = true; | 281 errorOccurred = true; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 DEFINE_TRACE(LinkLoader) | 393 DEFINE_TRACE(LinkLoader) |
| 394 { | 394 { |
| 395 visitor->trace(m_client); | 395 visitor->trace(m_client); |
| 396 visitor->trace(m_prerender); | 396 visitor->trace(m_prerender); |
| 397 visitor->trace(m_linkPreloadResourceClient); | 397 visitor->trace(m_linkPreloadResourceClient); |
| 398 ResourceOwner<Resource, ResourceClient>::trace(visitor); | 398 ResourceOwner<Resource, ResourceClient>::trace(visitor); |
| 399 } | 399 } |
| 400 | 400 |
| 401 } // namespace blink | 401 } // namespace blink |
| OLD | NEW |