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

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

Issue 1969723004: Add a counter and a deprecation message when navigating in an unload handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding line number to test expectation 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 { 103 {
104 ASSERT(s_navigationDisableCount); 104 ASSERT(s_navigationDisableCount);
105 s_navigationDisableCount--; 105 s_navigationDisableCount--;
106 } 106 }
107 static bool isNavigationAllowed() { return !s_navigationDisableCount; } 107 static bool isNavigationAllowed() { return !s_navigationDisableCount; }
108 108
109 private: 109 private:
110 static unsigned s_navigationDisableCount; 110 static unsigned s_navigationDisableCount;
111 }; 111 };
112 112
113 class CORE_EXPORT NavigationCounterForUnload {
114 WTF_MAKE_NONCOPYABLE(NavigationCounterForUnload);
115 STACK_ALLOCATED();
116 public:
117 NavigationCounterForUnload()
118 {
119 s_inUnloadHandler++;
120 }
121 ~NavigationCounterForUnload()
122 {
123 DCHECK(s_inUnloadHandler);
124 s_inUnloadHandler--;
125 }
126 static bool inUnloadHandler() { return !!s_inUnloadHandler; }
127
128 private:
129 static unsigned s_inUnloadHandler;
130 };
131
113 } // namespace blink 132 } // namespace blink
114 133
115 #endif // NavigationScheduler_h 134 #endif // NavigationScheduler_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | third_party/WebKit/Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698