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

Unified Diff: third_party/WebKit/Source/core/frame/DOMTimer.cpp

Issue 2552673002: Eagerly dispose of ScheduledActions (reland.) (Closed)
Patch Set: Add assert Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/DOMTimer.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
index f3cd7206b7826207d9a7198b07e43f128a53a349..a6140804ca9f54ac1a5eb73cb73cc82aa0a5ac0c 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -107,7 +107,10 @@ DOMTimer::DOMTimer(ExecutionContext* context,
startRepeating(intervalMilliseconds, BLINK_FROM_HERE);
}
-DOMTimer::~DOMTimer() {}
+DOMTimer::~DOMTimer() {
+ if (m_action)
+ m_action->dispose();
+}
void DOMTimer::stop() {
InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
@@ -115,6 +118,8 @@ void DOMTimer::stop() {
// Need to release JS objects potentially protected by ScheduledAction
// because they can form circular references back to the ExecutionContext
// which will cause a memory leak.
+ if (m_action)
+ m_action->dispose();
m_action = nullptr;
SuspendableTimer::stop();
}
@@ -172,6 +177,8 @@ void DOMTimer::fired() {
executionContext->timers()->setTimerNestingLevel(0);
// Eagerly unregister as ExecutionContext observer.
clearContext();
+ // Eagerly clear out |action|'s resources.
+ action->dispose();
}
WebTaskRunner* DOMTimer::timerTaskRunner() const {
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698