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

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

Issue 1923003002: Clear Resource::m_loader in Resource::finish() and Resource::error() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 7 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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 723 }
724 724
725 // During the initial load, avoid loading the same resource multiple times f or a single document, 725 // During the initial load, avoid loading the same resource multiple times f or a single document,
726 // even if the cache policies would tell us to. 726 // even if the cache policies would tell us to.
727 // We also group loads of the same resource together. 727 // We also group loads of the same resource together.
728 // Raw resources are exempted, as XHRs fall into this category and may have user-set Cache-Control: 728 // Raw resources are exempted, as XHRs fall into this category and may have user-set Cache-Control:
729 // headers or other factors that require separate requests. 729 // headers or other factors that require separate requests.
730 if (type != Resource::Raw) { 730 if (type != Resource::Raw) {
731 if (!context().isLoadComplete() && m_validatedURLs.contains(existingReso urce->url())) 731 if (!context().isLoadComplete() && m_validatedURLs.contains(existingReso urce->url()))
732 return Use; 732 return Use;
733 // TODO(japhet): existingResource->isLoading() and existingResource->loa der() are not identical, 733 if (existingResource->isLoading())
734 // which is lame.
735 // Being in the loading state and having a ResourceLoader* are subtly di ffent cases, either of which
736 // should indicate reuse. A resource can have isLoading() return true wi thout a ResourceLoader* if
737 // it is a font that defers actually loading until the font is required. On the other hand,
738 // a Resource can have a non-null ResourceLoader* but have isLoading() r eturn false in a narrow window
739 // during completion, because we set loading to false before notifying R esourceClients, but don't
740 // clear the ResourceLoader pointer until the stack unwinds. If, inside the ResourceClient callbacks,
741 // an event fires synchronously and an event handler re-requests the res ource, we can reach this point
742 // while not loading but having a ResourceLoader.
743 if (existingResource->isLoading() || existingResource->loader())
744 return Use; 734 return Use;
745 } 735 }
746 736
747 // CachePolicyReload always reloads 737 // CachePolicyReload always reloads
748 if (cachePolicy == CachePolicyReload) { 738 if (cachePolicy == CachePolicyReload) {
749 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to CachePolicyReload."); 739 WTF_LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy r eloading due to CachePolicyReload.");
750 return Reload; 740 return Reload;
751 } 741 }
752 742
753 // We'll try to reload the resource if it failed last time. 743 // We'll try to reload the resource if it failed last time.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 visitor->trace(m_context); 1166 visitor->trace(m_context);
1177 visitor->trace(m_archive); 1167 visitor->trace(m_archive);
1178 visitor->trace(m_loaders); 1168 visitor->trace(m_loaders);
1179 visitor->trace(m_nonBlockingLoaders); 1169 visitor->trace(m_nonBlockingLoaders);
1180 visitor->trace(m_documentResources); 1170 visitor->trace(m_documentResources);
1181 visitor->trace(m_preloads); 1171 visitor->trace(m_preloads);
1182 visitor->trace(m_resourceTimingInfoMap); 1172 visitor->trace(m_resourceTimingInfoMap);
1183 } 1173 }
1184 1174
1185 } // namespace blink 1175 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698