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

Issue 2848363002: [Media, Controls] Use a weak ref to the listener from callback. (Closed)

Created:
3 years, 7 months ago by whywhat
Modified:
3 years, 7 months ago
Reviewers:
haraken
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Media, Controls] Use a weak ref to the listener from callback. Seems like holding a strong reference causes the leakage. BUG=717094 TEST=run the failing tests locally with --enable-leak-detection TBR=haraken NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2848363002 Cr-Commit-Position: refs/heads/master@{#468525} Committed: https://chromium.googlesource.com/chromium/src/+/27e76cce52a397ea93c9bcf38454c2b4013b7db9

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M third_party/WebKit/Source/modules/media_controls/MediaControlsMediaEventListener.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 17 (9 generated)
whywhat
PTaL
3 years, 7 months ago (2017-05-01 21:01:34 UTC) #2
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/2848363002/1
3 years, 7 months ago (2017-05-02 01:19:03 UTC) #9
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/27e76cce52a397ea93c9bcf38454c2b4013b7db9
3 years, 7 months ago (2017-05-02 01:23:47 UTC) #12
haraken
Is it not guaranteed that OnRemotePlaybackAvailabilityChanged gets called unconditionally?
3 years, 7 months ago (2017-05-02 01:27:05 UTC) #13
haraken
On 2017/05/02 01:27:05, haraken wrote: > Is it not guaranteed that OnRemotePlaybackAvailabilityChanged gets called > ...
3 years, 7 months ago (2017-05-03 01:02:17 UTC) #14
whywhat
On 2017/05/03 at 01:02:17, haraken wrote: > On 2017/05/02 01:27:05, haraken wrote: > > Is ...
3 years, 7 months ago (2017-05-03 02:04:22 UTC) #15
haraken
On 2017/05/03 02:04:22, whywhat wrote: > On 2017/05/03 at 01:02:17, haraken wrote: > > On ...
3 years, 7 months ago (2017-05-03 09:16:35 UTC) #16
whywhat
3 years, 7 months ago (2017-05-03 14:54:15 UTC) #17
Message was sent while issue was closed.
On 2017/05/03 at 09:16:35, haraken wrote:
> On 2017/05/03 02:04:22, whywhat wrote:
> > On 2017/05/03 at 01:02:17, haraken wrote:
> > > On 2017/05/02 01:27:05, haraken wrote:
> > > > Is it not guaranteed that OnRemotePlaybackAvailabilityChanged gets
called
> > > > unconditionally?
> > > 
> > > ping? I don't fully understand why this reference needs to be weak.
> > 
> > TL;DR I think having a strong reference creates a link in the reference loop
> > that's not understandable by the Blink GC.
> > 
> > OnRemotePlaybackAvailabilityChanged will be called but that doesn't remove
the
> > callback as the availability changes over time and the callback is not a
> > one-shot.
> > 
> > The callback is only removed when HTMLMediaElement is removed from the DOM
so
> > that MediaControlsMediaEventListener::Detach is called.
> > Until that the listener will always be referenced by the callback, the
listener
> > references the controls that references HTMLMediaElement, that references
the
> > Document.
> > 
> > Maybe there's some other event when we can remove the callback to avoid
leaking
> > the document but I don't know about it.
> 
> Thanks, that makes sense. We could probably add a comment about why it needs
to be weak.

Thanks, will do in a follow up change.

Powered by Google App Engine
This is Rietveld 408576698