Diff
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog 2015-01-27 21:27:09 UTC (rev 179210)
@@ -1,5 +1,37 @@
2015-01-27 Lucas Forschler <[email protected]>
+ Merge r177499
+
+ 2014-12-18 Chris Dumez <[email protected]>
+
+ [iOS] Log why cached resources are being revalidated using FeatureCounter API
+ https://bugs.webkit.org/show_bug.cgi?id=139759
+ <rdar://problem/19288177>
+
+ Reviewed by Antti Koivisto.
+
+ Log why cached resources are being revalidated using FeatureCounter API.
+ Also log if revalidation is successful or not.
+
+ No new tests, no behavior change.
+
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::willSendRequest):
+ (WebCore::SubresourceLoader::didReceiveResponse):
+ * loader/cache/CachedImage.cpp:
+ (WebCore::CachedImage::mustRevalidateDueToCacheHeaders):
+ * loader/cache/CachedImage.h:
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::failBeforeStarting):
+ (WebCore::CachedResource::mustRevalidateDueToCacheHeaders):
+ * loader/cache/CachedResource.h:
+ (WebCore::CachedResource::loader):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+ * platform/FeatureCounterKeys.h:
+
+2015-01-27 Lucas Forschler <[email protected]>
+
Merge r177455
2014-12-17 Chris Dumez <[email protected]>
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/SubresourceLoader.cpp (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/SubresourceLoader.cpp 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/SubresourceLoader.cpp 2015-01-27 21:27:09 UTC (rev 179210)
@@ -32,6 +32,7 @@
#include "CachedResourceLoader.h"
#include "Document.h"
#include "DocumentLoader.h"
+#include "FeatureCounter.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "Logging.h"
@@ -158,6 +159,7 @@
if (newRequest.isConditional() && m_resource->resourceToRevalidate() && newRequest.url() != m_resource->resourceToRevalidate()->response().url()) {
newRequest.makeUnconditional();
memoryCache()->revalidationFailed(m_resource);
+ FEATURE_COUNTER_INCREMENT_KEY(m_frame ? m_frame->page() : nullptr, FeatureCounterCachedResourceRevalidationFailureKey);
}
if (!m_documentLoader->cachedResourceLoader().canRequest(m_resource->type(), newRequest.url(), options())) {
@@ -201,12 +203,14 @@
// Existing resource is ok, just use it updating the expiration time.
m_resource->setResponse(response);
memoryCache()->revalidationSucceeded(m_resource, response);
+ FEATURE_COUNTER_INCREMENT_KEY(m_frame ? m_frame->page() : nullptr, FeatureCounterCachedResourceRevalidationSuccessKey);
if (!reachedTerminalState())
ResourceLoader::didReceiveResponse(response);
return;
}
// Did not get 304 response, continue as a regular resource load.
memoryCache()->revalidationFailed(m_resource);
+ FEATURE_COUNTER_INCREMENT_KEY(m_frame ? m_frame->page() : nullptr, FeatureCounterCachedResourceRevalidationFailureKey);
}
m_resource->responseReceived(response);
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedImage.cpp (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedImage.cpp 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedImage.cpp 2015-01-27 21:27:09 UTC (rev 179210)
@@ -568,7 +568,7 @@
return !securityOrigin->taintsCanvas(response().url());
}
-bool CachedImage::mustRevalidateDueToCacheHeaders(CachePolicy policy) const
+bool CachedImage::mustRevalidateDueToCacheHeaders(const CachedResourceLoader& cachedResourceLoader, CachePolicy policy) const
{
if (UNLIKELY(isManuallyCached())) {
// Do not revalidate manually cached images. This mechanism is used as a
@@ -578,7 +578,7 @@
// incumbent on the client to only use valid resources.
return false;
}
- return CachedResource::mustRevalidateDueToCacheHeaders(policy);
+ return CachedResource::mustRevalidateDueToCacheHeaders(cachedResourceLoader, policy);
}
} // namespace WebCore
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedImage.h (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedImage.h 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedImage.h 2015-01-27 21:27:09 UTC (rev 179210)
@@ -83,7 +83,7 @@
void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio);
bool isManuallyCached() const { return m_isManuallyCached; }
- virtual bool mustRevalidateDueToCacheHeaders(CachePolicy) const;
+ virtual bool mustRevalidateDueToCacheHeaders(const CachedResourceLoader&, CachePolicy) const;
#if ENABLE(DISK_IMAGE_CACHE)
virtual bool canUseDiskImageCache() const override;
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResource.cpp (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResource.cpp 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResource.cpp 2015-01-27 21:27:09 UTC (rev 179210)
@@ -31,6 +31,7 @@
#include "CrossOriginAccessControl.h"
#include "Document.h"
#include "DocumentLoader.h"
+#include "FeatureCounter.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "HTTPHeaderNames.h"
@@ -761,21 +762,29 @@
return m_response.hasCacheValidatorFields();
}
-bool CachedResource::mustRevalidateDueToCacheHeaders(CachePolicy cachePolicy) const
+bool CachedResource::mustRevalidateDueToCacheHeaders(const CachedResourceLoader& cachedResourceLoader, CachePolicy cachePolicy) const
{
ASSERT(cachePolicy == CachePolicyRevalidate || cachePolicy == CachePolicyCache || cachePolicy == CachePolicyVerify);
- if (cachePolicy == CachePolicyRevalidate)
+ if (cachePolicy == CachePolicyRevalidate) {
+ FEATURE_COUNTER_INCREMENT_KEY(cachedResourceLoader.frame()->page(), FeatureCounterCachedResourceRevalidationReasonReloadKey);
return true;
+ }
if (m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()) {
LOG(ResourceLoading, "CachedResource %p mustRevalidate because of m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()\n", this);
+ if (m_response.cacheControlContainsNoStore())
+ FEATURE_COUNTER_INCREMENT_KEY(cachedResourceLoader.frame()->page(), FeatureCounterCachedResourceRevalidationReasonNoStoreKey);
+ else
+ FEATURE_COUNTER_INCREMENT_KEY(cachedResourceLoader.frame()->page(), FeatureCounterCachedResourceRevalidationReasonNoCacheKey);
+
return true;
}
if (cachePolicy == CachePolicyCache) {
if (m_response.cacheControlContainsMustRevalidate() && isExpired()) {
LOG(ResourceLoading, "CachedResource %p mustRevalidate because of cachePolicy == CachePolicyCache and m_response.cacheControlContainsMustRevalidate() && isExpired()\n", this);
+ FEATURE_COUNTER_INCREMENT_KEY(cachedResourceLoader.frame()->page(), FeatureCounterCachedResourceRevalidationReasonMustRevalidateIsExpiredKey);
return true;
}
return false;
@@ -784,6 +793,7 @@
// CachePolicyVerify
if (isExpired()) {
LOG(ResourceLoading, "CachedResource %p mustRevalidate because of isExpired()\n", this);
+ FEATURE_COUNTER_INCREMENT_KEY(cachedResourceLoader.frame()->page(), FeatureCounterCachedResourceRevalidationReasonIsExpiredKey);
return true;
}
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResource.h (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResource.h 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResource.h 2015-01-27 21:27:09 UTC (rev 179210)
@@ -226,7 +226,7 @@
bool canUseCacheValidator() const;
- virtual bool mustRevalidateDueToCacheHeaders(CachePolicy) const;
+ virtual bool mustRevalidateDueToCacheHeaders(const CachedResourceLoader&, CachePolicy) const;
bool isCacheValidator() const { return m_resourceToRevalidate; }
CachedResource* resourceToRevalidate() const { return m_resourceToRevalidate; }
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-01-27 21:27:09 UTC (rev 179210)
@@ -634,7 +634,7 @@
return Use;
// Check if the cache headers requires us to revalidate (cache expiration for example).
- if (existingResource->mustRevalidateDueToCacheHeaders(cachePolicy(type))) {
+ if (existingResource->mustRevalidateDueToCacheHeaders(*this, cachePolicy(type))) {
// See if the resource has usable ETag or Last-modified headers.
if (existingResource->canUseCacheValidator())
return Revalidate;
Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h (179209 => 179210)
--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h 2015-01-27 21:19:18 UTC (rev 179209)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h 2015-01-27 21:27:09 UTC (rev 179210)
@@ -61,6 +61,15 @@
static const char FeatureCounterPageCacheFailureKey[] = "com.apple.WebKit.pageCache.failure";
static const char FeatureCounterPageCacheSuccessKey[] = "com.apple.WebKit.pageCache.success";
+// Cached resources revalidation.
+static const char FeatureCounterCachedResourceRevalidationSuccessKey[] = "com.apple.WebKit.cachedResourceRevalidation.success";
+static const char FeatureCounterCachedResourceRevalidationFailureKey[] = "com.apple.WebKit.cachedResourceRevalidation.failure";
+static const char FeatureCounterCachedResourceRevalidationReasonReloadKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.reload";
+static const char FeatureCounterCachedResourceRevalidationReasonNoCacheKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.noCache";
+static const char FeatureCounterCachedResourceRevalidationReasonNoStoreKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.noStore";
+static const char FeatureCounterCachedResourceRevalidationReasonMustRevalidateIsExpiredKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.mustRevalidateIsExpired";
+static const char FeatureCounterCachedResourceRevalidationReasonIsExpiredKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.isExpired";
+
} // namespace WebCore
#endif // FeatureCounterKeys_h