Title: [155120] trunk/Source/WebCore
Revision
155120
Author
akl...@apple.com
Date
2013-09-05 08:17:33 -0700 (Thu, 05 Sep 2013)

Log Message

Reverting "Cached Page and Frame don't need to be ref-counted.
<https://webkit.org/b/120758>

This didn't work so well on Qt bots. Will have to take bigger steps
here instead of iterating.

* history/CachedFrame.h:
(WebCore::CachedFrame::create):
* history/CachedPage.cpp:
(WebCore::CachedPage::create):
* history/CachedPage.h:
* history/HistoryItem.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
(WebCore::FrameLoader::transitionToCommitted):
* loader/FrameLoader.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (155119 => 155120)


--- trunk/Source/WebCore/ChangeLog	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/ChangeLog	2013-09-05 15:17:33 UTC (rev 155120)
@@ -1,3 +1,22 @@
+2013-09-05  Andreas Kling  <akl...@apple.com>
+
+        Reverting "Cached Page and Frame don't need to be ref-counted.
+        <https://webkit.org/b/120758>
+
+        This didn't work so well on Qt bots. Will have to take bigger steps
+        here instead of iterating.
+
+        * history/CachedFrame.h:
+        (WebCore::CachedFrame::create):
+        * history/CachedPage.cpp:
+        (WebCore::CachedPage::create):
+        * history/CachedPage.h:
+        * history/HistoryItem.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        (WebCore::FrameLoader::transitionToCommitted):
+        * loader/FrameLoader.h:
+
 2013-09-04  Anders Carlsson  <ander...@apple.com>
 
         Animations in an AnimationList are never null

Modified: trunk/Source/WebCore/history/CachedFrame.h (155119 => 155120)


--- trunk/Source/WebCore/history/CachedFrame.h	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/history/CachedFrame.h	2013-09-05 15:17:33 UTC (rev 155120)
@@ -30,6 +30,7 @@
 #include "KURL.h"
 #include "ScriptCachedFrameData.h"
 #include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -66,12 +67,12 @@
     bool m_isComposited;
 #endif
     
-    Vector<OwnPtr<CachedFrame>> m_childFrames;
+    Vector<RefPtr<CachedFrame>> m_childFrames;
 };
 
-class CachedFrame : private CachedFrameBase {
+class CachedFrame : public RefCounted<CachedFrame>, private CachedFrameBase {
 public:
-    static PassOwnPtr<CachedFrame> create(Frame& frame) { return adoptPtr(new CachedFrame(frame)); }
+    static PassRefPtr<CachedFrame> create(Frame& frame) { return adoptRef(new CachedFrame(frame)); }
 
     void open();
     void clear();

Modified: trunk/Source/WebCore/history/CachedPage.cpp (155119 => 155120)


--- trunk/Source/WebCore/history/CachedPage.cpp	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/history/CachedPage.cpp	2013-09-05 15:17:33 UTC (rev 155120)
@@ -45,9 +45,9 @@
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, cachedPageCounter, ("CachedPage"));
 
-PassOwnPtr<CachedPage> CachedPage::create(Page& page)
+PassRefPtr<CachedPage> CachedPage::create(Page& page)
 {
-    return adoptPtr(new CachedPage(page));
+    return adoptRef(new CachedPage(page));
 }
 
 CachedPage::CachedPage(Page& page)

Modified: trunk/Source/WebCore/history/CachedPage.h (155119 => 155120)


--- trunk/Source/WebCore/history/CachedPage.h	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/history/CachedPage.h	2013-09-05 15:17:33 UTC (rev 155120)
@@ -27,6 +27,7 @@
 #define CachedPage_h
 
 #include "CachedFrame.h"
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
     
@@ -34,9 +35,9 @@
 class DocumentLoader;
 class Page;
 
-class CachedPage {
+class CachedPage : public RefCounted<CachedPage> {
 public:
-    static PassOwnPtr<CachedPage> create(Page&);
+    static PassRefPtr<CachedPage> create(Page&);
     ~CachedPage();
 
     void restore(Page&);
@@ -66,7 +67,7 @@
 
     double m_timeStamp;
     double m_expirationTime;
-    OwnPtr<CachedFrame> m_cachedMainFrame;
+    RefPtr<CachedFrame> m_cachedMainFrame;
     bool m_needStyleRecalcForVisitedLinks;
     bool m_needsFullStyleRecalc;
     bool m_needsCaptionPreferencesChanged;

Modified: trunk/Source/WebCore/history/HistoryItem.h (155119 => 155120)


--- trunk/Source/WebCore/history/HistoryItem.h	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/history/HistoryItem.h	2013-09-05 15:17:33 UTC (rev 155120)
@@ -286,7 +286,7 @@
     // PageCache controls these fields.
     HistoryItem* m_next;
     HistoryItem* m_prev;
-    OwnPtr<CachedPage> m_cachedPage;
+    RefPtr<CachedPage> m_cachedPage;
     
 #if PLATFORM(MAC)
     RetainPtr<id> m_viewState;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (155119 => 155120)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-09-05 15:17:33 UTC (rev 155120)
@@ -1699,7 +1699,7 @@
 
 void FrameLoader::commitProvisionalLoad()
 {
-    CachedPage* cachedPage = m_loadingFromCachedPage ? pageCache()->get(history().provisionalItem()) : 0;
+    RefPtr<CachedPage> cachedPage = m_loadingFromCachedPage ? pageCache()->get(history().provisionalItem()) : 0;
     RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
     Ref<Frame> protect(m_frame);
 
@@ -1743,9 +1743,6 @@
         // The page should be removed from the cache immediately after a restoration in order for the PageCache to be consistent.
         pageCache()->remove(history().currentItem());
 
-        // Clear out 'cachedPage' right away since it now points to a deleted object.
-        cachedPage = nullptr;
-
         dispatchDidCommitLoad();
 
         // If we have a title let the WebView know about it. 
@@ -1755,12 +1752,8 @@
 
         checkCompleted();
     } else {
-        if (cachedPage) {
+        if (cachedPage)
             pageCache()->remove(history().currentItem());
-
-            // Clear out 'cachedPage' right away since it now points to a deleted object.
-            cachedPage = nullptr;
-        }
         didOpenURL();
     }
 
@@ -1796,7 +1789,7 @@
     }
 }
 
-void FrameLoader::transitionToCommitted(CachedPage* cachedPage)
+void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
 {
     ASSERT(m_client.hasWebView());
     ASSERT(m_state == FrameStateProvisional);

Modified: trunk/Source/WebCore/loader/FrameLoader.h (155119 => 155120)


--- trunk/Source/WebCore/loader/FrameLoader.h	2013-09-05 15:15:59 UTC (rev 155119)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2013-09-05 15:17:33 UTC (rev 155120)
@@ -308,7 +308,7 @@
     void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType, bool isMainResource);
 
     void clearProvisionalLoad();
-    void transitionToCommitted(CachedPage*);
+    void transitionToCommitted(PassRefPtr<CachedPage>);
     void frameLoadCompleted();
 
     SubstituteData defaultSubstituteDataForURL(const KURL&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to