Bug 128532 - [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated with public URLs won't leak.
Summary: [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated wit...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BlinkMergeCandidate
Depends on: 141977
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-10 07:41 PST by Byungseon(Sun) Shin
Modified: 2015-02-24 11:39 PST (History)
6 users (show)

See Also:


Attachments
Patch (5.01 KB, patch)
2014-02-10 08:22 PST, Byungseon(Sun) Shin
no flags Details | Formatted Diff | Diff
Patch (5.07 KB, patch)
2014-02-10 17:57 PST, Byungseon(Sun) Shin
no flags Details | Formatted Diff | Diff
Patch (5.07 KB, patch)
2014-02-10 19:13 PST, Byungseon(Sun) Shin
no flags Details | Formatted Diff | Diff
Patch (5.20 KB, patch)
2014-02-11 06:52 PST, Byungseon(Sun) Shin
no flags Details | Formatted Diff | Diff
Patch (5.53 KB, patch)
2014-02-11 08:52 PST, Byungseon(Sun) Shin
no flags Details | Formatted Diff | Diff
Patch (5.53 KB, patch)
2014-02-11 09:03 PST, Byungseon(Sun) Shin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Byungseon(Sun) Shin 2014-02-10 07:41:53 PST
Converted PublicURLManager to an ActiveDOMObject so that it 
will release all of its references when all other 
ActiveDOMObjects are stopped. This prevents ActiveDOMObjects
that can be associate with public URLs, like 
WebKitMediaSource, from getting leaked. Shutting down 
earlier allows these objects to release their pending 
activity so V8 can garbage collect their wrappers. When the
wrappers get cleaned up the Document is then able to be 
destroyed.

Merged from Blink: https://src.chromium.org/viewvc/blink?view=rev&revision=151890
Comment 1 Byungseon(Sun) Shin 2014-02-10 08:22:28 PST
Created attachment 223716 [details]
Patch
Comment 2 Byungseon(Sun) Shin 2014-02-10 17:57:31 PST
Created attachment 223779 [details]
Patch
Comment 3 Byungseon(Sun) Shin 2014-02-10 19:13:30 PST
Created attachment 223790 [details]
Patch
Comment 4 Philippe Normand 2014-02-11 03:08:27 PST
Comment on attachment 223790 [details]
Patch

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

That looks good but I'd prefer Jer to do the official review, he has better knowledge of MSE

> Source/WebCore/ChangeLog:3
> +        [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated with public URLs won't leak.

Please mention the blink patch from which this patch is based on.
Comment 5 Byungseon(Sun) Shin 2014-02-11 06:52:16 PST
Created attachment 223850 [details]
Patch
Comment 6 Jer Noble 2014-02-11 08:27:55 PST
Comment on attachment 223850 [details]
Patch

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

> Source/WebCore/ChangeLog:6
> +        [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated with public URLs won't leak.
> +        https://bugs.webkit.org/show_bug.cgi?id=128532
> +
> +        Reviewed by NOBODY (OOPS!).

I was really confused until I read the bug report.  It would be nice to add some text to the ChangeLog which says what this fix does.  Something like:

This fixes a leak of DOM objects by breaking the circular reference between Document, PublicURLManager, and MediaSource. Instead of clearing PublicURLManager at destruction-time, which is delayed indefinitely because of the circular reference, clear the PublicURLManager during ActiveDOMObject::stop().

> Source/WebCore/html/PublicURLManager.h:48
> -    static OwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); }
> +    static PassOwnPtr<PublicURLManager> create(ScriptExecutionContext*);

We should fix this function to return a std::unique_ptr<>, but we don't have to do it in this patch.
Comment 7 Byungseon(Sun) Shin 2014-02-11 08:52:54 PST
Created attachment 223867 [details]
Patch
Comment 8 Byungseon(Sun) Shin 2014-02-11 08:55:57 PST
Comment on attachment 223850 [details]
Patch

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

>> Source/WebCore/ChangeLog:6
>> +        Reviewed by NOBODY (OOPS!).
> 
> I was really confused until I read the bug report.  It would be nice to add some text to the ChangeLog which says what this fix does.  Something like:
> 
> This fixes a leak of DOM objects by breaking the circular reference between Document, PublicURLManager, and MediaSource. Instead of clearing PublicURLManager at destruction-time, which is delayed indefinitely because of the circular reference, clear the PublicURLManager during ActiveDOMObject::stop().

@Jer, thanks for the comment. I have applied new patch.

>> Source/WebCore/html/PublicURLManager.h:48
>> +    static PassOwnPtr<PublicURLManager> create(ScriptExecutionContext*);
> 
> We should fix this function to return a std::unique_ptr<>, but we don't have to do it in this patch.

OK, I'll prepare a new patch for it.
Comment 9 Byungseon(Sun) Shin 2014-02-11 09:03:14 PST
Created attachment 223871 [details]
Patch
Comment 10 Jer Noble 2014-02-11 09:05:17 PST
Comment on attachment 223871 [details]
Patch

Thanks! r=me.
Comment 11 WebKit Commit Bot 2014-02-13 19:58:53 PST
Comment on attachment 223871 [details]
Patch

Clearing flags on attachment: 223871

Committed r164091: <http://trac.webkit.org/changeset/164091>
Comment 12 WebKit Commit Bot 2014-02-13 19:58:56 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Byungseon(Sun) Shin 2014-02-16 23:28:26 PST
(In reply to comment #6)
> (From update of attachment 223850 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=223850&action=review
> 
> > Source/WebCore/ChangeLog:6
> > +        [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated with public URLs won't leak.
> > +        https://bugs.webkit.org/show_bug.cgi?id=128532
> > +
> > +        Reviewed by NOBODY (OOPS!).
> 
> I was really confused until I read the bug report.  It would be nice to add some text to the ChangeLog which says what this fix does.  Something like:
> 
> This fixes a leak of DOM objects by breaking the circular reference between Document, PublicURLManager, and MediaSource. Instead of clearing PublicURLManager at destruction-time, which is delayed indefinitely because of the circular reference, clear the PublicURLManager during ActiveDOMObject::stop().
> 
> > Source/WebCore/html/PublicURLManager.h:48
> > -    static OwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); }
> > +    static PassOwnPtr<PublicURLManager> create(ScriptExecutionContext*);
> 
> We should fix this function to return a std::unique_ptr<>, but we don't have to do it in this patch.

Bug 128891 has been created to return  std::unique_ptr<>.
Comment 14 Byungseon(Sun) Shin 2014-02-16 23:59:58 PST
(In reply to comment #6)
> (From update of attachment 223850 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=223850&action=review
> 
> > Source/WebCore/ChangeLog:6
> > +        [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated with public URLs won't leak.
> > +        https://bugs.webkit.org/show_bug.cgi?id=128532
> > +
> > +        Reviewed by NOBODY (OOPS!).
> 
> I was really confused until I read the bug report.  It would be nice to add some text to the ChangeLog which says what this fix does.  Something like:
> 
> This fixes a leak of DOM objects by breaking the circular reference between Document, PublicURLManager, and MediaSource. Instead of clearing PublicURLManager at destruction-time, which is delayed indefinitely because of the circular reference, clear the PublicURLManager during ActiveDOMObject::stop().
> 
> > Source/WebCore/html/PublicURLManager.h:48
> > -    static OwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); }
> > +    static PassOwnPtr<PublicURLManager> create(ScriptExecutionContext*);
> 
> We should fix this function to return a std::unique_ptr<>, but we don't have to do it in this patch.

Bug 128891 has been created to return  std::unique_ptr<>.