Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Unified Diff: Source/core/loader/NavigationScheduler.h

Issue 1164883002: Ignore attempts to navigate once a provisional commit has gotten too far along. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/NavigationScheduler.h
diff --git a/Source/core/loader/NavigationScheduler.h b/Source/core/loader/NavigationScheduler.h
index 4baf377af2f0c3e362a2ce47595300018272beac..23de7a33d7772ae01cffc7377b29aadc481bbaa2 100644
--- a/Source/core/loader/NavigationScheduler.h
+++ b/Source/core/loader/NavigationScheduler.h
@@ -47,11 +47,12 @@ namespace blink {
class Document;
class FormSubmission;
class LocalFrame;
+class NavigationScheduler;
class ScheduledNavigation;
class NavigationDisablerForBeforeUnload {
WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload);
-
+ STACK_ALLOCATED();
public:
NavigationDisablerForBeforeUnload()
{
@@ -68,6 +69,19 @@ private:
static unsigned s_navigationDisableCount;
};
+class FrameNavigationDisabler {
+ WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler);
+ STACK_ALLOCATED();
+public:
+ explicit FrameNavigationDisabler(LocalFrame*);
+ ~FrameNavigationDisabler();
+
+private:
+ FrameNavigationDisabler() = delete;
+
+ NavigationScheduler& m_navigationScheduler;
+};
+
class CORE_EXPORT NavigationScheduler final {
WTF_MAKE_NONCOPYABLE(NavigationScheduler);
DISALLOW_ALLOCATION();
@@ -89,6 +103,12 @@ public:
DECLARE_TRACE();
private:
+ friend class FrameNavigationDisabler;
+
+ void disableFrameNavigation() { ++m_navigationDisableCount; }
+ void enableFrameNavigation() { --m_navigationDisableCount; }
+ bool isFrameNavigationAllowed() const { return !m_navigationDisableCount; }
+
bool shouldScheduleReload() const;
bool shouldScheduleNavigation(const String& url) const;
@@ -100,6 +120,7 @@ private:
RawPtrWillBeMember<LocalFrame> m_frame;
Timer<NavigationScheduler> m_timer;
OwnPtrWillBeMember<ScheduledNavigation> m_redirect;
+ int m_navigationDisableCount;
};
} // namespace blink
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698