Modified: trunk/Source/WebCore/ChangeLog (214681 => 214682)
--- trunk/Source/WebCore/ChangeLog 2017-03-31 19:40:15 UTC (rev 214681)
+++ trunk/Source/WebCore/ChangeLog 2017-03-31 19:42:07 UTC (rev 214682)
@@ -1,3 +1,20 @@
+2017-03-31 Yoav Weiss <y...@yoav.ws>
+
+ Remove PRELOAD_DEBUG related code.
+ https://bugs.webkit.org/show_bug.cgi?id=170352
+
+ Reviewed by Youenn Fablet.
+
+ As the PRELOAD_DEBUG related code stopped building and it seems like no one noticed,
+ it seems safe to assume that we can remove that code. This patch removes it.
+
+ No new tests as there's no functional change.
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::preload):
+ (WebCore::CachedResourceLoader::clearPreloads):
+ (WebCore::CachedResourceLoader::printPreloadStats): Deleted.
+
2017-03-31 Brady Eidson <beid...@apple.com>
Clean up the "StorageType" enum.
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (214681 => 214682)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2017-03-31 19:40:15 UTC (rev 214681)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2017-03-31 19:42:07 UTC (rev 214682)
@@ -79,8 +79,6 @@
#include "CachedTextTrack.h"
#endif
-#define PRELOAD_DEBUG 0
-
#define RELEASE_LOG_IF_ALLOWED(fmt, ...) RELEASE_LOG_IF(isAlwaysOnLoggingAllowed(), Network, "%p - CachedResourceLoader::" fmt, this, ##__VA_ARGS__)
namespace WebCore {
@@ -1237,9 +1235,6 @@
m_preloads = std::make_unique<ListHashSet<CachedResource*>>();
m_preloads->add(resource.get());
-#if PRELOAD_DEBUG
- printf("PRELOADING %s\n", resource->url().latin1().data());
-#endif
return resource;
}
@@ -1271,9 +1266,6 @@
void CachedResourceLoader::clearPreloads(ClearPreloadsMode mode)
{
-#if PRELOAD_DEBUG
- printPreloadStats();
-#endif
if (!m_preloads)
return;
@@ -1294,53 +1286,6 @@
m_preloads = WTFMove(remainingLinkPreloads);
}
-#if PRELOAD_DEBUG
-void CachedResourceLoader::printPreloadStats()
-{
- unsigned scripts = 0;
- unsigned scriptMisses = 0;
- unsigned stylesheets = 0;
- unsigned stylesheetMisses = 0;
- unsigned images = 0;
- unsigned imageMisses = 0;
- for (auto& resource : m_preloads) {
- if (resource->preloadResult() == CachedResource::PreloadNotReferenced)
- printf("!! UNREFERENCED PRELOAD %s\n", resource->url().latin1().data());
- else if (resource->preloadResult() == CachedResource::PreloadReferencedWhileComplete)
- printf("HIT COMPLETE PRELOAD %s\n", resource->url().latin1().data());
- else if (resource->preloadResult() == CachedResource::PreloadReferencedWhileLoading)
- printf("HIT LOADING PRELOAD %s\n", resource->url().latin1().data());
-
- if (resource->type() == CachedResource::Script) {
- scripts++;
- if (resource->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
- scriptMisses++;
- } else if (resource->type() == CachedResource::CSSStyleSheet) {
- stylesheets++;
- if (resource->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
- stylesheetMisses++;
- } else {
- images++;
- if (resource->preloadResult() < CachedResource::PreloadReferencedWhileLoading)
- imageMisses++;
- }
-
- if (resource->errorOccurred() && resource->preloadResult() == CachedResource::PreloadNotReferenced)
- MemoryCache::singleton().remove(resource);
-
- resource->decreasePreloadCount();
- }
- m_preloads = nullptr;
-
- if (scripts)
- printf("SCRIPTS: %d (%d hits, hit rate %d%%)\n", scripts, scripts - scriptMisses, (scripts - scriptMisses) * 100 / scripts);
- if (stylesheets)
- printf("STYLESHEETS: %d (%d hits, hit rate %d%%)\n", stylesheets, stylesheets - stylesheetMisses, (stylesheets - stylesheetMisses) * 100 / stylesheets);
- if (images)
- printf("IMAGES: %d (%d hits, hit rate %d%%)\n", images, images - imageMisses, (images - imageMisses) * 100 / images);
-}
-#endif
-
const ResourceLoaderOptions& CachedResourceLoader::defaultCachedResourceOptions()
{
static NeverDestroyed<ResourceLoaderOptions> options(SendCallbacks, SniffContent, BufferData, AllowStoredCredentials, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, DoSecurityCheck, FetchOptions::Mode::NoCors, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching);