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

Unified 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: test 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/NavigationScheduler.h
diff --git a/third_party/WebKit/Source/core/loader/NavigationScheduler.h b/third_party/WebKit/Source/core/loader/NavigationScheduler.h
index b3ce2f54d134b00ebeb7359072bf9ae0bca0bed5..96d0556b00929977cfa4f7cbbba0e2f6455ba10b 100644
--- a/third_party/WebKit/Source/core/loader/NavigationScheduler.h
+++ b/third_party/WebKit/Source/core/loader/NavigationScheduler.h
@@ -110,6 +110,25 @@ private:
static unsigned s_navigationDisableCount;
};
+class CORE_EXPORT NavigationCounterForUnload {
+ WTF_MAKE_NONCOPYABLE(NavigationCounterForUnload);
+ STACK_ALLOCATED();
+public:
+ NavigationCounterForUnload()
+ {
+ s_inUnloadHandler++;
+ }
+ ~NavigationCounterForUnload()
+ {
+ ASSERT(s_inUnloadHandler);
+ s_inUnloadHandler--;
+ }
+ static bool inUnloadHandler() { return !!s_inUnloadHandler; }
+
+private:
+ static unsigned s_inUnloadHandler;
+};
+
} // namespace blink
#endif // NavigationScheduler_h

Powered by Google App Engine
This is Rietveld 408576698