Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 514893002: Lower priority of async scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleaned up a few stray member variables Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/fetch/FetchRequest.h ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return request.priority(); 117 return request.priority();
118 118
119 switch (type) { 119 switch (type) {
120 case Resource::MainResource: 120 case Resource::MainResource:
121 return ResourceLoadPriorityVeryHigh; 121 return ResourceLoadPriorityVeryHigh;
122 case Resource::CSSStyleSheet: 122 case Resource::CSSStyleSheet:
123 return ResourceLoadPriorityHigh; 123 return ResourceLoadPriorityHigh;
124 case Resource::Raw: 124 case Resource::Raw:
125 return request.options().synchronousPolicy == RequestSynchronously ? Res ourceLoadPriorityVeryHigh : ResourceLoadPriorityMedium; 125 return request.options().synchronousPolicy == RequestSynchronously ? Res ourceLoadPriorityVeryHigh : ResourceLoadPriorityMedium;
126 case Resource::Script: 126 case Resource::Script:
127 // Async scripts do not block the parser so they get the lowest priority and can be
128 // loaded in parser order with images.
129 if (FetchRequest::LazyLoad == request.defer())
130 return ResourceLoadPriorityLow;
131 return ResourceLoadPriorityMedium;
127 case Resource::Font: 132 case Resource::Font:
128 case Resource::ImportResource: 133 case Resource::ImportResource:
129 return ResourceLoadPriorityMedium; 134 return ResourceLoadPriorityMedium;
130 case Resource::Image: 135 case Resource::Image:
131 // We'll default images to VeryLow, and promote whatever is visible. Thi s improves 136 // Default images to VeryLow, and promote whatever is visible. This impr oves
132 // speed-index by ~5% on average, ~14% at the 99th percentile. 137 // speed-index by ~5% on average, ~14% at the 99th percentile.
133 return ResourceLoadPriorityVeryLow; 138 return ResourceLoadPriorityVeryLow;
134 case Resource::Media: 139 case Resource::Media:
135 return ResourceLoadPriorityLow; 140 return ResourceLoadPriorityLow;
136 case Resource::XSLStyleSheet: 141 case Resource::XSLStyleSheet:
137 ASSERT(RuntimeEnabledFeatures::xsltEnabled()); 142 ASSERT(RuntimeEnabledFeatures::xsltEnabled());
138 return ResourceLoadPriorityHigh; 143 return ResourceLoadPriorityHigh;
139 case Resource::SVGDocument: 144 case Resource::SVGDocument:
140 return ResourceLoadPriorityLow; 145 return ResourceLoadPriorityLow;
141 case Resource::LinkPrefetch: 146 case Resource::LinkPrefetch:
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 1558
1554 void ResourceFetcher::trace(Visitor* visitor) 1559 void ResourceFetcher::trace(Visitor* visitor)
1555 { 1560 {
1556 visitor->trace(m_document); 1561 visitor->trace(m_document);
1557 visitor->trace(m_loaders); 1562 visitor->trace(m_loaders);
1558 visitor->trace(m_multipartLoaders); 1563 visitor->trace(m_multipartLoaders);
1559 ResourceLoaderHost::trace(visitor); 1564 ResourceLoaderHost::trace(visitor);
1560 } 1565 }
1561 1566
1562 } 1567 }
OLDNEW
« no previous file with comments | « Source/core/fetch/FetchRequest.h ('k') | Source/core/html/parser/HTMLPreloadScanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698