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

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

Issue 2260303002: Sending an async GET request for doc.written blocked scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows compile error for GetResourcePriority return type fixed. Created 4 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
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (visibility == ResourcePriority::Visible) 139 if (visibility == ResourcePriority::Visible)
140 priority = ResourceLoadPriorityHigh; 140 priority = ResourceLoadPriorityHigh;
141 141
142 // Resources before the first image are considered "early" in the document 142 // Resources before the first image are considered "early" in the document
143 // and resources after the first image are "late" in the document. Importan t to 143 // and resources after the first image are "late" in the document. Importan t to
144 // note that this is based on when the preload scanner discovers a resource 144 // note that this is based on when the preload scanner discovers a resource
145 // for the most part so the main parser may not have reached the image eleme nt yet. 145 // for the most part so the main parser may not have reached the image eleme nt yet.
146 if (type == Resource::Image) 146 if (type == Resource::Image)
147 m_imageFetched = true; 147 m_imageFetched = true;
148 148
149 // Special handling for scripts. 149 if (FetchRequest::IdleLoad == request.defer()) {
150 // Default/Parser-Blocking/Preload early in document: High (set in typeToPri ority) 150 priority = ResourceLoadPriorityVeryLow;
151 // Async/Defer: Low Priority (applies to both preload and parser-inserted) 151 } else if (type == Resource::Script) {
152 // Preload late in document: Medium 152 // Special handling for scripts.
153 if (type == Resource::Script) { 153 // Default/Parser-Blocking/Preload early in document: High (set in typeT oPriority)
154 // Async/Defer: Low Priority (applies to both preload and parser-inserte d)
155 // Preload late in document: Medium
154 if (FetchRequest::LazyLoad == request.defer()) 156 if (FetchRequest::LazyLoad == request.defer())
155 priority = ResourceLoadPriorityLow; 157 priority = ResourceLoadPriorityLow;
156 else if (request.forPreload() && m_imageFetched) 158 else if (request.forPreload() && m_imageFetched)
157 priority = ResourceLoadPriorityMedium; 159 priority = ResourceLoadPriorityMedium;
158 } else if (FetchRequest::LazyLoad == request.defer()) { 160 } else if (FetchRequest::LazyLoad == request.defer()) {
159 priority = ResourceLoadPriorityVeryLow; 161 priority = ResourceLoadPriorityVeryLow;
160 } 162 }
161 163
162 // A manually set priority acts as a floor. This is used to ensure that sync hronous requests 164 // A manually set priority acts as a floor. This is used to ensure that sync hronous requests
163 // are always given the highest possible priority, as well as to ensure that there isn't priority 165 // are always given the highest possible priority, as well as to ensure that there isn't priority
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 visitor->trace(m_context); 1335 visitor->trace(m_context);
1334 visitor->trace(m_archive); 1336 visitor->trace(m_archive);
1335 visitor->trace(m_loaders); 1337 visitor->trace(m_loaders);
1336 visitor->trace(m_nonBlockingLoaders); 1338 visitor->trace(m_nonBlockingLoaders);
1337 visitor->trace(m_documentResources); 1339 visitor->trace(m_documentResources);
1338 visitor->trace(m_preloads); 1340 visitor->trace(m_preloads);
1339 visitor->trace(m_resourceTimingInfoMap); 1341 visitor->trace(m_resourceTimingInfoMap);
1340 } 1342 }
1341 1343
1342 } // namespace blink 1344 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698