Index: trunk/Source/platform/mediastream/MediaStreamComponent.cpp |
=================================================================== |
--- trunk/Source/platform/mediastream/MediaStreamComponent.cpp (revision 181729) |
+++ trunk/Source/platform/mediastream/MediaStreamComponent.cpp (working copy) |
@@ -40,58 +40,25 @@ |
namespace blink { |
-MediaStreamComponent* MediaStreamComponent::create(MediaStreamSource* source) |
+PassRefPtr<MediaStreamComponent> MediaStreamComponent::create(PassRefPtr<MediaStreamSource> source) |
{ |
- return new MediaStreamComponent(createCanonicalUUIDString(), source); |
+ return adoptRef(new MediaStreamComponent(createCanonicalUUIDString(), source)); |
} |
-MediaStreamComponent* MediaStreamComponent::create(const String& id, MediaStreamSource* source) |
+PassRefPtr<MediaStreamComponent> MediaStreamComponent::create(const String& id, PassRefPtr<MediaStreamSource> source) |
{ |
- return new MediaStreamComponent(id, source); |
+ return adoptRef(new MediaStreamComponent(id, source)); |
} |
-// The disposer pattern actually makes the deletion of the extra data happen |
-// earlier and not later. The disposer makes sure that the extra data is |
-// destructed in weak processing which is run before sweeping and therefore |
-// all the objects are still alive and can be touched. |
-// |
-// FIXME: Oilpan: This disposer pattern is duplicated in a lot of places. |
-// We should create a good abstraction class for this and remove the code duplication. |
-class MediaStreamComponentDisposer { |
-public: |
- explicit MediaStreamComponentDisposer(MediaStreamComponent& component) : m_component(component) { } |
- ~MediaStreamComponentDisposer() |
- { |
- m_component.dispose(); |
- } |
- |
-private: |
- MediaStreamComponent& m_component; |
-}; |
- |
-typedef HeapHashMap<WeakMember<MediaStreamComponent>, OwnPtr<MediaStreamComponentDisposer> > ComponentDisposers; |
- |
-static ComponentDisposers& componentDisposers() |
-{ |
- DEFINE_STATIC_LOCAL(Persistent<ComponentDisposers>, disposers, (new ComponentDisposers)); |
- return *disposers; |
-} |
- |
-MediaStreamComponent::MediaStreamComponent(const String& id, MediaStreamSource* source) |
+MediaStreamComponent::MediaStreamComponent(const String& id, PassRefPtr<MediaStreamSource> source) |
: m_source(source) |
, m_id(id) |
, m_enabled(true) |
, m_muted(false) |
{ |
ASSERT(m_id.length()); |
- componentDisposers().add(this, adoptPtr(new MediaStreamComponentDisposer(*this))); |
} |
-void MediaStreamComponent::dispose() |
-{ |
- m_extraData = nullptr; |
-} |
- |
#if ENABLE(WEB_AUDIO) |
void MediaStreamComponent::AudioSourceProviderImpl::wrap(blink::WebAudioSourceProvider* provider) |
{ |
@@ -121,10 +88,5 @@ |
} |
#endif // #if ENABLE(WEB_AUDIO) |
-void MediaStreamComponent::trace(Visitor* visitor) |
-{ |
- visitor->trace(m_source); |
-} |
- |
} // namespace blink |