Title: [179229] trunk/Source/WebCore
Revision
179229
Author
[email protected]
Date
2015-01-27 16:48:19 -0800 (Tue, 27 Jan 2015)

Log Message

Remove unnecessary m_cachedPage null-checks in PageCache
https://bugs.webkit.org/show_bug.cgi?id=140965

Reviewed by Andreas Kling.

Remove unnecessary m_cachedPage null-checks in PageCache. We initialize
m_cachedPage when inserting the HistoryItem in the page cache and clear
it when removing it from the page cache. Therefore, it is guaranteed
that HistoryItems currently in the page cache have m_cachedPage
initialized and there is no need to null-check it.

* history/PageCache.cpp:
(WebCore::PageCache::frameCount):
(WebCore::PageCache::markPagesForVistedLinkStyleRecalc):
(WebCore::PageCache::markPagesForFullStyleRecalc):
(WebCore::PageCache::markPagesForDeviceScaleChanged):
(WebCore::PageCache::markPagesForCaptionPreferencesChanged):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (179228 => 179229)


--- trunk/Source/WebCore/ChangeLog	2015-01-28 00:13:37 UTC (rev 179228)
+++ trunk/Source/WebCore/ChangeLog	2015-01-28 00:48:19 UTC (rev 179229)
@@ -1,3 +1,23 @@
+2015-01-27  Chris Dumez  <[email protected]>
+
+        Remove unnecessary m_cachedPage null-checks in PageCache
+        https://bugs.webkit.org/show_bug.cgi?id=140965
+
+        Reviewed by Andreas Kling.
+
+        Remove unnecessary m_cachedPage null-checks in PageCache. We initialize
+        m_cachedPage when inserting the HistoryItem in the page cache and clear
+        it when removing it from the page cache. Therefore, it is guaranteed
+        that HistoryItems currently in the page cache have m_cachedPage
+        initialized and there is no need to null-check it.
+
+        * history/PageCache.cpp:
+        (WebCore::PageCache::frameCount):
+        (WebCore::PageCache::markPagesForVistedLinkStyleRecalc):
+        (WebCore::PageCache::markPagesForFullStyleRecalc):
+        (WebCore::PageCache::markPagesForDeviceScaleChanged):
+        (WebCore::PageCache::markPagesForCaptionPreferencesChanged):
+
 2015-01-27  Alexey Proskuryakov  <[email protected]>
 
         Some NSAccessibility methods we use are deprecated on 10.10

Modified: trunk/Source/WebCore/history/PageCache.cpp (179228 => 179229)


--- trunk/Source/WebCore/history/PageCache.cpp	2015-01-28 00:13:37 UTC (rev 179228)
+++ trunk/Source/WebCore/history/PageCache.cpp	2015-01-28 00:48:19 UTC (rev 179229)
@@ -392,7 +392,7 @@
     for (HistoryItem* current = m_head; current; current = current->m_next) {
         ++frameCount;
         ASSERT(current->m_cachedPage);
-        frameCount += current->m_cachedPage ? current->m_cachedPage->cachedMainFrame()->descendantFrameCount() : 0;
+        frameCount += current->m_cachedPage->cachedMainFrame()->descendantFrameCount();
     }
     
     return frameCount;
@@ -401,26 +401,26 @@
 void PageCache::markPagesForVistedLinkStyleRecalc()
 {
     for (HistoryItem* current = m_head; current; current = current->m_next) {
-        if (current->m_cachedPage)
-            current->m_cachedPage->markForVistedLinkStyleRecalc();
+        ASSERT(current->m_cachedPage);
+        current->m_cachedPage->markForVistedLinkStyleRecalc();
     }
 }
 
 void PageCache::markPagesForFullStyleRecalc(Page* page)
 {
     for (HistoryItem* current = m_head; current; current = current->m_next) {
-        CachedPage* cachedPage = current->m_cachedPage.get();
-        if (cachedPage && &page->mainFrame() == &cachedPage->cachedMainFrame()->view()->frame())
-            cachedPage->markForFullStyleRecalc();
+        CachedPage& cachedPage = *current->m_cachedPage;
+        if (&page->mainFrame() == &cachedPage.cachedMainFrame()->view()->frame())
+            cachedPage.markForFullStyleRecalc();
     }
 }
 
 void PageCache::markPagesForDeviceScaleChanged(Page* page)
 {
     for (HistoryItem* current = m_head; current; current = current->m_next) {
-        CachedPage* cachedPage = current->m_cachedPage.get();
-        if (cachedPage && &page->mainFrame() == &cachedPage->cachedMainFrame()->view()->frame())
-            cachedPage->markForDeviceScaleChanged();
+        CachedPage& cachedPage = *current->m_cachedPage;
+        if (&page->mainFrame() == &cachedPage.cachedMainFrame()->view()->frame())
+            cachedPage.markForDeviceScaleChanged();
     }
 }
 
@@ -428,8 +428,8 @@
 void PageCache::markPagesForCaptionPreferencesChanged()
 {
     for (HistoryItem* current = m_head; current; current = current->m_next) {
-        if (current->m_cachedPage)
-            current->m_cachedPage->markForCaptionPreferencesChanged();
+        ASSERT(current->m_cachedPage);
+        current->m_cachedPage->markForCaptionPreferencesChanged();
     }
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to