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

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

Issue 1615803004: Avoid double download for late discovered link preload resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Permit memcache removal when ResourceFetcher is destroyed Created 4 years, 11 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 if (m_preloads) { 822 if (m_preloads) {
823 for (auto resource : *m_preloads) { 823 for (auto resource : *m_preloads) {
824 if (resource->url() == url) 824 if (resource->url() == url)
825 return true; 825 return true;
826 } 826 }
827 } 827 }
828 828
829 return false; 829 return false;
830 } 830 }
831 831
832 void ResourceFetcher::clearPreloads() 832 void ResourceFetcher::clearPreloads(ClearPreloadsType type)
833 { 833 {
834 #if PRELOAD_DEBUG 834 #if PRELOAD_DEBUG
835 printPreloadStats(); 835 printPreloadStats();
836 #endif 836 #endif
837 if (!m_preloads) 837 if (!m_preloads)
838 return; 838 return;
839 839
840 for (auto resource : *m_preloads) { 840 for (auto resource : *m_preloads) {
841 resource->decreasePreloadCount(); 841 resource->decreasePreloadCount();
842 bool deleted = resource->deleteIfPossible(); 842 bool deleted = resource->deleteIfPossible();
843 if (!deleted && resource->preloadResult() == Resource::PreloadNotReferen ced) 843 if (!deleted && resource->preloadResult() == Resource::PreloadNotReferen ced && (type == ClearAllPreloads || !resource->avoidBlockingOnLoad()))
Nate Chapin 2016/01/21 19:07:14 I assume avoidBlockingOnLoad() is checked because
Yoav Weiss 2016/01/21 20:34:09 added
844 memoryCache()->remove(resource.get()); 844 memoryCache()->remove(resource.get());
845 } 845 }
846 m_preloads.clear(); 846 m_preloads.clear();
847 } 847 }
848 848
849 void ResourceFetcher::addAllArchiveResources(MHTMLArchive* archive) 849 void ResourceFetcher::addAllArchiveResources(MHTMLArchive* archive)
850 { 850 {
851 ASSERT(archive); 851 ASSERT(archive);
852 if (!m_archiveResourceCollection) 852 if (!m_archiveResourceCollection)
853 m_archiveResourceCollection = ArchiveResourceCollection::create(); 853 m_archiveResourceCollection = ArchiveResourceCollection::create();
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 visitor->trace(m_loaders); 1157 visitor->trace(m_loaders);
1158 visitor->trace(m_nonBlockingLoaders); 1158 visitor->trace(m_nonBlockingLoaders);
1159 #if ENABLE(OILPAN) 1159 #if ENABLE(OILPAN)
1160 visitor->trace(m_documentResources); 1160 visitor->trace(m_documentResources);
1161 visitor->trace(m_preloads); 1161 visitor->trace(m_preloads);
1162 visitor->trace(m_resourceTimingInfoMap); 1162 visitor->trace(m_resourceTimingInfoMap);
1163 #endif 1163 #endif
1164 } 1164 }
1165 1165
1166 } 1166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698