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. (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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 { | 102 { |
103 ASSERT(s_navigationDisableCount); | 103 ASSERT(s_navigationDisableCount); |
104 s_navigationDisableCount--; | 104 s_navigationDisableCount--; |
105 } | 105 } |
106 static bool isNavigationAllowed() { return !s_navigationDisableCount; } | 106 static bool isNavigationAllowed() { return !s_navigationDisableCount; } |
107 | 107 |
108 private: | 108 private: |
109 static unsigned s_navigationDisableCount; | 109 static unsigned s_navigationDisableCount; |
110 }; | 110 }; |
111 | 111 |
112 class CORE_EXPORT NavigationCounterForUnload { | 112 class CORE_EXPORT NavigationDisablerForUnload { |
dcheng
2016/08/16 22:32:03
Can we just use NavigationDisablerForBeforeUnload,
| |
113 WTF_MAKE_NONCOPYABLE(NavigationCounterForUnload); | 113 WTF_MAKE_NONCOPYABLE(NavigationDisablerForUnload); |
114 STACK_ALLOCATED(); | 114 STACK_ALLOCATED(); |
115 public: | 115 public: |
116 NavigationCounterForUnload() | 116 NavigationDisablerForUnload() |
117 { | 117 { |
118 s_inUnloadHandler++; | 118 s_inUnloadHandler++; |
119 } | 119 } |
120 ~NavigationCounterForUnload() | 120 ~NavigationDisablerForUnload() |
121 { | 121 { |
122 DCHECK(s_inUnloadHandler); | 122 DCHECK(s_inUnloadHandler); |
123 s_inUnloadHandler--; | 123 s_inUnloadHandler--; |
124 } | 124 } |
125 static bool inUnloadHandler() { return !!s_inUnloadHandler; } | 125 static bool inUnloadHandler() { return !!s_inUnloadHandler; } |
126 | 126 |
127 private: | 127 private: |
128 static unsigned s_inUnloadHandler; | 128 static unsigned s_inUnloadHandler; |
129 }; | 129 }; |
130 | 130 |
131 } // namespace blink | 131 } // namespace blink |
132 | 132 |
133 #endif // NavigationScheduler_h | 133 #endif // NavigationScheduler_h |
OLD | NEW |