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 { |