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

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

Issue 2366253002: Remove ActiveDOMObject::stop() (Closed)
Patch Set: temp Created 4 years, 2 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 m_nestingLevel >= maxTimerNestingLevel) 101 m_nestingLevel >= maxTimerNestingLevel)
102 intervalMilliseconds = minimumInterval; 102 intervalMilliseconds = minimumInterval;
103 if (singleShot) 103 if (singleShot)
104 startOneShot(intervalMilliseconds, BLINK_FROM_HERE); 104 startOneShot(intervalMilliseconds, BLINK_FROM_HERE);
105 else 105 else
106 startRepeating(intervalMilliseconds, BLINK_FROM_HERE); 106 startRepeating(intervalMilliseconds, BLINK_FROM_HERE);
107 } 107 }
108 108
109 DOMTimer::~DOMTimer() {} 109 DOMTimer::~DOMTimer() {}
110 110
111 void DOMTimer::disposeTimer() { 111 void DOMTimer::stop() {
112 InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
113 m_userGestureToken = nullptr;
114 // Need to release JS objects potentially protected by ScheduledAction
115 // because they can form circular references back to the ExecutionContext
116 // which will cause a memory leak.
112 m_action = nullptr; 117 m_action = nullptr;
113 m_userGestureToken = nullptr; 118 SuspendableTimer::stop();
119 }
120
121 void DOMTimer::contextDestroyed() {
114 stop(); 122 stop();
115 } 123 }
116 124
117 void DOMTimer::fired() { 125 void DOMTimer::fired() {
118 ExecutionContext* context = getExecutionContext(); 126 ExecutionContext* context = getExecutionContext();
119 ASSERT(context); 127 ASSERT(context);
120 context->timers()->setTimerNestingLevel(m_nestingLevel); 128 context->timers()->setTimerNestingLevel(m_nestingLevel);
121 ASSERT(!context->activeDOMObjectsAreSuspended()); 129 ASSERT(!context->activeDOMObjectsAreSuspended());
122 // Only the first execution of a multi-shot timer should get an affirmative us er gesture indicator. 130 // Only the first execution of a multi-shot timer should get an affirmative us er gesture indicator.
123 UserGestureIndicator gestureIndicator(m_userGestureToken.release()); 131 UserGestureIndicator gestureIndicator(m_userGestureToken.release());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // ExecutionContext might be already gone when we executed action->execute(). 163 // ExecutionContext might be already gone when we executed action->execute().
156 ExecutionContext* executionContext = getExecutionContext(); 164 ExecutionContext* executionContext = getExecutionContext();
157 if (!executionContext) 165 if (!executionContext)
158 return; 166 return;
159 167
160 executionContext->timers()->setTimerNestingLevel(0); 168 executionContext->timers()->setTimerNestingLevel(0);
161 // Eagerly unregister as ExecutionContext observer. 169 // Eagerly unregister as ExecutionContext observer.
162 clearContext(); 170 clearContext();
163 } 171 }
164 172
165 void DOMTimer::stop() {
166 InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
167 SuspendableTimer::stop();
168 // Need to release JS objects potentially protected by ScheduledAction
169 // because they can form circular references back to the ExecutionContext
170 // which will cause a memory leak.
171 m_action.clear();
172 }
173
174 WebTaskRunner* DOMTimer::timerTaskRunner() const { 173 WebTaskRunner* DOMTimer::timerTaskRunner() const {
175 return getExecutionContext()->timers()->timerTaskRunner(); 174 return getExecutionContext()->timers()->timerTaskRunner();
176 } 175 }
177 176
178 DEFINE_TRACE(DOMTimer) { 177 DEFINE_TRACE(DOMTimer) {
179 visitor->trace(m_action); 178 visitor->trace(m_action);
180 SuspendableTimer::trace(visitor); 179 SuspendableTimer::trace(visitor);
181 } 180 }
182 181
183 } // namespace blink 182 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698