Title: [179217] branches/safari-600.1.4.15-branch/Source/WebCore

Diff

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179216 => 179217)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-27 22:07:50 UTC (rev 179216)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-27 22:22:24 UTC (rev 179217)
@@ -1,5 +1,24 @@
 2015-01-27  Lucas Forschler  <[email protected]>
 
+        Merge r177581
+
+    2014-12-19  Chris Dumez  <[email protected]>
+
+            [iOS] Log how successful the memory cache is using FeatureCounter
+            https://bugs.webkit.org/show_bug.cgi?id=139802
+
+            Reviewed by Andreas Kling.
+
+            Log how successful the memory cache is using FeatureCounter and why we
+            choose not to use the resource in the memory cache when it is present.
+
+            * loader/cache/CachedResourceLoader.cpp:
+            (WebCore::CachedResourceLoader::requestResource):
+            (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+            * platform/FeatureCounterKeys.h:
+
+2015-01-27  Lucas Forschler  <[email protected]>
+
         Merge r177504
 
     2014-12-18  Chris Dumez  <[email protected]>

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp (179216 => 179217)


--- branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-01-27 22:07:50 UTC (rev 179216)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp	2015-01-27 22:22:24 UTC (rev 179217)
@@ -41,6 +41,7 @@
 #include "DOMWindow.h"
 #include "Document.h"
 #include "DocumentLoader.h"
+#include "FeatureCounter.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
@@ -452,20 +453,28 @@
 
     resource = memoryCache()->resourceForRequest(request.resourceRequest(), sessionID());
 
+    Page* page = frame() ? frame()->page() : nullptr;
+    FEATURE_COUNTER_INCREMENT_KEY(page, resource ? FeatureCounterResourceRequestInMemoryCacheKey : FeatureCounterResourceRequestNotInMemoryCacheKey);
+
     const RevalidationPolicy policy = determineRevalidationPolicy(type, request.mutableResourceRequest(), request.forPreload(), resource.get(), request.defer());
     switch (policy) {
     case Reload:
         memoryCache()->remove(resource.get());
         FALLTHROUGH;
     case Load:
+        if (resource)
+            FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedKey);
         resource = loadResource(type, request);
         break;
     case Revalidate:
+        if (resource)
+            FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheRevalidatingKey);
         resource = revalidateResource(request, resource.get());
         break;
     case Use:
         if (!shouldContinueAfterNotifyingLoadedFromMemoryCache(request, resource.get()))
             return 0;
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUsedKey);
         memoryCache()->resourceAccessed(resource.get());
         break;
     }
@@ -567,9 +576,12 @@
     if (forPreload && existingResource->isPreloaded())
         return Use;
 
+    Page* page = frame() ? frame()->page() : nullptr;
+
     // If the same URL has been loaded as a different type, we need to reload.
     if (existingResource->type() != type) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to type mismatch.");
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedReasonTypeMismatchKey);
         return Reload;
     }
 
@@ -599,6 +611,7 @@
     // Don't reuse resources with Cache-control: no-store.
     if (existingResource->response().cacheControlContainsNoStore()) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to Cache-control: no-store.");
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedReasonNoStoreKey);
         return Reload;
     }
 
@@ -610,6 +623,7 @@
     // client's requests are made without CORS and some with.
     if (existingResource->resourceRequest().allowCookies() != request.allowCookies()) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to difference in credentials settings.");
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedReasonCredentialSettingsKey);
         return Reload;
     }
 
@@ -620,12 +634,14 @@
     // CachePolicyReload always reloads
     if (cachePolicy(type) == CachePolicyReload) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to CachePolicyReload.");
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedReasonReloadKey);
         return Reload;
     }
     
     // We'll try to reload the resource if it failed last time.
     if (existingResource->errorOccurred()) {
         LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicye reloading due to resource being in the error state");
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedReasonErrorKey);
         return Reload;
     }
     
@@ -640,7 +656,8 @@
             return Revalidate;
         
         // No, must reload.
-        LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to missing cache validators.");            
+        LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to missing cache validators.");
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterResourceRequestInMemoryCacheUnusedReasonMustRevalidateNoValidatorKey);
         return Reload;
     }
 

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h (179216 => 179217)


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h	2015-01-27 22:07:50 UTC (rev 179216)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h	2015-01-27 22:22:24 UTC (rev 179217)
@@ -79,6 +79,20 @@
 static const char FeatureCounterNavigationSame[] = "com.apple.WebKit.navigation.same";
 static const char FeatureCounterNavigationReloadFromOrigin[] = "com.apple.WebKit.navigation.reloadFromOrigin";
 
+// Memory cache.
+static const char FeatureCounterResourceRequestInMemoryCacheKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache";
+static const char FeatureCounterResourceRequestNotInMemoryCacheKey[] = "com.apple.WebKit.resourceRequest.notInMemoryCache";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused";
+static const char FeatureCounterResourceRequestInMemoryCacheUsedKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.used";
+static const char FeatureCounterResourceRequestInMemoryCacheRevalidatingKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.revalidating";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonNoStoreKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.noStore";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonTypeMismatchKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.typeMismatch";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonRedirectChainKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.redirectChain";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonCredentialSettingsKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.credentialSettings";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonReloadKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.reload";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonErrorKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.error";
+static const char FeatureCounterResourceRequestInMemoryCacheUnusedReasonMustRevalidateNoValidatorKey[] = "com.apple.WebKit.resourceRequest.inMemoryCache.unused.reason.mustRevalidateNoValidator";
+
 } // namespace WebCore
 
 #endif // FeatureCounterKeys_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to