[chromium] MediaStream API: Fixing memory leak in WebMediaStreamSource
authortommyw@google.com <tommyw@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Dec 2011 21:01:59 +0000 (21:01 +0000)
committertommyw@google.com <tommyw@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Dec 2011 21:01:59 +0000 (21:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74714

Reviewed by Eric Seidel.

Missed that PassRefPtr does a ref if constructed with a raw pointer.
Also removed an extra space in WebMediaStreamDescriptor.cpp.

* src/WebMediaStreamDescriptor.cpp:
(WebKit::WebMediaStreamDescriptor::sources):
* src/WebMediaStreamSource.cpp:
(WebKit::WebMediaStreamSource::operator=):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103258 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp
Source/WebKit/chromium/src/WebMediaStreamSource.cpp

index 56259ef..7ac0eb9 100644 (file)
@@ -1,3 +1,18 @@
+2011-12-19  Tommy Widenflycht  <tommyw@google.com>
+
+        [chromium] MediaStream API: Fixing memory leak in WebMediaStreamSource
+        https://bugs.webkit.org/show_bug.cgi?id=74714
+
+        Reviewed by Eric Seidel.
+
+        Missed that PassRefPtr does a ref if constructed with a raw pointer.
+        Also removed an extra space in WebMediaStreamDescriptor.cpp.
+
+        * src/WebMediaStreamDescriptor.cpp:
+        (WebKit::WebMediaStreamDescriptor::sources):
+        * src/WebMediaStreamSource.cpp:
+        (WebKit::WebMediaStreamSource::operator=):
+
 2011-12-19  Adrienne Walker  <enne@google.com>
 
         Try to fix the Chromium win builder NotNull conflict.
index f6ac6cd..0cf53c0 100644 (file)
@@ -65,7 +65,7 @@ void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSourc
     size_t numberOfSources = m_private->numberOfComponents();
     WebVector<WebMediaStreamSource> result(numberOfSources);
     for (size_t i = 0; i < numberOfSources; ++i)
-        result[i] =  m_private->component(i)->source();
+        result[i] = m_private->component(i)->source();
     webSources.swap(result);
 }
 
index be2b524..fe826f1 100644 (file)
@@ -49,11 +49,7 @@ WebMediaStreamSource::WebMediaStreamSource(const PassRefPtr<MediaStreamSource>&
 
 WebMediaStreamSource& WebMediaStreamSource::operator=(WebCore::MediaStreamSource* mediaStreamSource)
 {
-    m_private.reset();
-    if (mediaStreamSource) {
-        mediaStreamSource->ref();
-        m_private = mediaStreamSource;
-    }
+    m_private = mediaStreamSource;
     return *this;
 }