Title: [219231] trunk/Source
Revision
219231
Author
cdu...@apple.com
Date
2017-07-06 19:44:15 -0700 (Thu, 06 Jul 2017)

Log Message

Drop unused ResourceLoadStatistics members
https://bugs.webkit.org/show_bug.cgi?id=174226

Reviewed by Brent Fulgham.

Source/WebCore:

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logFrameNavigation):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::isPrevalentResource): Deleted.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::encode):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::ResourceLoadStatistics::toString):
(WebCore::ResourceLoadStatistics::merge):
* loader/ResourceLoadStatistics.h:

Source/WebKit2:

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
(IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
* UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (219230 => 219231)


--- trunk/Source/WebCore/ChangeLog	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebCore/ChangeLog	2017-07-07 02:44:15 UTC (rev 219231)
@@ -1,3 +1,23 @@
+2017-07-06  Chris Dumez  <cdu...@apple.com>
+
+        Drop unused ResourceLoadStatistics members
+        https://bugs.webkit.org/show_bug.cgi?id=174226
+
+        Reviewed by Brent Fulgham.
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::logFrameNavigation):
+        (WebCore::ResourceLoadObserver::logSubresourceLoading):
+        (WebCore::ResourceLoadObserver::logWebSocketLoading):
+        (WebCore::ResourceLoadObserver::isPrevalentResource): Deleted.
+        * loader/ResourceLoadObserver.h:
+        * loader/ResourceLoadStatistics.cpp:
+        (WebCore::ResourceLoadStatistics::encode):
+        (WebCore::ResourceLoadStatistics::decode):
+        (WebCore::ResourceLoadStatistics::toString):
+        (WebCore::ResourceLoadStatistics::merge):
+        * loader/ResourceLoadStatistics.h:
+
 2017-07-06  Youenn Fablet  <you...@apple.com>
 
         Rendering of WebRTC audio in AudioSampleDataSource may trigger crackles

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (219230 => 219231)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2017-07-07 02:44:15 UTC (rev 219231)
@@ -520,7 +520,7 @@
     ASSERT(m_frame->document());
     ASSERT(topFrame.document());
 
-    ResourceLoadObserver::shared().logFrameNavigation(*m_frame, topFrame, newRequest, redirectResponse);
+    ResourceLoadObserver::shared().logFrameNavigation(*m_frame, topFrame, newRequest);
     
     // Update cookie policy base URL as URL changes, except for subframes, which use the
     // URL of the main frame which doesn't change when we redirect.

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (219230 => 219231)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2017-07-07 02:44:15 UTC (rev 219231)
@@ -79,7 +79,7 @@
     return Settings::resourceLoadStatisticsEnabled() && !page->usesEphemeralSession() && m_notificationCallback;
 }
 
-void ResourceLoadObserver::logFrameNavigation(const Frame& frame, const Frame& topFrame, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse)
+void ResourceLoadObserver::logFrameNavigation(const Frame& frame, const Frame& topFrame, const ResourceRequest& newRequest)
 {
     ASSERT(frame.document());
     ASSERT(topFrame.document());
@@ -88,8 +88,6 @@
     if (!shouldLog(topFrame.page()))
         return;
 
-    bool isRedirect = is3xxRedirect(redirectResponse);
-    bool isMainFrame = frame.isMainFrame();
     auto& sourceURL = frame.document()->url();
     auto& targetURL = newRequest.url();
     auto& mainFrameURL = topFrame.document()->url();
@@ -110,58 +108,18 @@
     if (targetPrimaryDomain == mainFramePrimaryDomain || targetPrimaryDomain == sourcePrimaryDomain)
         return;
 
-    auto targetStatistics = takeResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
+    auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
 
     // Always fire if we have previously removed data records for this domain
+    // FIXME: targetStatistics.dataRecordsRemoved is always 0 in WebCore as it gets populated in the UIProcess.
     bool shouldCallNotificationCallback = targetStatistics.dataRecordsRemoved > 0;
 
-    if (isMainFrame)
-        targetStatistics.topFrameHasBeenNavigatedToBefore = true;
-    else {
-        targetStatistics.subframeHasBeenLoadedBefore = true;
-
+    if (!frame.isMainFrame()) {
         auto subframeUnderTopFrameOriginsResult = targetStatistics.subframeUnderTopFrameOrigins.add(mainFramePrimaryDomain);
         if (subframeUnderTopFrameOriginsResult.isNewEntry)
             shouldCallNotificationCallback = true;
     }
 
-    if (isRedirect) {
-        auto& redirectingOriginResourceStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
-
-        if (isPrevalentResource(targetPrimaryDomain))
-            redirectingOriginResourceStatistics.redirectedToOtherPrevalentResourceOrigins.add(targetPrimaryDomain);
-
-        if (isMainFrame) {
-            ++targetStatistics.topFrameHasBeenRedirectedTo;
-            ++redirectingOriginResourceStatistics.topFrameHasBeenRedirectedFrom;
-        } else {
-            ++targetStatistics.subframeHasBeenRedirectedTo;
-            ++redirectingOriginResourceStatistics.subframeHasBeenRedirectedFrom;
-            redirectingOriginResourceStatistics.subframeUniqueRedirectsTo.add(targetPrimaryDomain);
-
-            ++targetStatistics.subframeSubResourceCount;
-        }
-    } else {
-        if (sourcePrimaryDomain.isNull() || sourcePrimaryDomain.isEmpty() || sourcePrimaryDomain == "nullOrigin") {
-            if (isMainFrame)
-                ++targetStatistics.topFrameInitialLoadCount;
-            else
-                ++targetStatistics.subframeSubResourceCount;
-        } else {
-            auto& sourceOriginResourceStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
-
-            if (isMainFrame) {
-                ++sourceOriginResourceStatistics.topFrameHasBeenNavigatedFrom;
-                ++targetStatistics.topFrameHasBeenNavigatedTo;
-            } else {
-                ++sourceOriginResourceStatistics.subframeHasBeenNavigatedFrom;
-                ++targetStatistics.subframeHasBeenNavigatedTo;
-            }
-        }
-    }
-
-    m_resourceStatisticsMap.set(targetPrimaryDomain, WTFMove(targetStatistics));
-
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
 }
@@ -191,43 +149,27 @@
     if (targetPrimaryDomain == mainFramePrimaryDomain || (isRedirect && targetPrimaryDomain == sourcePrimaryDomain))
         return;
 
-    auto targetStatistics = takeResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
+    bool shouldCallNotificationCallback = false;
 
-    // Always fire if we have previously removed data records for this domain
-    bool shouldCallNotificationCallback = targetStatistics.dataRecordsRemoved > 0;
+    {
+        auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
 
-    auto subresourceUnderTopFrameOriginsResult = targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain);
-    if (subresourceUnderTopFrameOriginsResult.isNewEntry)
-        shouldCallNotificationCallback = true;
+        // Always fire if we have previously removed data records for this domain
+        // FIXME: targetStatistics.dataRecordsRemoved is always 0 in WebCore as it gets populated in the UIProcess.
+        shouldCallNotificationCallback = targetStatistics.dataRecordsRemoved > 0;
 
+        auto subresourceUnderTopFrameOriginsResult = targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain);
+        if (subresourceUnderTopFrameOriginsResult.isNewEntry)
+            shouldCallNotificationCallback = true;
+    }
+
     if (isRedirect) {
         auto& redirectingOriginStatistics = ensureResourceStatisticsForPrimaryDomain(sourcePrimaryDomain);
-
-        if (isPrevalentResource(targetPrimaryDomain))
-            redirectingOriginStatistics.redirectedToOtherPrevalentResourceOrigins.add(targetPrimaryDomain);
-
-        ++redirectingOriginStatistics.subresourceHasBeenRedirectedFrom;
-        ++targetStatistics.subresourceHasBeenRedirectedTo;
-
         auto subresourceUniqueRedirectsToResult = redirectingOriginStatistics.subresourceUniqueRedirectsTo.add(targetPrimaryDomain);
         if (subresourceUniqueRedirectsToResult.isNewEntry)
             shouldCallNotificationCallback = true;
-
-        ++targetStatistics.subresourceHasBeenSubresourceCount;
-
-        auto totalVisited = std::max(m_originsVisitedMap.size(), 1U);
-
-        targetStatistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited = static_cast<double>(targetStatistics.subresourceHasBeenSubresourceCount) / totalVisited;
-    } else {
-        ++targetStatistics.subresourceHasBeenSubresourceCount;
-
-        auto totalVisited = std::max(m_originsVisitedMap.size(), 1U);
-
-        targetStatistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited = static_cast<double>(targetStatistics.subresourceHasBeenSubresourceCount) / totalVisited;
     }
 
-    m_resourceStatisticsMap.set(targetPrimaryDomain, WTFMove(targetStatistics));
-
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
 }
@@ -259,6 +201,7 @@
     auto& targetStatistics = ensureResourceStatisticsForPrimaryDomain(targetPrimaryDomain);
 
     // Always fire if we have previously removed data records for this domain
+    // FIXME: targetStatistics.dataRecordsRemoved is always 0 in WebCore as it gets populated in the UIProcess.
     bool shouldCallNotificationCallback = targetStatistics.dataRecordsRemoved > 0;
 
     auto subresourceUnderTopFrameOriginsResult = targetStatistics.subresourceUnderTopFrameOrigins.add(mainFramePrimaryDomain);
@@ -265,12 +208,6 @@
     if (subresourceUnderTopFrameOriginsResult.isNewEntry)
         shouldCallNotificationCallback = true;
 
-    ++targetStatistics.subresourceHasBeenSubresourceCount;
-
-    auto totalVisited = std::max(m_originsVisitedMap.size(), 1U);
-
-    targetStatistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited = static_cast<double>(targetStatistics.subresourceHasBeenSubresourceCount) / totalVisited;
-
     if (shouldCallNotificationCallback)
         scheduleNotificationIfNeeded();
 }
@@ -310,23 +247,6 @@
     return addResult.iterator->value;
 }
 
-ResourceLoadStatistics ResourceLoadObserver::takeResourceStatisticsForPrimaryDomain(const String& primaryDomain)
-{
-    auto statististics = m_resourceStatisticsMap.take(primaryDomain);
-    if (statististics.highLevelDomain.isNull())
-        statististics.highLevelDomain = primaryDomain;
-    ASSERT(statististics.highLevelDomain == primaryDomain);
-    return statististics;
-}
-
-bool ResourceLoadObserver::isPrevalentResource(const String& primaryDomain) const
-{
-    auto mapEntry = m_resourceStatisticsMap.find(primaryDomain);
-    if (mapEntry == m_resourceStatisticsMap.end())
-        return false;
-    return mapEntry->value.isPrevalentResource;
-}
-
 void ResourceLoadObserver::scheduleNotificationIfNeeded()
 {
     ASSERT(m_notificationCallback);

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (219230 => 219231)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.h	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.h	2017-07-07 02:44:15 UTC (rev 219231)
@@ -51,7 +51,7 @@
 public:
     WEBCORE_EXPORT static ResourceLoadObserver& shared();
     
-    void logFrameNavigation(const Frame& frame, const Frame& topFrame, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse);
+    void logFrameNavigation(const Frame&, const Frame& topFrame, const ResourceRequest& newRequest);
     void logSubresourceLoading(const Frame*, const ResourceRequest& newRequest, const ResourceResponse& redirectResponse);
     void logWebSocketLoading(const Frame*, const URL&);
     void logUserInteractionWithReducedTimeResolution(const Document&);
@@ -65,8 +65,6 @@
 
     bool shouldLog(Page*) const;
     ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
-    ResourceLoadStatistics takeResourceStatisticsForPrimaryDomain(const String& primaryDomain);
-    bool isPrevalentResource(const String& primaryDomain) const;
 
     void scheduleNotificationIfNeeded();
     void notificationTimerFired();
@@ -75,7 +73,6 @@
     HashMap<String, ResourceLoadStatistics> m_resourceStatisticsMap;
     WTF::Function<void (Vector<ResourceLoadStatistics>&&)> m_notificationCallback;
     Timer m_notificationTimer;
-    HashMap<String, size_t> m_originsVisitedMap;
 };
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (219230 => 219231)


--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp	2017-07-07 02:44:15 UTC (rev 219231)
@@ -55,34 +55,14 @@
     encoder.encodeDouble("mostRecentUserInteraction", mostRecentUserInteractionTime.secondsSinceEpoch().value());
     encoder.encodeBool("grandfathered", grandfathered);
     
-    // Top frame stats
-    encoder.encodeBool("topFrameHasBeenNavigatedToBefore", topFrameHasBeenNavigatedToBefore);
-    encoder.encodeUInt32("topFrameHasBeenRedirectedTo", topFrameHasBeenRedirectedTo);
-    encoder.encodeUInt32("topFrameHasBeenRedirectedFrom", topFrameHasBeenRedirectedFrom);
-    encoder.encodeUInt32("topFrameInitialLoadCount", topFrameInitialLoadCount);
-    encoder.encodeUInt32("topFrameHasBeenNavigatedTo", topFrameHasBeenNavigatedTo);
-    encoder.encodeUInt32("topFrameHasBeenNavigatedFrom", topFrameHasBeenNavigatedFrom);
-    
     // Subframe stats
-    encoder.encodeBool("subframeHasBeenLoadedBefore", subframeHasBeenLoadedBefore);
-    encoder.encodeUInt32("subframeHasBeenRedirectedTo", subframeHasBeenRedirectedTo);
-    encoder.encodeUInt32("subframeHasBeenRedirectedFrom", subframeHasBeenRedirectedFrom);
-    encoder.encodeUInt32("subframeSubResourceCount", subframeSubResourceCount);
     encodeHashCountedSet(encoder, "subframeUnderTopFrameOrigins", subframeUnderTopFrameOrigins);
-    encodeHashCountedSet(encoder, "subframeUniqueRedirectsTo", subframeUniqueRedirectsTo);
-    encoder.encodeUInt32("subframeHasBeenNavigatedTo", subframeHasBeenNavigatedTo);
-    encoder.encodeUInt32("subframeHasBeenNavigatedFrom", subframeHasBeenNavigatedFrom);
     
     // Subresource stats
-    encoder.encodeUInt32("subresourceHasBeenRedirectedFrom", subresourceHasBeenRedirectedFrom);
-    encoder.encodeUInt32("subresourceHasBeenRedirectedTo", subresourceHasBeenRedirectedTo);
-    encoder.encodeUInt32("subresourceHasBeenSubresourceCount", subresourceHasBeenSubresourceCount);
-    encoder.encodeDouble("subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited", subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited);
     encodeHashCountedSet(encoder, "subresourceUnderTopFrameOrigins", subresourceUnderTopFrameOrigins);
     encodeHashCountedSet(encoder, "subresourceUniqueRedirectsTo", subresourceUniqueRedirectsTo);
     
     // Prevalent Resource
-    encodeHashCountedSet(encoder, "redirectedToOtherPrevalentResourceOrigins", redirectedToOtherPrevalentResourceOrigins);
     encoder.encodeBool("isPrevalentResource", isPrevalentResource);
     encoder.encodeUInt32("dataRecordsRemoved", dataRecordsRemoved);
 }
@@ -103,7 +83,7 @@
     });
 }
 
-bool ResourceLoadStatistics::decode(KeyedDecoder& decoder, unsigned version)
+bool ResourceLoadStatistics::decode(KeyedDecoder& decoder)
 {
     if (!decoder.decodeString("PrevalentResourceOrigin", highLevelDomain))
         return false;
@@ -112,78 +92,20 @@
     if (!decoder.decodeBool("hadUserInteraction", hadUserInteraction))
         return false;
     
-    // Top frame stats
-    if (!decoder.decodeBool("topFrameHasBeenNavigatedToBefore", topFrameHasBeenNavigatedToBefore))
-        return false;
-    
-    if (!decoder.decodeUInt32("topFrameHasBeenRedirectedTo", topFrameHasBeenRedirectedTo))
-        return false;
-    
-    if (!decoder.decodeUInt32("topFrameHasBeenRedirectedFrom", topFrameHasBeenRedirectedFrom))
-        return false;
-    
-    if (!decoder.decodeUInt32("topFrameInitialLoadCount", topFrameInitialLoadCount))
-        return false;
-    
-    if (!decoder.decodeUInt32("topFrameHasBeenNavigatedTo", topFrameHasBeenNavigatedTo))
-        return false;
-    
-    if (!decoder.decodeUInt32("topFrameHasBeenNavigatedFrom", topFrameHasBeenNavigatedFrom))
-        return false;
-    
     // Subframe stats
-    if (!decoder.decodeBool("subframeHasBeenLoadedBefore", subframeHasBeenLoadedBefore))
-        return false;
-    
-    if (!decoder.decodeUInt32("subframeHasBeenRedirectedTo", subframeHasBeenRedirectedTo))
-        return false;
-    
-    if (!decoder.decodeUInt32("subframeHasBeenRedirectedFrom", subframeHasBeenRedirectedFrom))
-        return false;
-    
-    if (!decoder.decodeUInt32("subframeSubResourceCount", subframeSubResourceCount))
-        return false;
-
     decodeHashCountedSet(decoder, "subframeUnderTopFrameOrigins", subframeUnderTopFrameOrigins);
-    decodeHashCountedSet(decoder, "subframeUniqueRedirectsTo", subframeUniqueRedirectsTo);
     
-    if (!decoder.decodeUInt32("subframeHasBeenNavigatedTo", subframeHasBeenNavigatedTo))
-        return false;
-    
-    if (!decoder.decodeUInt32("subframeHasBeenNavigatedFrom", subframeHasBeenNavigatedFrom))
-        return false;
-    
     // Subresource stats
-    if (!decoder.decodeUInt32("subresourceHasBeenRedirectedFrom", subresourceHasBeenRedirectedFrom))
-        return false;
-    
-    if (!decoder.decodeUInt32("subresourceHasBeenRedirectedTo", subresourceHasBeenRedirectedTo))
-        return false;
-    
-    if (!decoder.decodeUInt32("subresourceHasBeenSubresourceCount", subresourceHasBeenSubresourceCount))
-        return false;
-    
-    if (!decoder.decodeDouble("subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited", subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited))
-        return false;
-
     decodeHashCountedSet(decoder, "subresourceUnderTopFrameOrigins", subresourceUnderTopFrameOrigins);
     decodeHashCountedSet(decoder, "subresourceUniqueRedirectsTo", subresourceUniqueRedirectsTo);
     
     // Prevalent Resource
-    decodeHashCountedSet(decoder, "redirectedToOtherPrevalentResourceOrigins", redirectedToOtherPrevalentResourceOrigins);
-    
     if (!decoder.decodeBool("isPrevalentResource", isPrevalentResource))
         return false;
 
-    if (version < 2)
-        return true;
-
     if (!decoder.decodeUInt32("dataRecordsRemoved", dataRecordsRemoved))
         return false;
 
-    if (version < 3)
-        return true;
-
     double mostRecentUserInteractionTimeAsDouble;
     if (!decoder.decodeDouble("mostRecentUserInteraction", mostRecentUserInteractionTimeAsDouble))
         return false;
@@ -234,64 +156,14 @@
     appendBoolean(builder, "    grandfathered", grandfathered);
     builder.append('\n');
     
-    // Top frame stats
-    appendBoolean(builder, "topFrameHasBeenNavigatedToBefore", topFrameHasBeenNavigatedToBefore);
-    builder.append('\n');
-    builder.appendLiteral("    topFrameHasBeenRedirectedTo: ");
-    builder.appendNumber(topFrameHasBeenRedirectedTo);
-    builder.append('\n');
-    builder.appendLiteral("    topFrameHasBeenRedirectedFrom: ");
-    builder.appendNumber(topFrameHasBeenRedirectedFrom);
-    builder.append('\n');
-    builder.appendLiteral("    topFrameInitialLoadCount: ");
-    builder.appendNumber(topFrameInitialLoadCount);
-    builder.append('\n');
-    builder.appendLiteral("    topFrameHasBeenNavigatedTo: ");
-    builder.appendNumber(topFrameHasBeenNavigatedTo);
-    builder.append('\n');
-    builder.appendLiteral("    topFrameHasBeenNavigatedFrom: ");
-    builder.appendNumber(topFrameHasBeenNavigatedFrom);
-    builder.append('\n');
-    
     // Subframe stats
-    appendBoolean(builder, "subframeHasBeenLoadedBefore", subframeHasBeenLoadedBefore);
-    builder.append('\n');
-    builder.appendLiteral("    subframeHasBeenRedirectedTo: ");
-    builder.appendNumber(subframeHasBeenRedirectedTo);
-    builder.append('\n');
-    builder.appendLiteral("    subframeHasBeenRedirectedFrom: ");
-    builder.appendNumber(subframeHasBeenRedirectedFrom);
-    builder.append('\n');
-    builder.appendLiteral("    subframeSubResourceCount: ");
-    builder.appendNumber(subframeSubResourceCount);
-    builder.append('\n');
     appendHashCountedSet(builder, "subframeUnderTopFrameOrigins", subframeUnderTopFrameOrigins);
-    appendHashCountedSet(builder, "subframeUniqueRedirectsTo", subframeUniqueRedirectsTo);
-    builder.appendLiteral("    subframeHasBeenNavigatedTo: ");
-    builder.appendNumber(subframeHasBeenNavigatedTo);
-    builder.append('\n');
-    builder.appendLiteral("    subframeHasBeenNavigatedFrom: ");
-    builder.appendNumber(subframeHasBeenNavigatedFrom);
-    builder.append('\n');
     
     // Subresource stats
-    builder.appendLiteral("    subresourceHasBeenRedirectedFrom: ");
-    builder.appendNumber(subresourceHasBeenRedirectedFrom);
-    builder.append('\n');
-    builder.appendLiteral("    subresourceHasBeenRedirectedTo: ");
-    builder.appendNumber(subresourceHasBeenRedirectedTo);
-    builder.append('\n');
-    builder.appendLiteral("    subresourceHasBeenSubresourceCount: ");
-    builder.appendNumber(subresourceHasBeenSubresourceCount);
-    builder.append('\n');
-    builder.appendLiteral("    subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited: ");
-    builder.appendNumber(subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited);
-    builder.append('\n');
     appendHashCountedSet(builder, "subresourceUnderTopFrameOrigins", subresourceUnderTopFrameOrigins);
     appendHashCountedSet(builder, "subresourceUniqueRedirectsTo", subresourceUniqueRedirectsTo);
     
     // Prevalent Resource
-    appendHashCountedSet(builder, "redirectedToOtherPrevalentResourceOrigins", redirectedToOtherPrevalentResourceOrigins);
     appendBoolean(builder, "isPrevalentResource", isPrevalentResource);
     builder.appendLiteral("    dataRecordsRemoved: ");
     builder.appendNumber(dataRecordsRemoved);
@@ -331,33 +203,14 @@
     }
     grandfathered |= other.grandfathered;
     
-    // Top frame stats
-    topFrameHasBeenRedirectedTo += other.topFrameHasBeenRedirectedTo;
-    topFrameHasBeenRedirectedFrom += other.topFrameHasBeenRedirectedFrom;
-    topFrameInitialLoadCount += other.topFrameInitialLoadCount;
-    topFrameHasBeenNavigatedTo += other.topFrameHasBeenNavigatedTo;
-    topFrameHasBeenNavigatedFrom += other.topFrameHasBeenNavigatedFrom;
-    topFrameHasBeenNavigatedToBefore |= other.topFrameHasBeenNavigatedToBefore;
-    
     // Subframe stats
     mergeHashCountedSet(subframeUnderTopFrameOrigins, other.subframeUnderTopFrameOrigins);
-    subframeHasBeenRedirectedTo += other.subframeHasBeenRedirectedTo;
-    subframeHasBeenRedirectedFrom += other.subframeHasBeenRedirectedFrom;
-    mergeHashCountedSet(subframeUniqueRedirectsTo, other.subframeUniqueRedirectsTo);
-    subframeSubResourceCount += other.subframeSubResourceCount;
-    subframeHasBeenNavigatedTo += other.subframeHasBeenNavigatedTo;
-    subframeHasBeenNavigatedFrom += other.subframeHasBeenNavigatedFrom;
-    subframeHasBeenLoadedBefore |= other.subframeHasBeenLoadedBefore;
     
     // Subresource stats
     mergeHashCountedSet(subresourceUnderTopFrameOrigins, other.subresourceUnderTopFrameOrigins);
-    subresourceHasBeenSubresourceCount += other.subresourceHasBeenSubresourceCount;
-    subresourceHasBeenRedirectedFrom += other.subresourceHasBeenRedirectedFrom;
-    subresourceHasBeenRedirectedTo += other.subresourceHasBeenRedirectedTo;
     mergeHashCountedSet(subresourceUniqueRedirectsTo, other.subresourceUniqueRedirectsTo);
     
     // Prevalent resource stats
-    mergeHashCountedSet(redirectedToOtherPrevalentResourceOrigins, other.redirectedToOtherPrevalentResourceOrigins);
     isPrevalentResource |= other.isPrevalentResource;
     dataRecordsRemoved += other.dataRecordsRemoved;
     

Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.h (219230 => 219231)


--- trunk/Source/WebCore/loader/ResourceLoadStatistics.h	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.h	2017-07-07 02:44:15 UTC (rev 219231)
@@ -53,7 +53,7 @@
     WEBCORE_EXPORT static String primaryDomain(const String& host);
 
     WEBCORE_EXPORT void encode(KeyedEncoder&) const;
-    WEBCORE_EXPORT bool decode(KeyedDecoder&, unsigned version);
+    WEBCORE_EXPORT bool decode(KeyedDecoder&);
 
     String toString() const;
 
@@ -66,35 +66,15 @@
     // Timestamp. Default value is negative, 0 means it was reset.
     WallTime mostRecentUserInteractionTime { WallTime::fromRawSeconds(-1) };
     bool grandfathered { false };
-
-    // Top frame stats
-    unsigned topFrameHasBeenRedirectedTo { 0 };
-    unsigned topFrameHasBeenRedirectedFrom { 0 };
-    unsigned topFrameInitialLoadCount { 0 };
-    unsigned topFrameHasBeenNavigatedTo { 0 };
-    unsigned topFrameHasBeenNavigatedFrom { 0 };
-    bool topFrameHasBeenNavigatedToBefore { false };
     
     // Subframe stats
     HashCountedSet<String> subframeUnderTopFrameOrigins;
-    unsigned subframeHasBeenRedirectedTo { 0 };
-    unsigned subframeHasBeenRedirectedFrom { 0 };
-    HashCountedSet<String> subframeUniqueRedirectsTo;
-    unsigned subframeSubResourceCount { 0 };
-    unsigned subframeHasBeenNavigatedTo { 0 };
-    unsigned subframeHasBeenNavigatedFrom { 0 };
-    bool subframeHasBeenLoadedBefore { false };
     
     // Subresource stats
     HashCountedSet<String> subresourceUnderTopFrameOrigins;
-    unsigned subresourceHasBeenSubresourceCount { 0 };
-    double subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited { 0.0 };
-    unsigned subresourceHasBeenRedirectedFrom { 0 };
-    unsigned subresourceHasBeenRedirectedTo { 0 };
     HashCountedSet<String> subresourceUniqueRedirectsTo;
     
     // Prevalent resource stats
-    HashCountedSet<String> redirectedToOtherPrevalentResourceOrigins;
     bool isPrevalentResource { false };
     unsigned dataRecordsRemoved { 0 };
 

Modified: trunk/Source/WebKit2/ChangeLog (219230 => 219231)


--- trunk/Source/WebKit2/ChangeLog	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebKit2/ChangeLog	2017-07-07 02:44:15 UTC (rev 219231)
@@ -1,3 +1,16 @@
+2017-07-06  Chris Dumez  <cdu...@apple.com>
+
+        Drop unused ResourceLoadStatistics members
+        https://bugs.webkit.org/show_bug.cgi?id=174226
+
+        Reviewed by Brent Fulgham.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<ResourceLoadStatistics>::encode):
+        (IPC::ArgumentCoder<ResourceLoadStatistics>::decode):
+        * UIProcess/Storage/ResourceLoadStatisticsStore.cpp:
+        (WebKit::ResourceLoadStatisticsStore::readDataFromDecoder):
+
 2017-07-06  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Unreviewed, fix the internal iOS 11 build

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (219230 => 219231)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2017-07-07 02:44:15 UTC (rev 219231)
@@ -2247,34 +2247,14 @@
     encoder << statistics.mostRecentUserInteractionTime.secondsSinceEpoch().value();
     encoder << statistics.grandfathered;
     
-    // Top frame stats
-    encoder << statistics.topFrameHasBeenNavigatedToBefore;
-    encoder << statistics.topFrameHasBeenRedirectedTo;
-    encoder << statistics.topFrameHasBeenRedirectedFrom;
-    encoder << statistics.topFrameInitialLoadCount;
-    encoder << statistics.topFrameHasBeenNavigatedTo;
-    encoder << statistics.topFrameHasBeenNavigatedFrom;
-    
     // Subframe stats
-    encoder << statistics.subframeHasBeenLoadedBefore;
-    encoder << statistics.subframeHasBeenRedirectedTo;
-    encoder << statistics.subframeHasBeenRedirectedFrom;
-    encoder << statistics.subframeSubResourceCount;
     encoder << statistics.subframeUnderTopFrameOrigins;
-    encoder << statistics.subframeUniqueRedirectsTo;
-    encoder << statistics.subframeHasBeenNavigatedTo;
-    encoder << statistics.subframeHasBeenNavigatedFrom;
     
     // Subresource stats
-    encoder << statistics.subresourceHasBeenRedirectedFrom;
-    encoder << statistics.subresourceHasBeenRedirectedTo;
-    encoder << statistics.subresourceHasBeenSubresourceCount;
-    encoder << statistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited;
     encoder << statistics.subresourceUnderTopFrameOrigins;
     encoder << statistics.subresourceUniqueRedirectsTo;
     
     // Prevalent Resource
-    encoder << statistics.redirectedToOtherPrevalentResourceOrigins;
     encoder << statistics.isPrevalentResource;
     encoder << statistics.dataRecordsRemoved;
 }
@@ -2296,63 +2276,11 @@
     if (!decoder.decode(statistics.grandfathered))
         return false;
     
-    // Top frame stats
-    if (!decoder.decode(statistics.topFrameHasBeenNavigatedToBefore))
-        return false;
-    
-    if (!decoder.decode(statistics.topFrameHasBeenRedirectedTo))
-        return false;
-    
-    if (!decoder.decode(statistics.topFrameHasBeenRedirectedFrom))
-        return false;
-    
-    if (!decoder.decode(statistics.topFrameInitialLoadCount))
-        return false;
-    
-    if (!decoder.decode(statistics.topFrameHasBeenNavigatedTo))
-        return false;
-    
-    if (!decoder.decode(statistics.topFrameHasBeenNavigatedFrom))
-        return false;
-    
     // Subframe stats
-    if (!decoder.decode(statistics.subframeHasBeenLoadedBefore))
-        return false;
-    
-    if (!decoder.decode(statistics.subframeHasBeenRedirectedTo))
-        return false;
-    
-    if (!decoder.decode(statistics.subframeHasBeenRedirectedFrom))
-        return false;
-    
-    if (!decoder.decode(statistics.subframeSubResourceCount))
-        return false;
-    
     if (!decoder.decode(statistics.subframeUnderTopFrameOrigins))
         return false;
-
-    if (!decoder.decode(statistics.subframeUniqueRedirectsTo))
-        return false;
     
-    if (!decoder.decode(statistics.subframeHasBeenNavigatedTo))
-        return false;
-    
-    if (!decoder.decode(statistics.subframeHasBeenNavigatedFrom))
-        return false;
-    
     // Subresource stats
-    if (!decoder.decode(statistics.subresourceHasBeenRedirectedFrom))
-        return false;
-    
-    if (!decoder.decode(statistics.subresourceHasBeenRedirectedTo))
-        return false;
-    
-    if (!decoder.decode(statistics.subresourceHasBeenSubresourceCount))
-        return false;
-    
-    if (!decoder.decode(statistics.subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited))
-        return false;
-    
     if (!decoder.decode(statistics.subresourceUnderTopFrameOrigins))
         return false;
 
@@ -2360,9 +2288,6 @@
         return false;
     
     // Prevalent Resource
-    if (!decoder.decode(statistics.redirectedToOtherPrevalentResourceOrigins))
-        return false;
-    
     if (!decoder.decode(statistics.isPrevalentResource))
         return false;
 

Modified: trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp (219230 => 219231)


--- trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp	2017-07-07 01:56:42 UTC (rev 219230)
+++ trunk/Source/WebKit2/UIProcess/Storage/ResourceLoadStatisticsStore.cpp	2017-07-07 02:44:15 UTC (rev 219231)
@@ -39,7 +39,7 @@
 
 using namespace WebCore;
 
-static const auto statisticsModelVersion = 4;
+static const auto statisticsModelVersion = 5;
 static Seconds timeToLiveUserInteraction { 24_h * 30. };
 static Seconds timeToLiveCookiePartitionFree { 24_h };
 static Seconds grandfatheringTime { 1_h };
@@ -102,22 +102,22 @@
     if (m_resourceStatisticsMap.size())
         return;
 
-    unsigned version;
-    if (!decoder.decodeUInt32("version", version))
-        version = 1;
+    unsigned versionOnDisk;
+    if (!decoder.decodeUInt32("version", versionOnDisk))
+        return;
 
-    static const auto minimumVersionWithGrandfathering = 3;
-    if (version > minimumVersionWithGrandfathering) {
-        double endOfGrandfatheringTimestamp;
-        if (decoder.decodeDouble("endOfGrandfatheringTimestamp", endOfGrandfatheringTimestamp))
-            m_endOfGrandfatheringTimestamp = WallTime::fromRawSeconds(endOfGrandfatheringTimestamp);
-        else
-            m_endOfGrandfatheringTimestamp = { };
-    }
+    if (versionOnDisk != statisticsModelVersion)
+        return;
 
+    double endOfGrandfatheringTimestamp;
+    if (decoder.decodeDouble("endOfGrandfatheringTimestamp", endOfGrandfatheringTimestamp))
+        m_endOfGrandfatheringTimestamp = WallTime::fromRawSeconds(endOfGrandfatheringTimestamp);
+    else
+        m_endOfGrandfatheringTimestamp = { };
+
     Vector<ResourceLoadStatistics> loadedStatistics;
-    bool succeeded = decoder.decodeObjects("browsingStatistics", loadedStatistics, [version](KeyedDecoder& decoderInner, ResourceLoadStatistics& statistics) {
-        return statistics.decode(decoderInner, version);
+    bool succeeded = decoder.decodeObjects("browsingStatistics", loadedStatistics, [](KeyedDecoder& decoderInner, ResourceLoadStatistics& statistics) {
+        return statistics.decode(decoderInner);
     });
 
     if (!succeeded)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to