Bug 70896 - MediaStreamRegistry should hold references to MediaStreamDescriptor rather than MediaStream
Summary: MediaStreamRegistry should hold references to MediaStreamDescriptor rather th...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Tommy Widenflycht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-26 02:45 PDT by Adam Bergkvist
Modified: 2011-11-02 12:12 PDT (History)
5 users (show)

See Also:


Attachments
Patch (3.66 KB, patch)
2011-11-02 10:18 PDT, Tommy Widenflycht
no flags Details | Formatted Diff | Diff
Patch (3.53 KB, patch)
2011-11-02 10:40 PDT, Tommy Widenflycht
no flags Details | Formatted Diff | Diff
Patch (3.53 KB, patch)
2011-11-02 10:54 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 Adam Bergkvist 2011-10-26 02:45:32 PDT
Update the MediaStreamRegistry to use MediaStreamDescriptor instead of MediaStream.
Comment 1 Tommy Widenflycht 2011-11-02 10:18:10 PDT
Created attachment 113327 [details]
Patch
Comment 2 Tommy Widenflycht 2011-11-02 10:19:08 PDT
Adam, hope you don't mind me taking over this bug...
Comment 3 Adam Barth 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?
Comment 4 Tommy Widenflycht 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.
Comment 5 Tommy Widenflycht 2011-11-02 10:40:23 PDT
Created attachment 113330 [details]
Patch
Comment 6 Adam Barth 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.  :)
Comment 7 Tommy Widenflycht 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.
Comment 8 Tommy Widenflycht 2011-11-02 10:54:11 PDT
Created attachment 113334 [details]
Patch
Comment 9 Adam Barth 2011-11-02 11:03:11 PDT
Comment on attachment 113334 [details]
Patch

Ah, you're right.
Comment 10 WebKit Review Bot 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>
Comment 11 WebKit Review Bot 2011-11-02 12:12:16 PDT
All reviewed patches have been landed.  Closing bug.