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

Side by Side Diff: third_party/WebKit/Source/core/loader/NavigationScheduler.h

Issue 1962053002: Allow expensive task blocking if there is pending iframe navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use an enum Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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. (http://www.t orchmobile.com/) 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
4 * Copyright (C) 2009 Adam Barth. All rights reserved. 4 * Copyright (C) 2009 Adam Barth. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 15 matching lines...) Expand all
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef NavigationScheduler_h 31 #ifndef NavigationScheduler_h
32 #define NavigationScheduler_h 32 #define NavigationScheduler_h
33 33
34 #include "core/CoreExport.h" 34 #include "core/CoreExport.h"
35 #include "platform/heap/Handle.h" 35 #include "platform/heap/Handle.h"
36 #include "public/platform/WebScheduler.h"
36 #include "wtf/Forward.h" 37 #include "wtf/Forward.h"
37 #include "wtf/HashMap.h" 38 #include "wtf/HashMap.h"
38 #include "wtf/Noncopyable.h" 39 #include "wtf/Noncopyable.h"
39 #include "wtf/OwnPtr.h" 40 #include "wtf/OwnPtr.h"
40 #include "wtf/PassOwnPtr.h" 41 #include "wtf/PassOwnPtr.h"
41 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
42 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
43 44
44 namespace blink { 45 namespace blink {
45 46
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool shouldScheduleNavigation(const String& url) const; 81 bool shouldScheduleNavigation(const String& url) const;
81 82
82 void navigateTask(); 83 void navigateTask();
83 void schedule(ScheduledNavigation*); 84 void schedule(ScheduledNavigation*);
84 85
85 static bool mustReplaceCurrentItem(LocalFrame* targetFrame); 86 static bool mustReplaceCurrentItem(LocalFrame* targetFrame);
86 87
87 Member<LocalFrame> m_frame; 88 Member<LocalFrame> m_frame;
88 OwnPtr<CancellableTaskFactory> m_navigateTaskFactory; 89 OwnPtr<CancellableTaskFactory> m_navigateTaskFactory;
89 Member<ScheduledNavigation> m_redirect; 90 Member<ScheduledNavigation> m_redirect;
91 WebScheduler::NavigatingFrameType m_frameType; // Exists because we can't de ref m_frame in destructor.
90 }; 92 };
91 93
92 class NavigationDisablerForBeforeUnload { 94 class NavigationDisablerForBeforeUnload {
93 WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload); 95 WTF_MAKE_NONCOPYABLE(NavigationDisablerForBeforeUnload);
94 STACK_ALLOCATED(); 96 STACK_ALLOCATED();
95 public: 97 public:
96 NavigationDisablerForBeforeUnload() 98 NavigationDisablerForBeforeUnload()
97 { 99 {
98 s_navigationDisableCount++; 100 s_navigationDisableCount++;
99 } 101 }
100 ~NavigationDisablerForBeforeUnload() 102 ~NavigationDisablerForBeforeUnload()
101 { 103 {
102 ASSERT(s_navigationDisableCount); 104 ASSERT(s_navigationDisableCount);
103 s_navigationDisableCount--; 105 s_navigationDisableCount--;
104 } 106 }
105 static bool isNavigationAllowed() { return !s_navigationDisableCount; } 107 static bool isNavigationAllowed() { return !s_navigationDisableCount; }
106 108
107 private: 109 private:
108 static unsigned s_navigationDisableCount; 110 static unsigned s_navigationDisableCount;
109 }; 111 };
110 112
111 } // namespace blink 113 } // namespace blink
112 114
113 #endif // NavigationScheduler_h 115 #endif // NavigationScheduler_h
OLDNEW
« no previous file with comments | « content/test/fake_renderer_scheduler.cc ('k') | third_party/WebKit/Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698