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

Diff

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (179273 => 179274)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-28 18:50:21 UTC (rev 179273)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-01-28 18:55:13 UTC (rev 179274)
@@ -1,3 +1,31 @@
+2015-01-28  Lucas Forschler  <[email protected]>
+
+        Merge r177680
+
+    2014-12-22  Chris Dumez  <[email protected]>
+
+            [iOS] Log using FeatureCounter when a PacheCache fails due to memory pressure
+            https://bugs.webkit.org/show_bug.cgi?id=139874
+            <rdar://problem/19255690>
+
+            Reviewed by Darin Adler.
+
+            Log using FeatureCounter when a PacheCache fails due to memory
+            pressure. To detect this, a flag is added to HistoryItem to mark
+            items that are no longer in the page becaused they were pruned
+            (either because of a low memory handling or because the page cache
+            reached its maximum capacity).
+
+            * history/HistoryItem.cpp:
+            (WebCore::HistoryItem::HistoryItem):
+            * history/HistoryItem.h:
+            * history/PageCache.cpp:
+            (WebCore::PageCache::add):
+            (WebCore::PageCache::take):
+            (WebCore::PageCache::get):
+            (WebCore::PageCache::prune):
+            * platform/FeatureCounterKeys.h:
+
 2015-01-27  Lucas Forschler  <[email protected]>
 
         Merge r177666

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/history/HistoryItem.cpp (179273 => 179274)


--- branches/safari-600.1.4.15-branch/Source/WebCore/history/HistoryItem.cpp	2015-01-28 18:50:21 UTC (rev 179273)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/history/HistoryItem.cpp	2015-01-28 18:55:13 UTC (rev 179274)
@@ -63,6 +63,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)
@@ -82,6 +83,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)
@@ -103,6 +105,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)
@@ -125,6 +128,7 @@
     , m_documentSequenceNumber(generateSequenceNumber())
     , m_next(0)
     , m_prev(0)
+    , m_wasPruned(false)
 #if PLATFORM(IOS)
     , m_scale(0)
     , m_scaleIsInitial(false)

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/history/HistoryItem.h (179273 => 179274)


--- branches/safari-600.1.4.15-branch/Source/WebCore/history/HistoryItem.h	2015-01-28 18:50:21 UTC (rev 179273)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/history/HistoryItem.h	2015-01-28 18:55:13 UTC (rev 179274)
@@ -258,6 +258,7 @@
     HistoryItem* m_next;
     HistoryItem* m_prev;
     std::unique_ptr<CachedPage> m_cachedPage;
+    bool m_wasPruned;
 
 #if PLATFORM(IOS)
     FloatRect m_exposedContentRect;

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/history/PageCache.cpp (179273 => 179274)


--- branches/safari-600.1.4.15-branch/Source/WebCore/history/PageCache.cpp	2015-01-28 18:50:21 UTC (rev 179273)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/history/PageCache.cpp	2015-01-28 18:55:13 UTC (rev 179274)
@@ -458,6 +458,7 @@
         remove(item);
 
     item->m_cachedPage = std::make_unique<CachedPage>(page);
+    item->m_wasPruned = false;
     addToLRUList(item);
     ++m_size;
     
@@ -476,8 +477,11 @@
 
     item->deref(); // Balanced in add().
 
-    if (!cachedPage)
+    if (!cachedPage) {
+        if (item->m_wasPruned)
+            FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterPageCacheFailureWasPrunedKey);
         return nullptr;
+    }
 
     if (cachedPage->hasExpired()) {
         LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", item->url().string().ascii().data());
@@ -500,7 +504,9 @@
         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_wasPruned)
+        FEATURE_COUNTER_INCREMENT_KEY(page, FeatureCounterPageCacheFailureWasPrunedKey);
+
     return nullptr;
 }
 
@@ -521,6 +527,7 @@
 {
     while (m_size > m_capacity) {
         ASSERT(m_tail && m_tail->m_cachedPage);
+        m_tail->m_wasPruned = true;
         remove(m_tail);
     }
 }

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


--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h	2015-01-28 18:50:21 UTC (rev 179273)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/FeatureCounterKeys.h	2015-01-28 18:55:13 UTC (rev 179274)
@@ -59,6 +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 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";
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to