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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 break;
\ | 75 break;
\ |
76 } | 76 } |
77 | 77 |
78 #define DEFINE_RESOURCE_HISTOGRAM(prefix) \ | 78 #define DEFINE_RESOURCE_HISTOGRAM(prefix) \ |
79 switch (factory.type()) { \ | 79 switch (factory.type()) { \ |
80 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, CSSStyleSheet) \ | 80 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, CSSStyleSheet) \ |
81 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Font) \ | 81 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Font) \ |
82 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Image) \ | 82 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Image) \ |
83 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, ImportResource) \ | 83 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, ImportResource) \ |
84 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPrefetch) \ | 84 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPrefetch) \ |
85 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, LinkPreload) \ | |
86 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, MainResource) \ | 85 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, MainResource) \ |
87 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Manifest) \ | 86 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Manifest) \ |
88 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Media) \ | 87 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Media) \ |
89 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Raw) \ | 88 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Raw) \ |
90 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Script) \ | 89 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, Script) \ |
91 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, SVGDocument) \ | 90 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, SVGDocument) \ |
92 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, TextTrack) \ | 91 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, TextTrack) \ |
93 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, XSLStyleSheet) \ | 92 DEFINE_SINGLE_RESOURCE_HISTOGRAM(prefix, XSLStyleSheet) \ |
94 } | 93 } |
95 | 94 |
(...skipping 17 matching lines...) Expand all Loading... |
113 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); | 112 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); |
114 case Resource::Raw: | 113 case Resource::Raw: |
115 case Resource::ImportResource: | 114 case Resource::ImportResource: |
116 case Resource::Script: | 115 case Resource::Script: |
117 // Also visible resources/images (set explicitly in loadPriority) | 116 // Also visible resources/images (set explicitly in loadPriority) |
118 return ResourceLoadPriorityHigh; | 117 return ResourceLoadPriorityHigh; |
119 case Resource::Manifest: | 118 case Resource::Manifest: |
120 // Also late-body scripts discovered by the preload scanner (set explici
tly in loadPriority) | 119 // Also late-body scripts discovered by the preload scanner (set explici
tly in loadPriority) |
121 return ResourceLoadPriorityMedium; | 120 return ResourceLoadPriorityMedium; |
122 case Resource::Image: | 121 case Resource::Image: |
123 case Resource::LinkPreload: | |
124 case Resource::TextTrack: | 122 case Resource::TextTrack: |
125 case Resource::Media: | 123 case Resource::Media: |
126 case Resource::SVGDocument: | 124 case Resource::SVGDocument: |
127 // Also async scripts (set explicitly in loadPriority) | 125 // Also async scripts (set explicitly in loadPriority) |
128 return ResourceLoadPriorityLow; | 126 return ResourceLoadPriorityLow; |
129 case Resource::LinkPrefetch: | 127 case Resource::LinkPrefetch: |
130 return ResourceLoadPriorityVeryLow; | 128 return ResourceLoadPriorityVeryLow; |
131 } | 129 } |
132 | 130 |
133 ASSERT_NOT_REACHED(); | 131 ASSERT_NOT_REACHED(); |
(...skipping 18 matching lines...) Expand all Loading... |
152 // Special handling for scripts. | 150 // Special handling for scripts. |
153 // Default/Parser-Blocking/Preload early in document: High (set in typeToPri
ority) | 151 // Default/Parser-Blocking/Preload early in document: High (set in typeToPri
ority) |
154 // Async/Defer: Low Priority (applies to both preload and parser-inserted) | 152 // Async/Defer: Low Priority (applies to both preload and parser-inserted) |
155 // Preload late in document: Medium | 153 // Preload late in document: Medium |
156 if (type == Resource::Script) { | 154 if (type == Resource::Script) { |
157 if (FetchRequest::LazyLoad == request.defer()) | 155 if (FetchRequest::LazyLoad == request.defer()) |
158 priority = ResourceLoadPriorityLow; | 156 priority = ResourceLoadPriorityLow; |
159 else if (request.forPreload() && m_imageFetched) | 157 else if (request.forPreload() && m_imageFetched) |
160 priority = ResourceLoadPriorityMedium; | 158 priority = ResourceLoadPriorityMedium; |
161 } else if (FetchRequest::LazyLoad == request.defer()) { | 159 } else if (FetchRequest::LazyLoad == request.defer()) { |
162 // A deferred load of type Raw is a link rel=preload, which should be Lo
w instead of VeryLow. | 160 priority = ResourceLoadPriorityVeryLow; |
163 priority = type == Resource::Raw ? ResourceLoadPriorityLow : ResourceLoa
dPriorityVeryLow; | |
164 } | 161 } |
165 | 162 |
166 // A manually set priority acts as a floor. This is used to ensure that sync
hronous requests | 163 // A manually set priority acts as a floor. This is used to ensure that sync
hronous requests |
167 // are always given the highest possible priority, as well as to ensure that
there isn't priority | 164 // are always given the highest possible priority, as well as to ensure that
there isn't priority |
168 // churn if images move in and out of the viewport, or is displayed more tha
n once, both in and out | 165 // churn if images move in and out of the viewport, or is displayed more tha
n once, both in and out |
169 // of the viewport. | 166 // of the viewport. |
170 return std::max(context().modifyPriorityForExperiments(priority), request.re
sourceRequest().priority()); | 167 return std::max(context().modifyPriorityForExperiments(priority), request.re
sourceRequest().priority()); |
171 } | 168 } |
172 | 169 |
173 static void populateResourceTiming(ResourceTimingInfo* info, Resource* resource) | 170 static void populateResourceTiming(ResourceTimingInfo* info, Resource* resource) |
(...skipping 19 matching lines...) Expand all Loading... |
193 case Resource::Font: | 190 case Resource::Font: |
194 return WebURLRequest::RequestContextFont; | 191 return WebURLRequest::RequestContextFont; |
195 case Resource::Image: | 192 case Resource::Image: |
196 return WebURLRequest::RequestContextImage; | 193 return WebURLRequest::RequestContextImage; |
197 case Resource::Raw: | 194 case Resource::Raw: |
198 return WebURLRequest::RequestContextSubresource; | 195 return WebURLRequest::RequestContextSubresource; |
199 case Resource::ImportResource: | 196 case Resource::ImportResource: |
200 return WebURLRequest::RequestContextImport; | 197 return WebURLRequest::RequestContextImport; |
201 case Resource::LinkPrefetch: | 198 case Resource::LinkPrefetch: |
202 return WebURLRequest::RequestContextPrefetch; | 199 return WebURLRequest::RequestContextPrefetch; |
203 case Resource::LinkPreload: | |
204 return WebURLRequest::RequestContextSubresource; | |
205 case Resource::TextTrack: | 200 case Resource::TextTrack: |
206 return WebURLRequest::RequestContextTrack; | 201 return WebURLRequest::RequestContextTrack; |
207 case Resource::SVGDocument: | 202 case Resource::SVGDocument: |
208 return WebURLRequest::RequestContextImage; | 203 return WebURLRequest::RequestContextImage; |
209 case Resource::Media: // TODO: Split this. | 204 case Resource::Media: // TODO: Split this. |
210 return WebURLRequest::RequestContextVideo; | 205 return WebURLRequest::RequestContextVideo; |
211 case Resource::Manifest: | 206 case Resource::Manifest: |
212 return WebURLRequest::RequestContextManifest; | 207 return WebURLRequest::RequestContextManifest; |
213 } | 208 } |
214 ASSERT_NOT_REACHED(); | 209 ASSERT_NOT_REACHED(); |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 visitor->trace(m_context); | 1314 visitor->trace(m_context); |
1320 visitor->trace(m_archive); | 1315 visitor->trace(m_archive); |
1321 visitor->trace(m_loaders); | 1316 visitor->trace(m_loaders); |
1322 visitor->trace(m_nonBlockingLoaders); | 1317 visitor->trace(m_nonBlockingLoaders); |
1323 visitor->trace(m_documentResources); | 1318 visitor->trace(m_documentResources); |
1324 visitor->trace(m_preloads); | 1319 visitor->trace(m_preloads); |
1325 visitor->trace(m_resourceTimingInfoMap); | 1320 visitor->trace(m_resourceTimingInfoMap); |
1326 } | 1321 } |
1327 | 1322 |
1328 } // namespace blink | 1323 } // namespace blink |
OLD | NEW |