Diff
Modified: trunk/Source/WebCore/ChangeLog (155090 => 155091)
--- trunk/Source/WebCore/ChangeLog 2013-09-05 03:09:57 UTC (rev 155090)
+++ trunk/Source/WebCore/ChangeLog 2013-09-05 03:13:24 UTC (rev 155091)
@@ -1,5 +1,27 @@
2013-09-04 Andreas Kling <[email protected]>
+ CachedFrame construction should begin with a Frame&.
+ <https://webkit.org/b/120719>
+
+ Reviewed by Anders Carlsson.
+
+ We can't create a CachedFrame from a null Frame anyway.
+
+ * bindings/js/ScriptCachedFrameData.cpp:
+ (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
+ (WebCore::ScriptCachedFrameData::restore):
+ * bindings/js/ScriptCachedFrameData.h:
+ * history/CachedFrame.cpp:
+ (WebCore::CachedFrameBase::CachedFrameBase):
+ (WebCore::CachedFrameBase::restore):
+ (WebCore::CachedFrame::CachedFrame):
+ * history/CachedFrame.h:
+ (WebCore::CachedFrame::create):
+ * history/CachedPage.cpp:
+ (WebCore::CachedPage::CachedPage):
+
+2013-09-04 Andreas Kling <[email protected]>
+
Set "render tree being torn down" flag a bit earlier.
<https://webkit.org/b/120717>
Modified: trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp (155090 => 155091)
--- trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp 2013-09-05 03:09:57 UTC (rev 155090)
+++ trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp 2013-09-05 03:13:24 UTC (rev 155091)
@@ -44,11 +44,11 @@
namespace WebCore {
-ScriptCachedFrameData::ScriptCachedFrameData(Frame* frame)
+ScriptCachedFrameData::ScriptCachedFrameData(Frame& frame)
{
JSLockHolder lock(JSDOMWindowBase::commonVM());
- ScriptController& scriptController = frame->script();
+ ScriptController& scriptController = frame.script();
ScriptController::ShellMap& windowShells = scriptController.m_windowShells;
ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
@@ -65,11 +65,11 @@
clear();
}
-void ScriptCachedFrameData::restore(Frame* frame)
+void ScriptCachedFrameData::restore(Frame& frame)
{
JSLockHolder lock(JSDOMWindowBase::commonVM());
- ScriptController& scriptController = frame->script();
+ ScriptController& scriptController = frame.script();
ScriptController::ShellMap& windowShells = scriptController.m_windowShells;
ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
@@ -80,13 +80,13 @@
if (JSDOMWindow* window = m_windows.get(world).get())
windowShell->setWindow(window->vm(), window);
else {
- DOMWindow* domWindow = frame->document()->domWindow();
+ DOMWindow* domWindow = frame.document()->domWindow();
if (windowShell->window()->impl() == domWindow)
continue;
windowShell->setWindow(domWindow);
- if (Page* page = frame->page()) {
+ if (Page* page = frame.page()) {
scriptController.attachDebugger(windowShell, page->debugger());
windowShell->window()->setProfileGroup(page->group().identifier());
}
Modified: trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.h (155090 => 155091)
--- trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.h 2013-09-05 03:09:57 UTC (rev 155090)
+++ trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.h 2013-09-05 03:13:24 UTC (rev 155091)
@@ -45,10 +45,10 @@
typedef HashMap< RefPtr<DOMWrapperWorld>, JSC::Strong<JSDOMWindow> > JSDOMWindowSet;
public:
- ScriptCachedFrameData(Frame*);
+ ScriptCachedFrameData(Frame&);
~ScriptCachedFrameData();
- void restore(Frame*);
+ void restore(Frame&);
void clear();
private:
Modified: trunk/Source/WebCore/history/CachedFrame.cpp (155090 => 155091)
--- trunk/Source/WebCore/history/CachedFrame.cpp 2013-09-05 03:09:57 UTC (rev 155090)
+++ trunk/Source/WebCore/history/CachedFrame.cpp 2013-09-05 03:13:24 UTC (rev 155091)
@@ -72,15 +72,15 @@
}
#endif
-CachedFrameBase::CachedFrameBase(Frame* frame)
- : m_document(frame->document())
- , m_documentLoader(frame->loader().documentLoader())
- , m_view(frame->view())
- , m_mousePressNode(frame->eventHandler().mousePressNode())
- , m_url(frame->document()->url())
- , m_isMainFrame(!frame->tree().parent())
+CachedFrameBase::CachedFrameBase(Frame& frame)
+ : m_document(frame.document())
+ , m_documentLoader(frame.loader().documentLoader())
+ , m_view(frame.view())
+ , m_mousePressNode(frame.eventHandler().mousePressNode())
+ , m_url(frame.document()->url())
+ , m_isMainFrame(!frame.tree().parent())
#if USE(ACCELERATED_COMPOSITING)
- , m_isComposited(frame->view()->hasCompositedContent())
+ , m_isComposited(frame.view()->hasCompositedContent())
#endif
{
}
@@ -102,7 +102,7 @@
m_view->setParentVisible(true);
Frame& frame = m_view->frame();
- m_cachedFrameScriptData->restore(&frame);
+ m_cachedFrameScriptData->restore(frame);
#if ENABLE(SVG)
if (m_document->svgExtensions())
@@ -149,7 +149,7 @@
m_document->documentDidResumeFromPageCache();
}
-CachedFrame::CachedFrame(Frame* frame)
+CachedFrame::CachedFrame(Frame& frame)
: CachedFrameBase(frame)
{
#ifndef NDEBUG
@@ -159,18 +159,18 @@
ASSERT(m_documentLoader);
ASSERT(m_view);
- if (frame->page()->focusController().focusedFrame() == frame)
- frame->page()->focusController().setFocusedFrame(&frame->page()->mainFrame());
+ if (frame.page()->focusController().focusedFrame() == &frame)
+ frame.page()->focusController().setFocusedFrame(&frame.page()->mainFrame());
// Custom scrollbar renderers will get reattached when the document comes out of the page cache
m_view->detachCustomScrollbars();
m_document->setInPageCache(true);
- frame->loader().stopLoading(UnloadEventPolicyUnloadAndPageHide);
+ frame.loader().stopLoading(UnloadEventPolicyUnloadAndPageHide);
// Create the CachedFrames for all Frames in the FrameTree.
- for (Frame* child = frame->tree().firstChild(); child; child = child->tree().nextSibling())
- m_childFrames.append(CachedFrame::create(child));
+ for (Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
+ m_childFrames.append(CachedFrame::create(*child));
// Active DOM objects must be suspended before we cache the frame script data,
// but after we've fired the pagehide event, in case that creates more objects.
@@ -183,27 +183,27 @@
m_document->domWindow()->suspendForPageCache();
- frame->loader().client().savePlatformDataToCachedFrame(this);
+ frame.loader().client().savePlatformDataToCachedFrame(this);
#if USE(ACCELERATED_COMPOSITING)
if (m_isComposited && pageCache()->shouldClearBackingStores())
- frame->view()->clearBackingStores();
+ frame.view()->clearBackingStores();
#endif
// documentWillSuspendForPageCache() can set up a layout timer on the FrameView, so clear timers after that.
- frame->clearTimers();
+ frame.clearTimers();
// Deconstruct the FrameTree, to restore it later.
// We do this for two reasons:
// 1 - We reuse the main frame, so when it navigates to a new page load it needs to start with a blank FrameTree.
// 2 - It's much easier to destroy a CachedFrame while it resides in the PageCache if it is disconnected from its parent.
for (unsigned i = 0; i < m_childFrames.size(); ++i)
- frame->tree().removeChild(&m_childFrames[i]->view()->frame());
+ frame.tree().removeChild(&m_childFrames[i]->view()->frame());
if (!m_isMainFrame)
- frame->page()->decrementSubframeCount();
+ frame.page()->decrementSubframeCount();
- frame->loader().client().didSaveToPageCache();
+ frame.loader().client().didSaveToPageCache();
#ifndef NDEBUG
if (m_isMainFrame)
Modified: trunk/Source/WebCore/history/CachedFrame.h (155090 => 155091)
--- trunk/Source/WebCore/history/CachedFrame.h 2013-09-05 03:09:57 UTC (rev 155090)
+++ trunk/Source/WebCore/history/CachedFrame.h 2013-09-05 03:13:24 UTC (rev 155091)
@@ -51,7 +51,7 @@
bool isMainFrame() { return m_isMainFrame; }
protected:
- CachedFrameBase(Frame*);
+ CachedFrameBase(Frame&);
~CachedFrameBase();
RefPtr<Document> m_document;
@@ -71,7 +71,7 @@
class CachedFrame : private CachedFrameBase {
public:
- static PassOwnPtr<CachedFrame> create(Frame* frame) { return adoptPtr(new CachedFrame(frame)); }
+ static PassOwnPtr<CachedFrame> create(Frame& frame) { return adoptPtr(new CachedFrame(frame)); }
void open();
void clear();
@@ -89,7 +89,7 @@
int descendantFrameCount() const;
private:
- explicit CachedFrame(Frame*);
+ explicit CachedFrame(Frame&);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/history/CachedPage.cpp (155090 => 155091)
--- trunk/Source/WebCore/history/CachedPage.cpp 2013-09-05 03:09:57 UTC (rev 155090)
+++ trunk/Source/WebCore/history/CachedPage.cpp 2013-09-05 03:13:24 UTC (rev 155091)
@@ -53,7 +53,7 @@
CachedPage::CachedPage(Page* page)
: m_timeStamp(monotonicallyIncreasingTime())
, m_expirationTime(m_timeStamp + page->settings().backForwardCacheExpirationInterval())
- , m_cachedMainFrame(CachedFrame::create(&page->mainFrame()))
+ , m_cachedMainFrame(CachedFrame::create(page->mainFrame()))
, m_needStyleRecalcForVisitedLinks(false)
, m_needsFullStyleRecalc(false)
, m_needsCaptionPreferencesChanged(false)