Title: [99087] trunk/Source/WebCore
Revision
99087
Author
[email protected]
Date
2011-11-02 12:11:56 -0700 (Wed, 02 Nov 2011)

Log Message

MediaStreamRegistry should hold references to MediaStreamDescriptor rather than MediaStream
https://bugs.webkit.org/show_bug.cgi?id=70896

Patch by Tommy Widenflycht <[email protected]> on 2011-11-02
Reviewed by Adam Barth.

Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.

* mediastream/MediaStreamRegistry.cpp:
(WebCore::MediaStreamRegistry::registerMediaStreamURL):
(WebCore::MediaStreamRegistry::unregisterMediaStreamURL):
(WebCore::MediaStreamRegistry::lookupMediaStreamDescriptor):
* mediastream/MediaStreamRegistry.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99086 => 99087)


--- trunk/Source/WebCore/ChangeLog	2011-11-02 18:53:07 UTC (rev 99086)
+++ trunk/Source/WebCore/ChangeLog	2011-11-02 19:11:56 UTC (rev 99087)
@@ -1,3 +1,18 @@
+2011-11-02  Tommy Widenflycht  <[email protected]>
+
+        MediaStreamRegistry should hold references to MediaStreamDescriptor rather than MediaStream
+        https://bugs.webkit.org/show_bug.cgi?id=70896
+
+        Reviewed by Adam Barth.
+
+        Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code.
+
+        * mediastream/MediaStreamRegistry.cpp:
+        (WebCore::MediaStreamRegistry::registerMediaStreamURL):
+        (WebCore::MediaStreamRegistry::unregisterMediaStreamURL):
+        (WebCore::MediaStreamRegistry::lookupMediaStreamDescriptor):
+        * mediastream/MediaStreamRegistry.h:
+
 2011-11-02  Zoltan Herczeg  <[email protected]>
 
         Match allowed CSS string characters to Firefox and Opera browsers

Modified: trunk/Source/WebCore/mediastream/MediaStreamRegistry.cpp (99086 => 99087)


--- trunk/Source/WebCore/mediastream/MediaStreamRegistry.cpp	2011-11-02 18:53:07 UTC (rev 99086)
+++ trunk/Source/WebCore/mediastream/MediaStreamRegistry.cpp	2011-11-02 19:11:56 UTC (rev 99087)
@@ -43,22 +43,19 @@
 void MediaStreamRegistry::registerMediaStreamURL(const KURL& url, PassRefPtr<MediaStream> stream)
 {
     ASSERT(isMainThread());
-    m_streams.add(url.string(), stream);
+    m_streamDescriptors.set(url.string(), stream->descriptor());
 }
 
 void MediaStreamRegistry::unregisterMediaStreamURL(const KURL& url)
 {
     ASSERT(isMainThread());
-    m_streams.remove(url.string());
+    m_streamDescriptors.remove(url.string());
 }
 
-MediaStream* MediaStreamRegistry::mediaStream(const KURL& url) const
+MediaStreamDescriptor* MediaStreamRegistry::lookupMediaStreamDescriptor(const String& url)
 {
     ASSERT(isMainThread());
-    URLStreamMap::const_iterator it = m_streams.find(url.string());
-    if (it != m_streams.end())
-        return it->second.get();
-    return 0;
+    return m_streamDescriptors.get(url).get();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/mediastream/MediaStreamRegistry.h (99086 => 99087)


--- trunk/Source/WebCore/mediastream/MediaStreamRegistry.h	2011-11-02 18:53:07 UTC (rev 99086)
+++ trunk/Source/WebCore/mediastream/MediaStreamRegistry.h	2011-11-02 19:11:56 UTC (rev 99087)
@@ -25,6 +25,8 @@
 #ifndef MediaStreamRegistry_h
 #define MediaStreamRegistry_h
 
+#if ENABLE(MEDIA_STREAM)
+
 #include <wtf/HashMap.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/StringHash.h>
@@ -33,6 +35,7 @@
 
 class KURL;
 class MediaStream;
+class MediaStreamDescriptor;
 
 class MediaStreamRegistry {
 public:
@@ -42,13 +45,15 @@
     // Registers a blob URL referring to the specified stream data.
     void registerMediaStreamURL(const KURL&, PassRefPtr<MediaStream>);
     void unregisterMediaStreamURL(const KURL&);
-    MediaStream* mediaStream(const KURL&) const;
 
+    MediaStreamDescriptor* lookupMediaStreamDescriptor(const String& url);
+
 private:
-    typedef HashMap<String, RefPtr<MediaStream> > URLStreamMap;
-    URLStreamMap m_streams;
+    HashMap<String, RefPtr<MediaStreamDescriptor> > m_streamDescriptors;
 };
 
 } // namespace WebCore
 
+#endif // ENABLE(MEDIA_STREAM)
+
 #endif // MediaStreamRegistry_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to