Chromium Code Reviews| Index: Source/core/loader/NavigationScheduler.h |
| diff --git a/Source/core/loader/NavigationScheduler.h b/Source/core/loader/NavigationScheduler.h |
| index e755265cf207afa5ff463122026729f05a4f16d8..f946e4f70f05c375d380034425c41ac8bf764359 100644 |
| --- a/Source/core/loader/NavigationScheduler.h |
| +++ b/Source/core/loader/NavigationScheduler.h |
| @@ -32,9 +32,7 @@ |
| #define NavigationScheduler_h |
| #include "core/CoreExport.h" |
| -#include "platform/Timer.h" |
| #include "platform/heap/Handle.h" |
| -#include "platform/scheduler/CancellableTaskFactory.h" |
| #include "wtf/Forward.h" |
| #include "wtf/HashMap.h" |
| #include "wtf/Noncopyable.h" |
| @@ -45,49 +43,21 @@ |
| namespace blink { |
| +class CancellableTaskFactory; |
| class Document; |
| class FormSubmission; |
| class LocalFrame; |
| -class NavigationScheduler; |
| class ScheduledNavigation; |
| -class NavigationDisablerForBeforeUnload { |
| - WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload); |
| - STACK_ALLOCATED(); |
| +class CORE_EXPORT NavigationScheduler final : public NoBaseWillBeGarbageCollectedFinalized<NavigationScheduler> { |
| + WTF_MAKE_NONCOPYABLE(NavigationScheduler); |
| + WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(NavigationScheduler); |
| public: |
| - NavigationDisablerForBeforeUnload() |
| - { |
| - s_navigationDisableCount++; |
| - } |
| - ~NavigationDisablerForBeforeUnload() |
| + static PassOwnPtrWillBeRawPtr<NavigationScheduler> create(LocalFrame* frame) |
| { |
| - ASSERT(s_navigationDisableCount); |
| - s_navigationDisableCount--; |
| + return adoptPtrWillBeNoop(new NavigationScheduler(frame)); |
| } |
| - static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
| - |
| -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(); |
| -public: |
| - explicit NavigationScheduler(LocalFrame*); |
| ~NavigationScheduler(); |
| bool locationChangePending(); |
| @@ -106,6 +76,7 @@ public: |
| private: |
| friend class FrameNavigationDisabler; |
| + explicit NavigationScheduler(LocalFrame*); |
| void disableFrameNavigation() { ++m_navigationDisableCount; } |
| void enableFrameNavigation() { --m_navigationDisableCount; } |
| @@ -120,11 +91,43 @@ private: |
| static bool mustReplaceCurrentItem(LocalFrame* targetFrame); |
| RawPtrWillBeMember<LocalFrame> m_frame; |
| - CancellableTaskFactory m_navigateTaskFactory; |
| + OwnPtr<CancellableTaskFactory> m_navigateTaskFactory; |
| OwnPtrWillBeMember<ScheduledNavigation> m_redirect; |
| int m_navigationDisableCount; |
| }; |
| +class NavigationDisablerForBeforeUnload { |
| + WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload); |
| + STACK_ALLOCATED(); |
| +public: |
| + NavigationDisablerForBeforeUnload() |
| + { |
| + s_navigationDisableCount++; |
| + } |
| + ~NavigationDisablerForBeforeUnload() |
| + { |
| + ASSERT(s_navigationDisableCount); |
| + s_navigationDisableCount--; |
| + } |
| + static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
| + |
| +private: |
| + static unsigned s_navigationDisableCount; |
| +}; |
| + |
| +class FrameNavigationDisabler { |
| + WTF_MAKE_NONCOPYABLE(FrameNavigationDisabler); |
| + STACK_ALLOCATED(); |
| +public: |
| + explicit FrameNavigationDisabler(LocalFrame*); |
| + ~FrameNavigationDisabler(); |
| + |
| +private: |
| + FrameNavigationDisabler() = delete; |
|
haraken
2015/09/04 12:04:21
This won't be needed (it's covered by STACK_ALLOCA
sof
2015/09/04 12:10:39
So it is, well spotted; thanks.
|
| + |
| + RawPtrWillBeMember<NavigationScheduler> m_navigationScheduler; |
| +}; |
| + |
| } // namespace blink |
| #endif // NavigationScheduler_h |