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

Issue 2618893002: Fix memory leak with ScriptedIdleTaskController (Closed)

Created:
3 years, 11 months ago by Xiaocheng
Modified:
3 years, 11 months ago
Reviewers:
haraken, sof
CC:
blink-reviews, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix memory leak with ScriptedIdleTaskController If there is an untriggered idle task when the document is gone, it introduces memory leak because IdleRequestCallbackWrapper keeps a reference to the ScriptedIdleTaskController, making it live longer than the document. This patch fixes the issue by letting IdleRequestCallbackWrapper store a WeakPersistent instead. BUG=595155 Review-Url: https://codereview.chromium.org/2618893002 Cr-Commit-Position: refs/heads/master@{#441929} Committed: https://chromium.googlesource.com/chromium/src/+/114c62b99fd57ac1cf7c0da1150608fd5f68d3bf

Patch Set 1 #

Patch Set 2 : Improve test #

Total comments: 2

Patch Set 3 : Use WeakPersistent #

Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -1 line) Patch
A third_party/WebKit/LayoutTests/idle-callback/untriggered-do-not-leak.html View 1 2 1 chunk +16 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 22 (12 generated)
Xiaocheng
PTAL. The failure on mac_chromium_rel_ng doesn't seem relevant. I'll retry later.
3 years, 11 months ago (2017-01-06 09:27:41 UTC) #5
sof
https://codereview.chromium.org/2618893002/diff/20001/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp File third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp (right): https://codereview.chromium.org/2618893002/diff/20001/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp#newcode66 third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp:66: WTF::WeakPtr<ScriptedIdleTaskController> m_controller; WeakPersistent<> is used to hold onto GC-managed ...
3 years, 11 months ago (2017-01-06 09:31:04 UTC) #6
Xiaocheng
Updated with WeakPersistent. PTAL. https://codereview.chromium.org/2618893002/diff/20001/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp File third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp (right): https://codereview.chromium.org/2618893002/diff/20001/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp#newcode66 third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp:66: WTF::WeakPtr<ScriptedIdleTaskController> m_controller; On 2017/01/06 at ...
3 years, 11 months ago (2017-01-06 09:56:28 UTC) #9
sof
lgtm
3 years, 11 months ago (2017-01-06 10:05:29 UTC) #12
esprehn
Do we need null checks now? I thought a WeakPersistent can become null when it's ...
3 years, 11 months ago (2017-01-06 10:45:51 UTC) #13
sof
On 2017/01/06 10:45:51, esprehn wrote: > Do we need null checks now? I thought a ...
3 years, 11 months ago (2017-01-06 10:48:09 UTC) #14
haraken
LGTM
3 years, 11 months ago (2017-01-06 11:02:19 UTC) #15
Xiaocheng
Thanks for the review!
3 years, 11 months ago (2017-01-06 11:05:49 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2618893002/40001
3 years, 11 months ago (2017-01-06 11:06:04 UTC) #19
commit-bot: I haz the power
3 years, 11 months ago (2017-01-06 13:16:31 UTC) #22
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://chromium.googlesource.com/chromium/src/+/114c62b99fd57ac1cf7c0da11506...

Powered by Google App Engine
This is Rietveld 408576698