Chromium Code Reviews| 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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 899 resource->decreasePreloadCount(); | 899 resource->decreasePreloadCount(); |
| 900 if (resource->getPreloadResult() == Resource::PreloadNotReferenced) | 900 if (resource->getPreloadResult() == Resource::PreloadNotReferenced) |
| 901 memoryCache()->remove(resource.get()); | 901 memoryCache()->remove(resource.get()); |
| 902 m_preloads->remove(resource); | 902 m_preloads->remove(resource); |
| 903 } | 903 } |
| 904 } | 904 } |
| 905 if (!m_preloads->size()) | 905 if (!m_preloads->size()) |
| 906 m_preloads.clear(); | 906 m_preloads.clear(); |
| 907 } | 907 } |
| 908 | 908 |
| 909 void ResourceFetcher::warnUnusedPreloads() | |
| 910 { | |
| 911 if (!m_preloads) | |
| 912 return; | |
| 913 for (auto resource : *m_preloads) { | |
|
Charlie Harrison
2016/09/14 12:34:58
const auto& ?
Yoav Weiss
2016/09/14 13:28:31
Yeah. I'll also modify all the other iterations of
| |
| 914 if (resource && resource->isLinkPreload() && resource->getPreloadResult( ) == Resource::PreloadNotReferenced) { | |
| 915 context().addConsoleMessage("The resource " + resource->url().getStr ing() + " was preloaded but not used within a few seconds from the window's load event. Please make sure it wasn't preloaded for nothing.", WarningMessageLevel) ; | |
|
Charlie Harrison
2016/09/14 12:34:58
Do you think you should include the fact that it w
Yoav Weiss
2016/09/14 13:28:31
nothing is obvious :) I'll add it to the comment
| |
| 916 } | |
| 917 } | |
| 918 } | |
| 919 | |
| 909 ArchiveResource* ResourceFetcher::createArchive(Resource* resource) | 920 ArchiveResource* ResourceFetcher::createArchive(Resource* resource) |
| 910 { | 921 { |
| 911 // Only the top-frame can load MHTML. | 922 // Only the top-frame can load MHTML. |
| 912 if (!context().isMainFrame()) | 923 if (!context().isMainFrame()) |
| 913 return nullptr; | 924 return nullptr; |
| 914 m_archive = MHTMLArchive::create(resource->url(), resource->resourceBuffer() ); | 925 m_archive = MHTMLArchive::create(resource->url(), resource->resourceBuffer() ); |
| 915 return m_archive ? m_archive->mainResource() : nullptr; | 926 return m_archive ? m_archive->mainResource() : nullptr; |
| 916 } | 927 } |
| 917 | 928 |
| 918 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in t64_t encodedDataLength, DidFinishLoadingReason finishReason) | 929 void ResourceFetcher::didFinishLoading(Resource* resource, double finishTime, in t64_t encodedDataLength, DidFinishLoadingReason finishReason) |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1323 visitor->trace(m_context); | 1334 visitor->trace(m_context); |
| 1324 visitor->trace(m_archive); | 1335 visitor->trace(m_archive); |
| 1325 visitor->trace(m_loaders); | 1336 visitor->trace(m_loaders); |
| 1326 visitor->trace(m_nonBlockingLoaders); | 1337 visitor->trace(m_nonBlockingLoaders); |
| 1327 visitor->trace(m_documentResources); | 1338 visitor->trace(m_documentResources); |
| 1328 visitor->trace(m_preloads); | 1339 visitor->trace(m_preloads); |
| 1329 visitor->trace(m_resourceTimingInfoMap); | 1340 visitor->trace(m_resourceTimingInfoMap); |
| 1330 } | 1341 } |
| 1331 | 1342 |
| 1332 } // namespace blink | 1343 } // namespace blink |
| OLD | NEW |