Title: [177735] trunk/Source
Revision
177735
Author
[email protected]
Date
2014-12-25 08:23:47 -0800 (Thu, 25 Dec 2014)

Log Message

Unreviewed, rolling out r177712 and r177717.
https://bugs.webkit.org/show_bug.cgi?id=139944

Caused flaky assertion failures (Requested by ap on #webkit).

Reverted changesets:

"[iOS] Log better using FeatureCounter why PageCache is
failing due to pruned resources"
https://bugs.webkit.org/show_bug.cgi?id=139921
http://trac.webkit.org/changeset/177712

"Unreviewed, fix build warning after r177712"
http://trac.webkit.org/changeset/177717

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (177734 => 177735)


--- trunk/Source/WebCore/ChangeLog	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/ChangeLog	2014-12-25 16:23:47 UTC (rev 177735)
@@ -1,3 +1,20 @@
+2014-12-25  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r177712 and r177717.
+        https://bugs.webkit.org/show_bug.cgi?id=139944
+
+        Caused flaky assertion failures (Requested by ap on #webkit).
+
+        Reverted changesets:
+
+        "[iOS] Log better using FeatureCounter why PageCache is
+        failing due to pruned resources"
+        https://bugs.webkit.org/show_bug.cgi?id=139921
+        http://trac.webkit.org/changeset/177712
+
+        "Unreviewed, fix build warning after r177712"
+        http://trac.webkit.org/changeset/177717
+
 2014-12-25  Andreas Kling  <[email protected]>
 
         Rebaseline bindings tests after r177733.

Modified: trunk/Source/WebCore/WebCore.exp.in (177734 => 177735)


--- trunk/Source/WebCore/WebCore.exp.in	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-12-25 16:23:47 UTC (rev 177735)
@@ -1559,7 +1559,6 @@
 __ZN7WebCore9LayerPoolC1Ev
 __ZN7WebCore9LayerPoolD1Ev
 __ZN7WebCore9PageCache11setCapacityEi
-__ZN7WebCore9PageCache18pruneToCapacityNowEiNS_13PruningReasonE
 __ZN7WebCore9PageCache33markPagesForVistedLinkStyleRecalcEv
 __ZN7WebCore9PageCache6removeEPNS_11HistoryItemE
 __ZN7WebCore9PageGroup16syncLocalStorageEv

Modified: trunk/Source/WebCore/history/HistoryItem.cpp (177734 => 177735)


--- trunk/Source/WebCore/history/HistoryItem.cpp	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/history/HistoryItem.cpp	2014-12-25 16:23:47 UTC (rev 177735)
@@ -63,7 +63,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
-    , m_pruningReason(PruningReason::None)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)
@@ -83,7 +83,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
-    , m_pruningReason(PruningReason::None)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)
@@ -105,7 +105,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
-    , m_pruningReason(PruningReason::None)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)
@@ -128,7 +128,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
-    , m_pruningReason(PruningReason::None)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)

Modified: trunk/Source/WebCore/history/HistoryItem.h (177734 => 177735)


--- trunk/Source/WebCore/history/HistoryItem.h	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/history/HistoryItem.h	2014-12-25 16:23:47 UTC (rev 177735)
@@ -53,7 +53,6 @@
 class Image;
 class ResourceRequest;
 class URL;
-enum class PruningReason;
 
 typedef Vector<RefPtr<HistoryItem>> HistoryItemVector;
 
@@ -259,7 +258,7 @@
     HistoryItem* m_next;
     HistoryItem* m_prev;
     std::unique_ptr<CachedPage> m_cachedPage;
-    PruningReason m_pruningReason;
+    bool m_wasPruned;
 
 #if PLATFORM(IOS)
     FloatRect m_exposedContentRect;

Modified: trunk/Source/WebCore/history/PageCache.cpp (177734 => 177735)


--- trunk/Source/WebCore/history/PageCache.cpp	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/history/PageCache.cpp	2014-12-25 16:23:47 UTC (rev 177735)
@@ -51,7 +51,6 @@
 #include "SharedWorkerRepository.h"
 #include "SubframeLoader.h"
 #include <wtf/CurrentTime.h>
-#include <wtf/TemporaryChange.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringConcatenate.h>
 
@@ -371,10 +370,11 @@
             || loadType == FrameLoadType::IndexedBackForward);
 }
 
-void PageCache::pruneToCapacityNow(int capacity, PruningReason pruningReason)
+void PageCache::pruneToCapacityNow(int capacity)
 {
-    TemporaryChange<int>(m_capacity, std::max(capacity, 0));
-    prune(pruningReason);
+    int savedCapacity = m_capacity;
+    setCapacity(capacity);
+    setCapacity(savedCapacity);
 }
 
 void PageCache::setCapacity(int capacity)
@@ -382,7 +382,7 @@
     ASSERT(capacity >= 0);
     m_capacity = std::max(capacity, 0);
 
-    prune(PruningReason::None);
+    prune();
 }
 
 int PageCache::frameCount() const
@@ -433,23 +433,6 @@
 }
 #endif
 
-static const char* pruningReasonToFeatureCounterKey(PruningReason pruningReason)
-{
-    switch (pruningReason) {
-    case PruningReason::MemoryPressure:
-        return FeatureCounterPageCacheFailurePrunedMemoryPressureKey;
-    case PruningReason::ProcessSuspended:
-        return FeatureCounterPageCacheFailurePrunedProcessedSuspendedKey;
-    case PruningReason::ReachedCapacity:
-        return FeatureCounterPageCacheFailurePrunedCapacityReachedKey;
-    case PruningReason::None:
-        ASSERT_NOT_REACHED();
-        return nullptr;
-    }
-    ASSERT_NOT_REACHED();
-    return nullptr;
-}
-
 void PageCache::add(PassRefPtr<HistoryItem> prpItem, Page& page)
 {
     ASSERT(prpItem);
@@ -462,11 +445,11 @@
         remove(item);
 
     item->m_cachedPage = std::make_unique<CachedPage>(page);
-    item->m_pruningReason = PruningReason::None;
+    item->m_wasPruned = false;
     addToLRUList(item);
     ++m_size;
     
-    prune(PruningReason::ReachedCapacity);
+    prune();
 }
 
 std::unique_ptr<CachedPage> PageCache::take(HistoryItem* item, Page* page)
@@ -482,8 +465,8 @@
     item->deref(); // Balanced in add().
 
     if (!cachedPage) {
-        if (item->m_pruningReason != PruningReason::None)
-            FEATURE_COUNTER_INCREMENT_KEY(page, pruningReasonToFeatureCounterKey(item->m_pruningReason));
+        if (item->m_wasPruned)
+            FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterPageCacheFailureWasPrunedKey);
         return nullptr;
     }
 
@@ -508,8 +491,8 @@
         LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", item->url().string().ascii().data());
         FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterPageCacheFailureExpiredKey);
         pageCache()->remove(item);
-    } else if (item->m_pruningReason != PruningReason::None)
-        FEATURE_COUNTER_INCREMENT_KEY(page, pruningReasonToFeatureCounterKey(item->m_pruningReason));
+    } else if (item->m_wasPruned)
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterPageCacheFailureWasPrunedKey);
 
     return nullptr;
 }
@@ -527,11 +510,11 @@
     item->deref(); // Balanced in add().
 }
 
-void PageCache::prune(PruningReason pruningReason)
+void PageCache::prune()
 {
     while (m_size > m_capacity) {
         ASSERT(m_tail && m_tail->m_cachedPage);
-        m_tail->m_pruningReason = pruningReason;
+        m_tail->m_wasPruned = true;
         remove(m_tail);
     }
 }

Modified: trunk/Source/WebCore/history/PageCache.h (177734 => 177735)


--- trunk/Source/WebCore/history/PageCache.h	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/history/PageCache.h	2014-12-25 16:23:47 UTC (rev 177735)
@@ -37,8 +37,6 @@
     class Frame;
     class HistoryItem;
     class Page;
-
-    enum class PruningReason { None, ProcessSuspended, MemoryPressure, ReachedCapacity };
     
     class PageCache {
         WTF_MAKE_NONCOPYABLE(PageCache); WTF_MAKE_FAST_ALLOCATED;
@@ -64,7 +62,7 @@
         void markPagesForFullStyleRecalc(Page*);
 
         // Used when memory is low to prune some cached pages.
-        WEBCORE_EXPORT void pruneToCapacityNow(int capacity, PruningReason);
+        void pruneToCapacityNow(int capacity);
 
 #if ENABLE(VIDEO_TRACK)
         void markPagesForCaptionPreferencesChanged();
@@ -83,7 +81,7 @@
         void addToLRUList(HistoryItem*); // Adds to the head of the list.
         void removeFromLRUList(HistoryItem*);
 
-        void prune(PruningReason);
+        void prune();
 
         int m_capacity;
         int m_size;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (177734 => 177735)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2014-12-25 16:23:47 UTC (rev 177735)
@@ -1766,11 +1766,11 @@
             LOG(MemoryPressure, "Pruning page cache because under memory pressure at: %s", __PRETTY_FUNCTION__);
             LOG(PageCache, "Pruning page cache to 0 due to memory pressure");
             // Don't cache any page if we are under memory pressure.
-            pageCache()->pruneToCapacityNow(0, PruningReason::MemoryPressure);
+            pageCache()->pruneToCapacityNow(0);
         } else if (systemMemoryLevel() <= memoryLevelThresholdToPrunePageCache) {
             LOG(MemoryPressure, "Pruning page cache because system memory level is %d at: %s", systemMemoryLevel(), __PRETTY_FUNCTION__);
             LOG(PageCache, "Pruning page cache to %d due to low memory (level %d less or equal to %d threshold)", pageCache()->capacity() / 2, systemMemoryLevel(), memoryLevelThresholdToPrunePageCache);
-            pageCache()->pruneToCapacityNow(pageCache()->capacity() / 2, PruningReason::MemoryPressure);
+            pageCache()->pruneToCapacityNow(pageCache()->capacity() / 2);
         }
     }
 #endif

Modified: trunk/Source/WebCore/platform/FeatureCounterKeys.h (177734 => 177735)


--- trunk/Source/WebCore/platform/FeatureCounterKeys.h	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/platform/FeatureCounterKeys.h	2014-12-25 16:23:47 UTC (rev 177735)
@@ -59,9 +59,7 @@
 static const char FeatureCounterPageCacheFailureReloadFromOriginKey[] = "com.apple.WebKit.pageCache.failure.reloadFromOrigin";
 static const char FeatureCounterPageCacheFailureSameLoadKey[] = "com.apple.WebKit.pageCache.failure.sameLoad";
 static const char FeatureCounterPageCacheFailureExpiredKey[] = "com.apple.WebKit.pageCache.failure.expired";
-static const char FeatureCounterPageCacheFailurePrunedMemoryPressureKey[] = "com.apple.WebKit.pageCache.failure.pruned.memoryPressure";
-static const char FeatureCounterPageCacheFailurePrunedCapacityReachedKey[] = "com.apple.WebKit.pageCache.failure.pruned.capacityReached";
-static const char FeatureCounterPageCacheFailurePrunedProcessedSuspendedKey[] = "com.apple.WebKit.pageCache.failure.pruned.processSuspended";
+static const char FeatureCounterPageCacheFailureWasPrunedKey[] = "com.apple.WebKit.pageCache.failure.wasPruned";
 static const char FeatureCounterPageCacheFailureKey[] = "com.apple.WebKit.pageCache.failure";
 static const char FeatureCounterPageCacheSuccessKey[] = "com.apple.WebKit.pageCache.success";
 

Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (177734 => 177735)


--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp	2014-12-25 16:23:47 UTC (rev 177735)
@@ -101,9 +101,9 @@
 {
     {
         ReliefLogger log("Empty the PageCache");
-        // Right now, the only reason we call release critical memory while not under memory pressure is if the process is about to be suspended.
-        PruningReason pruningReason = memoryPressureHandler().isUnderMemoryPressure() ? PruningReason::MemoryPressure : PruningReason::ProcessSuspended;
-        pageCache()->pruneToCapacityNow(0, pruningReason);
+        int savedPageCacheCapacity = pageCache()->capacity();
+        pageCache()->setCapacity(0);
+        pageCache()->setCapacity(savedPageCacheCapacity);
     }
 
     {

Modified: trunk/Source/WebKit2/ChangeLog (177734 => 177735)


--- trunk/Source/WebKit2/ChangeLog	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-25 16:23:47 UTC (rev 177735)
@@ -1,3 +1,20 @@
+2014-12-25  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r177712 and r177717.
+        https://bugs.webkit.org/show_bug.cgi?id=139944
+
+        Caused flaky assertion failures (Requested by ap on #webkit).
+
+        Reverted changesets:
+
+        "[iOS] Log better using FeatureCounter why PageCache is
+        failing due to pruned resources"
+        https://bugs.webkit.org/show_bug.cgi?id=139921
+        http://trac.webkit.org/changeset/177712
+
+        "Unreviewed, fix build warning after r177712"
+        http://trac.webkit.org/changeset/177717
+
 2014-12-24  Dan Bernstein  <[email protected]>
 
         [Cocoa] WebKit private headers shouldn’t contain “inappropriate” macros

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (177734 => 177735)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2014-12-25 10:03:14 UTC (rev 177734)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2014-12-25 16:23:47 UTC (rev 177735)
@@ -1128,7 +1128,9 @@
 
 void WebProcess::releasePageCache()
 {
-    pageCache()->pruneToCapacityNow(0, PruningReason::MemoryPressure);
+    int savedPageCacheCapacity = pageCache()->capacity();
+    pageCache()->setCapacity(0);
+    pageCache()->setCapacity(savedPageCacheCapacity);
 }
 
 #if !PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to