OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (visibility == ResourcePriority::Visible) | 140 if (visibility == ResourcePriority::Visible) |
141 priority = ResourceLoadPriorityHigh; | 141 priority = ResourceLoadPriorityHigh; |
142 | 142 |
143 // Resources before the first image are considered "early" in the document | 143 // Resources before the first image are considered "early" in the document |
144 // and resources after the first image are "late" in the document. Importan
t to | 144 // and resources after the first image are "late" in the document. Importan
t to |
145 // note that this is based on when the preload scanner discovers a resource | 145 // note that this is based on when the preload scanner discovers a resource |
146 // for the most part so the main parser may not have reached the image eleme
nt yet. | 146 // for the most part so the main parser may not have reached the image eleme
nt yet. |
147 if (type == Resource::Image) | 147 if (type == Resource::Image) |
148 m_imageFetched = true; | 148 m_imageFetched = true; |
149 | 149 |
150 // Special handling for scripts. | 150 if (FetchRequest::IdleLoad == request.defer()) { |
151 // Default/Parser-Blocking/Preload early in document: High (set in typeToPri
ority) | 151 priority = ResourceLoadPriorityVeryLow; |
152 // Async/Defer: Low Priority (applies to both preload and parser-inserted) | 152 } else if (type == Resource::Script) { |
153 // Preload late in document: Medium | 153 // Special handling for scripts. |
154 if (type == Resource::Script) { | 154 // Default/Parser-Blocking/Preload early in document: High (set in typeT
oPriority) |
| 155 // Async/Defer: Low Priority (applies to both preload and parser-inserte
d) |
| 156 // Preload late in document: Medium |
155 if (FetchRequest::LazyLoad == request.defer()) | 157 if (FetchRequest::LazyLoad == request.defer()) |
156 priority = ResourceLoadPriorityLow; | 158 priority = ResourceLoadPriorityLow; |
157 else if (request.forPreload() && m_imageFetched) | 159 else if (request.forPreload() && m_imageFetched) |
158 priority = ResourceLoadPriorityMedium; | 160 priority = ResourceLoadPriorityMedium; |
159 } else if (FetchRequest::LazyLoad == request.defer()) { | 161 } else if (FetchRequest::LazyLoad == request.defer()) { |
160 priority = ResourceLoadPriorityVeryLow; | 162 priority = ResourceLoadPriorityVeryLow; |
161 } | 163 } |
162 | 164 |
163 // A manually set priority acts as a floor. This is used to ensure that sync
hronous requests | 165 // A manually set priority acts as a floor. This is used to ensure that sync
hronous requests |
164 // are always given the highest possible priority, as well as to ensure that
there isn't priority | 166 // are always given the highest possible priority, as well as to ensure that
there isn't priority |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 visitor->trace(m_context); | 1316 visitor->trace(m_context); |
1315 visitor->trace(m_archive); | 1317 visitor->trace(m_archive); |
1316 visitor->trace(m_loaders); | 1318 visitor->trace(m_loaders); |
1317 visitor->trace(m_nonBlockingLoaders); | 1319 visitor->trace(m_nonBlockingLoaders); |
1318 visitor->trace(m_documentResources); | 1320 visitor->trace(m_documentResources); |
1319 visitor->trace(m_preloads); | 1321 visitor->trace(m_preloads); |
1320 visitor->trace(m_resourceTimingInfoMap); | 1322 visitor->trace(m_resourceTimingInfoMap); |
1321 } | 1323 } |
1322 | 1324 |
1323 } // namespace blink | 1325 } // namespace blink |
OLD | NEW |