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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMTimer.cpp

Issue 2694743004: Reset the nesting level for setInterval after completion. (Closed)
Patch Set: remove redundant copy of ExecutionContext Created 3 years, 10 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Simple case for non-one-shot timers. 152 // Simple case for non-one-shot timers.
153 if (isActive()) { 153 if (isActive()) {
154 if (repeatInterval() && repeatInterval() < minimumInterval) { 154 if (repeatInterval() && repeatInterval() < minimumInterval) {
155 m_nestingLevel++; 155 m_nestingLevel++;
156 if (m_nestingLevel >= maxTimerNestingLevel) 156 if (m_nestingLevel >= maxTimerNestingLevel)
157 augmentRepeatInterval(minimumInterval - repeatInterval()); 157 augmentRepeatInterval(minimumInterval - repeatInterval());
158 } 158 }
159 159
160 // No access to member variables after this point, it can delete the timer. 160 // No access to member variables after this point, it can delete the timer.
161 m_action->execute(context); 161 m_action->execute(context);
162
163 context->timers()->setTimerNestingLevel(0);
164
162 return; 165 return;
163 } 166 }
164 167
165 // Unregister the timer from ExecutionContext before executing the action 168 // Unregister the timer from ExecutionContext before executing the action
166 // for one-shot timers. 169 // for one-shot timers.
167 ScheduledAction* action = m_action.release(); 170 ScheduledAction* action = m_action.release();
168 context->timers()->removeTimeoutByID(m_timeoutID); 171 context->timers()->removeTimeoutByID(m_timeoutID);
169 172
170 action->execute(context); 173 action->execute(context);
171 174
(...skipping 16 matching lines...) Expand all
188 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const { 191 RefPtr<WebTaskRunner> DOMTimer::timerTaskRunner() const {
189 return getExecutionContext()->timers()->timerTaskRunner(); 192 return getExecutionContext()->timers()->timerTaskRunner();
190 } 193 }
191 194
192 DEFINE_TRACE(DOMTimer) { 195 DEFINE_TRACE(DOMTimer) {
193 visitor->trace(m_action); 196 visitor->trace(m_action);
194 SuspendableTimer::trace(visitor); 197 SuspendableTimer::trace(visitor);
195 } 198 }
196 199
197 } // namespace blink 200 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/frame/DOMTimerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698