| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 4 * (http://www.torchmobile.com/) | 4 * (http://www.torchmobile.com/) |
| 5 * Copyright (C) 2009 Adam Barth. All rights reserved. | 5 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef NavigationScheduler_h | 32 #ifndef NavigationScheduler_h |
| 33 #define NavigationScheduler_h | 33 #define NavigationScheduler_h |
| 34 | 34 |
| 35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
| 36 #include "platform/WebTaskRunner.h" |
| 36 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 37 #include "public/platform/WebScheduler.h" | 38 #include "public/platform/WebScheduler.h" |
| 38 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
| 39 #include "wtf/HashMap.h" | 40 #include "wtf/HashMap.h" |
| 40 #include "wtf/Noncopyable.h" | 41 #include "wtf/Noncopyable.h" |
| 41 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 42 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 43 #include <memory> | 44 #include <memory> |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| 47 class CancellableTaskFactory; | |
| 48 class Document; | 48 class Document; |
| 49 class FormSubmission; | 49 class FormSubmission; |
| 50 class LocalFrame; | 50 class LocalFrame; |
| 51 class ScheduledNavigation; | 51 class ScheduledNavigation; |
| 52 | 52 |
| 53 class CORE_EXPORT NavigationScheduler final | 53 class CORE_EXPORT NavigationScheduler final |
| 54 : public GarbageCollectedFinalized<NavigationScheduler> { | 54 : public GarbageCollectedFinalized<NavigationScheduler> { |
| 55 WTF_MAKE_NONCOPYABLE(NavigationScheduler); | 55 WTF_MAKE_NONCOPYABLE(NavigationScheduler); |
| 56 | 56 |
| 57 public: | 57 public: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 bool shouldScheduleReload() const; | 83 bool shouldScheduleReload() const; |
| 84 bool shouldScheduleNavigation(const String& url) const; | 84 bool shouldScheduleNavigation(const String& url) const; |
| 85 | 85 |
| 86 void navigateTask(); | 86 void navigateTask(); |
| 87 void schedule(ScheduledNavigation*); | 87 void schedule(ScheduledNavigation*); |
| 88 | 88 |
| 89 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); | 89 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); |
| 90 | 90 |
| 91 Member<LocalFrame> m_frame; | 91 Member<LocalFrame> m_frame; |
| 92 std::unique_ptr<CancellableTaskFactory> m_navigateTaskFactory; | 92 TaskHandle m_navigateTaskHandle; |
| 93 Member<ScheduledNavigation> m_redirect; | 93 Member<ScheduledNavigation> m_redirect; |
| 94 | 94 |
| 95 // Exists because we can't deref m_frame in destructor. | 95 // Exists because we can't deref m_frame in destructor. |
| 96 WebScheduler::NavigatingFrameType m_frameType; | 96 WebScheduler::NavigatingFrameType m_frameType; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 class NavigationDisablerForUnload { | 99 class NavigationDisablerForUnload { |
| 100 WTF_MAKE_NONCOPYABLE(NavigationDisablerForUnload); | 100 WTF_MAKE_NONCOPYABLE(NavigationDisablerForUnload); |
| 101 STACK_ALLOCATED(); | 101 STACK_ALLOCATED(); |
| 102 | 102 |
| 103 public: | 103 public: |
| 104 NavigationDisablerForUnload() { s_navigationDisableCount++; } | 104 NavigationDisablerForUnload() { s_navigationDisableCount++; } |
| 105 ~NavigationDisablerForUnload() { | 105 ~NavigationDisablerForUnload() { |
| 106 DCHECK(s_navigationDisableCount); | 106 DCHECK(s_navigationDisableCount); |
| 107 s_navigationDisableCount--; | 107 s_navigationDisableCount--; |
| 108 } | 108 } |
| 109 static bool isNavigationAllowed() { return !s_navigationDisableCount; } | 109 static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 static unsigned s_navigationDisableCount; | 112 static unsigned s_navigationDisableCount; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace blink | 115 } // namespace blink |
| 116 | 116 |
| 117 #endif // NavigationScheduler_h | 117 #endif // NavigationScheduler_h |
| OLD | NEW |