Bug 128532

Summary: [MSE] Move PublicURLManager shutdown logic so ActiveDOMObjects associated with public URLs won't leak.
Product: WebKit Reporter: Byungseon(Sun) Shin <sun.shin>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, gyuyoung.kim, jer.noble, kangil.han, pnormand
Priority: P2 Keywords: BlinkMergeCandidate
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 141977    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Byungseon(Sun) Shin
Reported 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
Attachments
Patch (5.01 KB, patch)
2014-02-10 08:22 PST, Byungseon(Sun) Shin
no flags
Patch (5.07 KB, patch)
2014-02-10 17:57 PST, Byungseon(Sun) Shin
no flags
Patch (5.07 KB, patch)
2014-02-10 19:13 PST, Byungseon(Sun) Shin
no flags
Patch (5.20 KB, patch)
2014-02-11 06:52 PST, Byungseon(Sun) Shin
no flags
Patch (5.53 KB, patch)
2014-02-11 08:52 PST, Byungseon(Sun) Shin
no flags
Patch (5.53 KB, patch)
2014-02-11 09:03 PST, Byungseon(Sun) Shin
no flags
Byungseon(Sun) Shin
Comment 1 2014-02-10 08:22:28 PST
Byungseon(Sun) Shin
Comment 2 2014-02-10 17:57:31 PST
Byungseon(Sun) Shin
Comment 3 2014-02-10 19:13:30 PST
Philippe Normand
Comment 4 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.
Byungseon(Sun) Shin
Comment 5 2014-02-11 06:52:16 PST
Jer Noble
Comment 6 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.
Byungseon(Sun) Shin
Comment 7 2014-02-11 08:52:54 PST
Byungseon(Sun) Shin
Comment 8 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.
Byungseon(Sun) Shin
Comment 9 2014-02-11 09:03:14 PST
Jer Noble
Comment 10 2014-02-11 09:05:17 PST
Comment on attachment 223871 [details] Patch Thanks! r=me.
WebKit Commit Bot
Comment 11 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>
WebKit Commit Bot
Comment 12 2014-02-13 19:58:56 PST
All reviewed patches have been landed. Closing bug.
Byungseon(Sun) Shin
Comment 13 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<>.
Byungseon(Sun) Shin
Comment 14 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<>.
Note You need to log in before you can comment on or make changes to this bug.