Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (161696 => 161697)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2014-01-11 00:31:19 UTC (rev 161696)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2014-01-11 00:38:16 UTC (rev 161697)
@@ -197,8 +197,8 @@
static void loaderDetachedFromFrame(Frame*, DocumentLoader*);
static void frameStartedLoading(Frame&);
static void frameStoppedLoading(Frame&);
- static void frameScheduledNavigation(Frame*, double delay);
- static void frameClearedScheduledNavigation(Frame*);
+ static void frameScheduledNavigation(Frame&, double delay);
+ static void frameClearedScheduledNavigation(Frame&);
static InspectorInstrumentationCookie willRunJavaScriptDialog(Page*, const String& message);
static void didRunJavaScriptDialog(const InspectorInstrumentationCookie&);
static void willDestroyCachedResource(CachedResource*);
@@ -388,8 +388,8 @@
static void loaderDetachedFromFrameImpl(InstrumentingAgents*, DocumentLoader*);
static void frameStartedLoadingImpl(InstrumentingAgents&, Frame&);
static void frameStoppedLoadingImpl(InstrumentingAgents&, Frame&);
- static void frameScheduledNavigationImpl(InstrumentingAgents*, Frame*, double delay);
- static void frameClearedScheduledNavigationImpl(InstrumentingAgents*, Frame*);
+ static void frameScheduledNavigationImpl(InstrumentingAgents&, Frame&, double delay);
+ static void frameClearedScheduledNavigationImpl(InstrumentingAgents&, Frame&);
static InspectorInstrumentationCookie willRunJavaScriptDialogImpl(InstrumentingAgents*, const String& message);
static void didRunJavaScriptDialogImpl(const InspectorInstrumentationCookie&);
static void willDestroyCachedResourceImpl(CachedResource*);
@@ -1626,22 +1626,22 @@
#endif
}
-inline void InspectorInstrumentation::frameScheduledNavigation(Frame* frame, double delay)
+inline void InspectorInstrumentation::frameScheduledNavigation(Frame& frame, double delay)
{
#if ENABLE(INSPECTOR)
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
- frameScheduledNavigationImpl(instrumentingAgents, frame, delay);
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
+ frameScheduledNavigationImpl(*instrumentingAgents, frame, delay);
#else
UNUSED_PARAM(frame);
UNUSED_PARAM(delay);
#endif
}
-inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame* frame)
+inline void InspectorInstrumentation::frameClearedScheduledNavigation(Frame& frame)
{
#if ENABLE(INSPECTOR)
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
- frameClearedScheduledNavigationImpl(instrumentingAgents, frame);
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&frame))
+ frameClearedScheduledNavigationImpl(*instrumentingAgents, frame);
#else
UNUSED_PARAM(frame);
#endif
Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (161696 => 161697)
--- trunk/Source/WebCore/loader/NavigationScheduler.cpp 2014-01-11 00:31:19 UTC (rev 161696)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp 2014-01-11 00:38:16 UTC (rev 161697)
@@ -70,11 +70,11 @@
}
virtual ~ScheduledNavigation() { }
- virtual void fire(Frame*) = 0;
+ virtual void fire(Frame&) = 0;
- virtual bool shouldStartTimer(Frame*) { return true; }
- virtual void didStartTimer(Frame*, Timer<NavigationScheduler>*) { }
- virtual void didStopTimer(Frame*, bool /* newLoadInProgress */) { }
+ virtual bool shouldStartTimer(Frame&) { return true; }
+ virtual void didStartTimer(Frame&, Timer<NavigationScheduler>&) { }
+ virtual void didStopTimer(Frame&, bool /* newLoadInProgress */) { }
double delay() const { return m_delay; }
bool lockHistory() const { return m_lockHistory; }
@@ -106,23 +106,23 @@
{
}
- virtual void fire(Frame* frame)
+ virtual void fire(Frame& frame) OVERRIDE
{
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
- frame->loader().changeLocation(m_securityOrigin.get(), URL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), false);
+ frame.loader().changeLocation(m_securityOrigin.get(), URL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), false);
}
- virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer)
+ virtual void didStartTimer(Frame& frame, Timer<NavigationScheduler>& timer) OVERRIDE
{
if (m_haveToldClient)
return;
m_haveToldClient = true;
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
- frame->loader().clientRedirected(URL(ParsedURLString, m_url), delay(), currentTime() + timer->nextFireInterval(), lockBackForwardList());
+ frame.loader().clientRedirected(URL(ParsedURLString, m_url), delay(), currentTime() + timer.nextFireInterval(), lockBackForwardList());
}
- virtual void didStopTimer(Frame* frame, bool newLoadInProgress)
+ virtual void didStopTimer(Frame& frame, bool newLoadInProgress) OVERRIDE
{
if (!m_haveToldClient)
return;
@@ -133,7 +133,7 @@
// fact unavailable. We need to be consistent with them, otherwise the
// gesture state will sometimes be set and sometimes not within
// dispatchDidCancelClientRedirect().
- frame->loader().clientRedirectCancelledOrFinished(newLoadInProgress);
+ frame.loader().clientRedirectCancelledOrFinished(newLoadInProgress);
}
SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
@@ -155,13 +155,16 @@
clearUserGesture();
}
- virtual bool shouldStartTimer(Frame* frame) { return frame->loader().allAncestorsAreComplete(); }
+ virtual bool shouldStartTimer(Frame& frame) OVERRIDE
+ {
+ return frame.loader().allAncestorsAreComplete();
+ }
- virtual void fire(Frame* frame)
+ virtual void fire(Frame& frame) OVERRIDE
{
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
- bool refresh = equalIgnoringFragmentIdentifier(frame->document()->url(), URL(ParsedURLString, url()));
- frame->loader().changeLocation(securityOrigin(), URL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), refresh);
+ bool refresh = equalIgnoringFragmentIdentifier(frame.document()->url(), URL(ParsedURLString, url()));
+ frame.loader().changeLocation(securityOrigin(), URL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), refresh);
}
};
@@ -178,10 +181,10 @@
{
}
- virtual void fire(Frame* frame)
+ virtual void fire(Frame& frame) OVERRIDE
{
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
- frame->loader().changeLocation(securityOrigin(), URL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), true);
+ frame.loader().changeLocation(securityOrigin(), URL(ParsedURLString, url()), referrer(), lockHistory(), lockBackForwardList(), true);
}
};
@@ -193,19 +196,20 @@
{
}
- virtual void fire(Frame* frame)
+ virtual void fire(Frame& frame) OVERRIDE
{
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
if (!m_historySteps) {
// Special case for go(0) from a frame -> reload only the frame
// To follow Firefox and IE's behavior, history reload can only navigate the self frame.
- frame->loader().urlSelected(frame->document()->url(), "_self", 0, lockHistory(), lockBackForwardList(), MaybeSendReferrer);
+ frame.loader().urlSelected(frame.document()->url(), "_self", 0, lockHistory(), lockBackForwardList(), MaybeSendReferrer);
return;
}
+
// go(i!=0) from a frame navigates into the history of the frame only,
// in both IE and NS (but not in Mozilla). We can't easily do that.
- frame->page()->backForward().goBackOrForward(m_historySteps);
+ frame.page()->backForward().goBackOrForward(m_historySteps);
}
private:
@@ -222,7 +226,7 @@
ASSERT(m_submission->state());
}
- virtual void fire(Frame* frame)
+ virtual void fire(Frame& frame) OVERRIDE
{
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
@@ -231,24 +235,24 @@
// selecting a target, in case conditions have changed. Other code paths avoid this by targeting
// without leaving a time window. If we fail the check just silently drop the form submission.
Document* requestingDocument = m_submission->state()->sourceDocument();
- if (!requestingDocument->canNavigate(frame))
+ if (!requestingDocument->canNavigate(&frame))
return;
FrameLoadRequest frameRequest(requestingDocument->securityOrigin());
m_submission->populateFrameLoadRequest(frameRequest);
- frame->loader().loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer);
+ frame.loader().loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer);
}
- virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer)
+ virtual void didStartTimer(Frame& frame, Timer<NavigationScheduler>& timer) OVERRIDE
{
if (m_haveToldClient)
return;
m_haveToldClient = true;
UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
- frame->loader().clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer->nextFireInterval(), lockBackForwardList());
+ frame.loader().clientRedirected(m_submission->requestURL(), delay(), currentTime() + timer.nextFireInterval(), lockBackForwardList());
}
- virtual void didStopTimer(Frame* frame, bool newLoadInProgress)
+ virtual void didStopTimer(Frame& frame, bool newLoadInProgress) OVERRIDE
{
if (!m_haveToldClient)
return;
@@ -259,7 +263,7 @@
// fact unavailable. We need to be consistent with them, otherwise the
// gesture state will sometimes be set and sometimes not within
// dispatchDidCancelClientRedirect().
- frame->loader().clientRedirectCancelledOrFinished(newLoadInProgress);
+ frame.loader().clientRedirectCancelledOrFinished(newLoadInProgress);
}
private:
@@ -267,7 +271,7 @@
bool m_haveToldClient;
};
-NavigationScheduler::NavigationScheduler(Frame* frame)
+NavigationScheduler::NavigationScheduler(Frame& frame)
: m_frame(frame)
, m_timer(this, &NavigationScheduler::timerFired)
{
@@ -292,12 +296,12 @@
if (m_timer.isActive())
InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
m_timer.stop();
- m_redirect.clear();
+ m_redirect = nullptr;
}
inline bool NavigationScheduler::shouldScheduleNavigation() const
{
- return m_frame->page();
+ return m_frame.page();
}
inline bool NavigationScheduler::shouldScheduleNavigation(const String& url) const
@@ -316,20 +320,20 @@
// We want a new back/forward list item if the refresh timeout is > 1 second.
if (!m_redirect || delay <= m_redirect->delay())
- schedule(adoptPtr(new ScheduledRedirect(delay, m_frame->document()->securityOrigin(), url, true, delay <= 1)));
+ schedule(std::make_unique<ScheduledRedirect>(delay, m_frame.document()->securityOrigin(), url, true, delay <= 1));
}
-bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame)
+bool NavigationScheduler::mustLockBackForwardList(Frame& targetFrame)
{
// Non-user navigation before the page has finished firing onload should not create a new back/forward item.
// See https://webkit.org/b/42861 for the original motivation for this.
- if (!ScriptController::processingUserGesture() && targetFrame->loader().documentLoader() && !targetFrame->loader().documentLoader()->wasOnloadHandled())
+ if (!ScriptController::processingUserGesture() && targetFrame.loader().documentLoader() && !targetFrame.loader().documentLoader()->wasOnloadHandled())
return true;
// Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item.
// The definition of "during load" is any time before all handlers for the load event have been run.
// See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motivation for this.
- for (Frame* ancestor = targetFrame->tree().parent(); ancestor; ancestor = ancestor->tree().parent()) {
+ for (Frame* ancestor = targetFrame.tree().parent(); ancestor; ancestor = ancestor->tree().parent()) {
Document* document = ancestor->document();
if (!ancestor->loader().isComplete() || (document && document->processingLoadEvent()))
return true;
@@ -346,13 +350,13 @@
lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame);
- FrameLoader& loader = m_frame->loader();
+ FrameLoader& loader = m_frame.loader();
// If the URL we're going to navigate to is the same as the current one, except for the
// fragment part, we don't need to schedule the location change.
URL parsedURL(ParsedURLString, url);
- if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame->document()->url(), parsedURL)) {
- loader.changeLocation(securityOrigin, m_frame->document()->completeURL(url), referrer, lockHistory, lockBackForwardList);
+ if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame.document()->url(), parsedURL)) {
+ loader.changeLocation(securityOrigin, m_frame.document()->completeURL(url), referrer, lockHistory, lockBackForwardList);
return;
}
@@ -360,39 +364,39 @@
// This may happen when a frame changes the location of another frame.
bool duringLoad = !loader.stateMachine()->committedFirstRealDocumentLoad();
- schedule(adoptPtr(new ScheduledLocationChange(securityOrigin, url, referrer, lockHistory, lockBackForwardList, duringLoad)));
+ schedule(std::make_unique<ScheduledLocationChange>(securityOrigin, url, referrer, lockHistory, lockBackForwardList, duringLoad));
}
void NavigationScheduler::scheduleFormSubmission(PassRefPtr<FormSubmission> submission)
{
- ASSERT(m_frame->page());
+ ASSERT(m_frame.page());
// FIXME: Do we need special handling for form submissions where the URL is the same
// as the current one except for the fragment part? See scheduleLocationChange above.
// Handle a location change of a page with no document as a special case.
// This may happen when a frame changes the location of another frame.
- bool duringLoad = !m_frame->loader().stateMachine()->committedFirstRealDocumentLoad();
+ bool duringLoad = !m_frame.loader().stateMachine()->committedFirstRealDocumentLoad();
// If this is a child frame and the form submission was triggered by a script, lock the back/forward list
// to match IE and Opera.
// See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this.
bool lockBackForwardList = mustLockBackForwardList(m_frame)
|| (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript
- && m_frame->tree().parent() && !ScriptController::processingUserGesture());
+ && m_frame.tree().parent() && !ScriptController::processingUserGesture());
- schedule(adoptPtr(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad)));
+ schedule(std::make_unique<ScheduledFormSubmission>(submission, lockBackForwardList, duringLoad));
}
void NavigationScheduler::scheduleRefresh()
{
if (!shouldScheduleNavigation())
return;
- const URL& url = ""
+ const URL& url = ""
if (url.isEmpty())
return;
- schedule(adoptPtr(new ScheduledRefresh(m_frame->document()->securityOrigin(), url.string(), m_frame->loader().outgoingReferrer())));
+ schedule(std::make_unique<ScheduledRefresh>(m_frame.document()->securityOrigin(), url.string(), m_frame.loader().outgoingReferrer()));
}
void NavigationScheduler::scheduleHistoryNavigation(int steps)
@@ -402,54 +406,54 @@
// Invalid history navigations (such as history.forward() during a new load) have the side effect of cancelling any scheduled
// redirects. We also avoid the possibility of cancelling the current load by avoiding the scheduled redirection altogether.
- BackForwardController& backForward = m_frame->page()->backForward();
+ BackForwardController& backForward = m_frame.page()->backForward();
if (steps > backForward.forwardCount() || -steps > backForward.backCount()) {
cancel();
return;
}
// In all other cases, schedule the history traversal to occur asynchronously.
- schedule(adoptPtr(new ScheduledHistoryNavigation(steps)));
+ schedule(std::make_unique<ScheduledHistoryNavigation>(steps));
}
void NavigationScheduler::timerFired(Timer<NavigationScheduler>*)
{
- if (!m_frame->page())
+ if (!m_frame.page())
return;
- if (m_frame->page()->defersLoading()) {
+ if (m_frame.page()->defersLoading()) {
InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
return;
}
- Ref<Frame> protect(*m_frame);
+ Ref<Frame> protect(m_frame);
- OwnPtr<ScheduledNavigation> redirect(m_redirect.release());
+ std::unique_ptr<ScheduledNavigation> redirect = std::move(m_redirect);
redirect->fire(m_frame);
InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
}
-void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect)
+void NavigationScheduler::schedule(std::unique_ptr<ScheduledNavigation> redirect)
{
- ASSERT(m_frame->page());
+ ASSERT(m_frame.page());
- Ref<Frame> protect(*m_frame);
+ Ref<Frame> protect(m_frame);
// If a redirect was scheduled during a load, then stop the current load.
// Otherwise when the current load transitions from a provisional to a
// committed state, pending redirects may be cancelled.
if (redirect->wasDuringLoad()) {
- if (DocumentLoader* provisionalDocumentLoader = m_frame->loader().provisionalDocumentLoader())
+ if (DocumentLoader* provisionalDocumentLoader = m_frame.loader().provisionalDocumentLoader())
provisionalDocumentLoader->stopLoading();
- m_frame->loader().stopLoading(UnloadEventPolicyUnloadAndPageHide);
+ m_frame.loader().stopLoading(UnloadEventPolicyUnloadAndPageHide);
}
cancel();
- m_redirect = redirect;
+ m_redirect = std::move(redirect);
- if (!m_frame->loader().isComplete() && m_redirect->isLocationChange())
- m_frame->loader().completed();
+ if (!m_frame.loader().isComplete() && m_redirect->isLocationChange())
+ m_frame.loader().completed();
- if (!m_frame->page())
+ if (!m_frame.page())
return;
startTimer();
@@ -460,7 +464,7 @@
if (!m_redirect)
return;
- ASSERT(m_frame->page());
+ ASSERT(m_frame.page());
if (m_timer.isActive())
return;
if (!m_redirect->shouldStartTimer(m_frame))
@@ -469,7 +473,7 @@
double delay = m_redirect->delay();
m_timer.startOneShot(delay);
InspectorInstrumentation::frameScheduledNavigation(m_frame, delay);
- m_redirect->didStartTimer(m_frame, &m_timer); // m_redirect may be null on return (e.g. the client canceled the load)
+ m_redirect->didStartTimer(m_frame, m_timer); // m_redirect may be null on return (e.g. the client canceled the load)
}
void NavigationScheduler::cancel(bool newLoadInProgress)
@@ -478,8 +482,7 @@
InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
m_timer.stop();
- OwnPtr<ScheduledNavigation> redirect(m_redirect.release());
- if (redirect)
+ if (std::unique_ptr<ScheduledNavigation> redirect = std::move(m_redirect))
redirect->didStopTimer(m_frame, newLoadInProgress);
}