| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource
, WarningMessageLevel, String("<link rel=preload> has an invalid `href` value"))
); | 171 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource
, WarningMessageLevel, String("<link rel=preload> has an invalid `href` value"))
); |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 // TODO(yoav): Figure out a way that 'as' would be used to set request h
eaders. | 174 // TODO(yoav): Figure out a way that 'as' would be used to set request h
eaders. |
| 175 Resource::Type priorityType; | 175 Resource::Type priorityType; |
| 176 if (!getPriorityTypeFromAsAttribute(as, priorityType)) { | 176 if (!getPriorityTypeFromAsAttribute(as, priorityType)) { |
| 177 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource
, WarningMessageLevel, String("<link rel=preload> must have a valid `as` value")
)); | 177 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource
, WarningMessageLevel, String("<link rel=preload> must have a valid `as` value")
)); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe
tchInitiatorTypeNames::link); | 180 FetchRequest linkRequest(ResourceRequest(document.completeURL(href)), Fe
tchInitiatorTypeNames::link); |
| 181 linkRequest.setPriority(ResourceFetcher::loadPriority(priorityType, link
Request)); | 181 linkRequest.setPriority(document.fetcher()->loadPriority(priorityType, l
inkRequest)); |
| 182 Settings* settings = document.settings(); | 182 Settings* settings = document.settings(); |
| 183 if (settings && settings->logPreload()) | 183 if (settings && settings->logPreload()) |
| 184 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource
, DebugMessageLevel, String("Preload triggered for " + href.host() + href.path()
))); | 184 document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource
, DebugMessageLevel, String("Preload triggered for " + href.host() + href.path()
))); |
| 185 setResource(LinkFetchResource::fetch(Resource::LinkPreload, linkRequest,
document.fetcher())); | 185 setResource(LinkFetchResource::fetch(Resource::LinkPreload, linkRequest,
document.fetcher())); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool LinkLoader::loadLinkFromHeader(const String& headerValue, Document* documen
t) | 189 bool LinkLoader::loadLinkFromHeader(const String& headerValue, Document* documen
t) |
| 190 { | 190 { |
| 191 if (!document) | 191 if (!document) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 m_prerender.clear(); | 255 m_prerender.clear(); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 DEFINE_TRACE(LinkLoader) | 259 DEFINE_TRACE(LinkLoader) |
| 260 { | 260 { |
| 261 visitor->trace(m_prerender); | 261 visitor->trace(m_prerender); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } | 264 } |
| OLD | NEW |