Bug 83143 - MediaStream API: MediaStreams stops proper cleanup to take place during a page reload.
: MediaStream API: MediaStreams stops proper cleanup to take place during a pag...
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: WebCore Misc.
: 528+ (Nightly build)
: All All
: P2 Normal
Assigned To: Tommy Widenflycht
:
Depends on:
Blocks: 56459
  Show dependency treegraph
 
Reported: 2012-04-04 04:07 PDT by Tommy Widenflycht
Modified: 2012-04-18 17:25 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.58 KB, patch)
2012-04-04 04:11 PDT, Tommy Widenflycht
no flags Details | Formatted Diff | Diff
Patch (8.12 KB, patch)
2012-04-05 02:41 PDT, Tommy Widenflycht
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tommy Widenflycht 2012-04-04 04:07:37 PDT
To fix this I have converted MediaStream and LocalMediaStream to be ActiveDOMObjects.
Comment 1 Tommy Widenflycht 2012-04-04 04:11:25 PDT
Created attachment 135553 [details]
Patch
Comment 2 Tommy Widenflycht 2012-04-04 04:14:17 PDT
I think the main problem was having the ScriptExecutionContext stored in a RefPtr which likely caused a circular reference. However switching to ActiveDOMObjects also gives the automatic calling of the stop() function which is an added bonus.
Comment 3 Adam Barth 2012-04-04 11:06:04 PDT
Comment on attachment 135553 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=135553&action=review

This looks mostly fine, but I'm going to mark it R- because of the IDL / ActiveDOMObject thing.  I've also left you a couple other things to think about for the next iteration.

> Source/WebCore/Modules/mediastream/LocalMediaStream.h:41
> +    // ActiveDOMObject and idl

Woah.  Should we use [ImplementedAs] to avoid having this one function play both roles?  It's fine if one calls the other, but it's better to do that explicitly rather than having a name collision like this.

> Source/WebCore/Modules/mediastream/MediaStream.cpp:135
> +void MediaStream::stop()
> +{
> +}

If you don't need stop(), you can just use a ContextDestructionObserver rather than ActiveDOMObject.
Comment 4 Tommy Widenflycht 2012-04-05 02:41:09 PDT
Created attachment 135788 [details]
Patch
Comment 5 Tommy Widenflycht 2012-04-05 02:43:32 PDT
Comment on attachment 135553 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=135553&action=review

>> Source/WebCore/Modules/mediastream/LocalMediaStream.h:41
>> +    // ActiveDOMObject and idl
> 
> Woah.  Should we use [ImplementedAs] to avoid having this one function play both roles?  It's fine if one calls the other, but it's better to do that explicitly rather than having a name collision like this.

Fixed. And I learnt something new today as well :)

>> Source/WebCore/Modules/mediastream/MediaStream.cpp:135
>> +}
> 
> If you don't need stop(), you can just use a ContextDestructionObserver rather than ActiveDOMObject.

MediaStream doesn't but LocalMediaStream does. Removed the empty implementation.
Comment 6 Adam Barth 2012-04-06 10:13:36 PDT
Comment on attachment 135788 [details]
Patch

Thanks.
Comment 7 WebKit Review Bot 2012-04-06 11:07:32 PDT
Comment on attachment 135788 [details]
Patch

Clearing flags on attachment: 135788

Committed r113460: <http://trac.webkit.org/changeset/113460>
Comment 8 WebKit Review Bot 2012-04-06 11:07:37 PDT
All reviewed patches have been landed.  Closing bug.