RESOLVED FIXED70896
MediaStreamRegistry should hold references to MediaStreamDescriptor rather than MediaStream
https://bugs.webkit.org/show_bug.cgi?id=70896
Summary MediaStreamRegistry should hold references to MediaStreamDescriptor rather th...
Adam Bergkvist
Reported 2011-10-26 02:45:32 PDT
Update the MediaStreamRegistry to use MediaStreamDescriptor instead of MediaStream.
Attachments
Patch (3.66 KB, patch)
2011-11-02 10:18 PDT, Tommy Widenflycht
no flags
Patch (3.53 KB, patch)
2011-11-02 10:40 PDT, Tommy Widenflycht
no flags
Patch (3.53 KB, patch)
2011-11-02 10:54 PDT, Tommy Widenflycht
no flags
Tommy Widenflycht
Comment 1 2011-11-02 10:18:10 PDT
Tommy Widenflycht
Comment 2 2011-11-02 10:19:08 PDT
Adam, hope you don't mind me taking over this bug...
Adam Barth
Comment 3 2011-11-02 10:27:58 PDT
Comment on attachment 113327 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113327&action=review > Source/WebCore/mediastream/MediaStreamRegistry.cpp:50 > + m_streamDescriptors.set(url.string(), streamDescriptor); streamDescriptor.release(), presumably. > Source/WebCore/mediastream/MediaStreamRegistry.cpp:59 > -MediaStream* MediaStreamRegistry::mediaStream(const KURL& url) const > +PassRefPtr<MediaStreamDescriptor> MediaStreamRegistry::lookupMediaStreamDescriptor(const String& key) The key isn't a URL? Also, this should just return a raw pointer. The function doesn't transfer ownership. If you haven't read <http://www.webkit.org/coding/RefPtr.html>, it might help you with this sort of thing. > Source/WebCore/mediastream/MediaStreamRegistry.h:49 > + PassRefPtr<MediaStreamDescriptor> lookupMediaStreamDescriptor(const String& key); I don't see any callers of this function in this patch. I'm not sure whether it should take a KURL or whether it should take a String named url, but the keys do seem to be URLs. Maybe we should wait to add this until its needed?
Tommy Widenflycht
Comment 4 2011-11-02 10:35:54 PDT
Comment on attachment 113327 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113327&action=review >> Source/WebCore/mediastream/MediaStreamRegistry.cpp:50 >> + m_streamDescriptors.set(url.string(), streamDescriptor); > > streamDescriptor.release(), presumably. Fixed. >> Source/WebCore/mediastream/MediaStreamRegistry.cpp:59 >> +PassRefPtr<MediaStreamDescriptor> MediaStreamRegistry::lookupMediaStreamDescriptor(const String& key) > > The key isn't a URL? > > Also, this should just return a raw pointer. The function doesn't transfer ownership. If you haven't read <http://www.webkit.org/coding/RefPtr.html>, it might help you with this sort of thing. Sorry, i do this misstake now and then :/ This class will be extended to index MediaStream IDs as well as URLs in the next step, but I have changed the parameter name to url for now. >> Source/WebCore/mediastream/MediaStreamRegistry.h:49 >> + PassRefPtr<MediaStreamDescriptor> lookupMediaStreamDescriptor(const String& key); > > I don't see any callers of this function in this patch. I'm not sure whether it should take a KURL or whether it should take a String named url, but the keys do seem to be URLs. Maybe we should wait to add this until its needed? This will be called from the WebKit API that I will (re)add as soon as this patch goes in.
Tommy Widenflycht
Comment 5 2011-11-02 10:40:23 PDT
Adam Barth
Comment 6 2011-11-02 10:47:07 PDT
Comment on attachment 113330 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113330&action=review > Source/WebCore/ChangeLog:14 > + Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code. Usually we put this information above the list of files/function names. > Source/WebCore/mediastream/MediaStreamRegistry.cpp:46 > - m_streams.add(url.string(), stream); > + m_streamDescriptors.set(url.string(), stream->descriptor()); You wrote "fixed", but this doesn't appear to have changed. :)
Tommy Widenflycht
Comment 7 2011-11-02 10:51:33 PDT
Comment on attachment 113330 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=113330&action=review >> Source/WebCore/ChangeLog:14 >> + Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code. > > Usually we put this information above the list of files/function names. OK >> Source/WebCore/mediastream/MediaStreamRegistry.cpp:46 >> + m_streamDescriptors.set(url.string(), stream->descriptor()); > > You wrote "fixed", but this doesn't appear to have changed. :) But I don't store the descriptor in a RefPtr any more... Just passing a raw pointer. Realized that a stream always have a descriptor.
Tommy Widenflycht
Comment 8 2011-11-02 10:54:11 PDT
Adam Barth
Comment 9 2011-11-02 11:03:11 PDT
Comment on attachment 113334 [details] Patch Ah, you're right.
WebKit Review Bot
Comment 10 2011-11-02 12:12:11 PDT
Comment on attachment 113334 [details] Patch Clearing flags on attachment: 113334 Committed r99087: <http://trac.webkit.org/changeset/99087>
WebKit Review Bot
Comment 11 2011-11-02 12:12:16 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.