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

Issue 2725873002: Media: fix memory leak because of the document holding on an EventListener. (Closed)

Created:
3 years, 9 months ago by mlamouri (slow - plz ping)
Modified:
3 years, 9 months ago
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink, eric.carlson_apple.com, feature-media-reviews_chromium.org, fs, gasubic, mlamouri+watch-blink_chromium.org, nessy, Srirama
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Media: fix memory leak because of the document holding on an EventListener. MediaControls checks if they are part of a document or not in order to unregister most of its event listeners when removed from a document to avoid leaking memory until the document is closed. The approach taken in this CL is the most "web based" because the controls are using events. Another approach would be to use internal callbacks (from ContainerNode) or even have a `addWeakEventListener` method in EventTarget. The latter might be an interesting solution. BUG=680898 R=zqzhang@chromium.org,ojan@chromium.org Review-Url: https://codereview.chromium.org/2725873002 Cr-Commit-Position: refs/heads/master@{#454060} Committed: https://chromium.googlesource.com/chromium/src/+/8daac32c17f494d496fb2ca3768d67d9bd77db5e

Patch Set 1 #

Total comments: 4

Patch Set 2 : event-based #

Total comments: 3

Messages

Total messages: 21 (8 generated)
mlamouri (slow - plz ping)
zqzhang@, can you take an early look? The CL makes it so the HTMLMediaElement destroys ...
3 years, 9 months ago (2017-03-01 15:28:59 UTC) #1
Zhiqiang Zhang (Slow)
sgtm in general. One question: In case the element is inserted back to the document, ...
3 years, 9 months ago (2017-03-01 15:37:03 UTC) #2
Zhiqiang Zhang (Slow)
https://codereview.chromium.org/2725873002/diff/1/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp File third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp (right): https://codereview.chromium.org/2725873002/diff/1/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp#newcode18 third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp:18: mediaElement().addEventListener(EventTypeNames::volumechange, this, false); Same concern as MediaControlsOrientationLockDelegate, when we ...
3 years, 9 months ago (2017-03-01 16:22:37 UTC) #3
mlamouri (slow - plz ping)
zqzhang@ PTAL +ojan@ for third_party/WebKit/Source/core/BUILD.gn https://codereview.chromium.org/2725873002/diff/1/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp File third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp (right): https://codereview.chromium.org/2725873002/diff/1/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp#newcode18 third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp:18: mediaElement().addEventListener(EventTypeNames::volumechange, this, false); On ...
3 years, 9 months ago (2017-03-01 20:22:33 UTC) #8
ojan
lgtm
3 years, 9 months ago (2017-03-01 21:02:50 UTC) #9
Zhiqiang Zhang (Slow)
lgtm w/ nit https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp File third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp (right): https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp#newcode66 third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp:66: document().body()->appendChild(video()); Can GC happen between these ...
3 years, 9 months ago (2017-03-01 21:20:52 UTC) #10
mlamouri (slow - plz ping)
https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp File third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp (right): https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp#newcode66 third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp:66: document().body()->appendChild(video()); On 2017/03/01 at 21:20:52, Zhiqiang Zhang wrote: > ...
3 years, 9 months ago (2017-03-01 21:44:01 UTC) #11
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/2725873002/20001
3 years, 9 months ago (2017-03-01 21:45:08 UTC) #14
sof
https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp File third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp (right): https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp#newcode66 third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp:66: document().body()->appendChild(video()); On 2017/03/01 21:44:01, mlamouri wrote: > On 2017/03/01 ...
3 years, 9 months ago (2017-03-01 21:45:35 UTC) #15
mlamouri (slow - plz ping)
On 2017/03/01 at 21:45:35, sigbjornf wrote: > https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp > File third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp (right): > > https://codereview.chromium.org/2725873002/diff/20001/third_party/WebKit/Source/core/html/shadow/MediaControlsLeakTest.cpp#newcode66 ...
3 years, 9 months ago (2017-03-01 21:48:01 UTC) #16
sof
On 2017/03/01 21:48:01, mlamouri wrote: > On 2017/03/01 at 21:45:35, sigbjornf wrote: > > > ...
3 years, 9 months ago (2017-03-01 21:50:31 UTC) #17
mlamouri (slow - plz ping)
On 2017/03/01 at 21:50:31, sigbjornf wrote: > On 2017/03/01 21:48:01, mlamouri wrote: > > On ...
3 years, 9 months ago (2017-03-01 22:05:46 UTC) #18
commit-bot: I haz the power
3 years, 9 months ago (2017-03-01 22:10:51 UTC) #21
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://chromium.googlesource.com/chromium/src/+/8daac32c17f494d496fb2ca3768d...

Powered by Google App Engine
This is Rietveld 408576698