Commit 80b077bf authored by akling@apple.com's avatar akling@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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155120 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 391ed0ff
2013-09-05 Andreas Kling <akling@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 <andersca@apple.com>
Animations in an AnimationList are never null
......@@ -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 @@ protected:
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();
......
......@@ -45,9 +45,9 @@ namespace WebCore {
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)
......
......@@ -27,6 +27,7 @@
#define CachedPage_h
#include "CachedFrame.h"
#include <wtf/RefCounted.h>
namespace WebCore {
......@@ -34,9 +35,9 @@ class Document;
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 @@ private:
double m_timeStamp;
double m_expirationTime;
OwnPtr<CachedFrame> m_cachedMainFrame;
RefPtr<CachedFrame> m_cachedMainFrame;
bool m_needStyleRecalcForVisitedLinks;
bool m_needsFullStyleRecalc;
bool m_needsCaptionPreferencesChanged;
......
......@@ -286,7 +286,7 @@ private:
// 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;
......
......@@ -1699,7 +1699,7 @@ void FrameLoader::clearProvisionalLoad()
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 @@ void FrameLoader::commitProvisionalLoad()
// 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 @@ void FrameLoader::commitProvisionalLoad()
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::commitProvisionalLoad()
}
}
void FrameLoader::transitionToCommitted(CachedPage* cachedPage)
void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
{
ASSERT(m_client.hasWebView());
ASSERT(m_state == FrameStateProvisional);
......
......@@ -308,7 +308,7 @@ private:
void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType, bool isMainResource);
void clearProvisionalLoad();
void transitionToCommitted(CachedPage*);
void transitionToCommitted(PassRefPtr<CachedPage>);
void frameLoadCompleted();
SubstituteData defaultSubstituteDataForURL(const KURL&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment