Purge all uses of PassRefPtr in WebCore/Modules
authorgyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 7 Aug 2016 05:52:23 +0000 (05:52 +0000)
committergyuyoung.kim@webkit.org <gyuyoung.kim@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 7 Aug 2016 05:52:23 +0000 (05:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159965

Reviewed by Chris Dumez.

Final clean up in Modules directory.

No new tests, no behavior changes.

* Modules/gamepad/deprecated/GamepadList.cpp:
(WebCore::GamepadList::set):
* Modules/gamepad/deprecated/GamepadList.h:
* Modules/indexeddb/IDBGetResult.h:
(WebCore::IDBGetResult::IDBGetResult):
* Modules/indieui/UIRequestEvent.cpp:
(WebCore::UIRequestEvent::create):
(WebCore::UIRequestEvent::UIRequestEvent):
* Modules/indieui/UIRequestEvent.h:
(WebCore::UIRequestEvent::receiver):
* Modules/mediasource/MediaSourceRegistry.h:
* Modules/mediasource/SampleMap.cpp:
(WebCore::SampleMap::addSample):
* Modules/mediasource/SampleMap.h:
(WebCore::SampleMap::addRange):
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
(WebCore::SourceBuffer::textTrackAddCue):
(WebCore::SourceBuffer::textTrackRemoveCue):
* Modules/mediasource/SourceBuffer.h:
* Modules/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::bestSourcesForTypeAndConstraints):
* Modules/mediastream/CaptureDeviceManager.h:
* Modules/mediastream/MediaDevicesRequest.h:
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::internalAddTrack):
(WebCore::MediaStream::internalRemoveTrack):
* Modules/mediastream/MediaStreamRegistry.h:
* Modules/mediastream/MediaStreamTrackEvent.cpp:
(WebCore::MediaStreamTrackEvent::create):
(WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent):
(WebCore::MediaStreamTrackEvent::track):
* Modules/mediastream/MediaStreamTrackEvent.h:
* Modules/mediastream/MediaTrackConstraints.cpp:
(WebCore::MediaTrackConstraints::create):
(WebCore::MediaTrackConstraints::MediaTrackConstraints):
(WebCore::MediaTrackConstraints::optional):
* Modules/mediastream/MediaTrackConstraints.h:
* Modules/mediastream/RTCDTMFSender.cpp:
(WebCore::RTCDTMFSender::create):
(WebCore::RTCDTMFSender::RTCDTMFSender):
* Modules/mediastream/RTCDTMFSender.h:
* Modules/mediastream/RTCDataChannelEvent.cpp:
(WebCore::RTCDataChannelEvent::create):
(WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
(WebCore::RTCDataChannelEvent::channel):
* Modules/mediastream/RTCDataChannelEvent.h:
* Modules/mediastream/RTCIceServer.h:
* Modules/mediastream/RTCStatsReport.h:
* Modules/mediastream/SourceInfo.cpp:
(WebCore::SourceInfo::create):
(WebCore::SourceInfo::SourceInfo):
* Modules/mediastream/SourceInfo.h:
* Modules/mediastream/UserMediaClient.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::UserMediaRequest):
(WebCore::UserMediaRequest::didCreateStream):
* Modules/mediastream/UserMediaRequest.h:
* Modules/webdatabase/Database.cpp:
(WebCore::Database::~Database):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::textTrackAddCue):
(WebCore::HTMLMediaElement::textTrackRemoveCue):
* html/HTMLMediaElement.h:
* html/HTMLTrackElement.cpp:
(WebCore::HTMLTrackElement::textTrackAddCue):
(WebCore::HTMLTrackElement::textTrackRemoveCue):
* html/HTMLTrackElement.h:
* html/track/TextTrack.h:
* platform/graphics/SourceBufferPrivateClient.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
* platform/mediastream/MediaStreamCreationClient.h:
* platform/mediastream/mac/AVCaptureDeviceManager.h:
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints):
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
(WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
* platform/mock/mediasource/MockSourceBufferPrivate.cpp:
(WebCore::MockSourceBufferPrivate::didReceiveSample):

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

45 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/gamepad/deprecated/GamepadList.cpp
Source/WebCore/Modules/gamepad/deprecated/GamepadList.h
Source/WebCore/Modules/indexeddb/IDBGetResult.h
Source/WebCore/Modules/indieui/UIRequestEvent.cpp
Source/WebCore/Modules/indieui/UIRequestEvent.h
Source/WebCore/Modules/mediasource/MediaSourceRegistry.h
Source/WebCore/Modules/mediasource/SampleMap.cpp
Source/WebCore/Modules/mediasource/SampleMap.h
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/Modules/mediasource/SourceBuffer.h
Source/WebCore/Modules/mediastream/CaptureDeviceManager.cpp
Source/WebCore/Modules/mediastream/CaptureDeviceManager.h
Source/WebCore/Modules/mediastream/MediaDevicesRequest.h
Source/WebCore/Modules/mediastream/MediaStreamRegistry.h
Source/WebCore/Modules/mediastream/MediaStreamTrackEvent.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrackEvent.h
Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp
Source/WebCore/Modules/mediastream/MediaTrackConstraints.h
Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp
Source/WebCore/Modules/mediastream/RTCDTMFSender.h
Source/WebCore/Modules/mediastream/RTCDataChannelEvent.cpp
Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h
Source/WebCore/Modules/mediastream/RTCIceServer.h
Source/WebCore/Modules/mediastream/RTCStatsReport.h
Source/WebCore/Modules/mediastream/SourceInfo.cpp
Source/WebCore/Modules/mediastream/SourceInfo.h
Source/WebCore/Modules/mediastream/UserMediaClient.h
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/Modules/mediastream/UserMediaRequest.h
Source/WebCore/Modules/webdatabase/Database.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLTrackElement.cpp
Source/WebCore/html/HTMLTrackElement.h
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h
Source/WebCore/platform/gamepad/efl/GamepadsEfl.cpp
Source/WebCore/platform/graphics/SourceBufferPrivateClient.h
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebCore/platform/mediastream/MediaStreamCreationClient.h
Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.h
Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp

index b6c6cd6..d554817 100644 (file)
@@ -1,3 +1,95 @@
+2016-08-06  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
+
+        Purge all uses of PassRefPtr in WebCore/Modules
+        https://bugs.webkit.org/show_bug.cgi?id=159965
+
+        Reviewed by Chris Dumez.
+
+        Final clean up in Modules directory.
+
+        No new tests, no behavior changes.
+
+        * Modules/gamepad/deprecated/GamepadList.cpp:
+        (WebCore::GamepadList::set):
+        * Modules/gamepad/deprecated/GamepadList.h:
+        * Modules/indexeddb/IDBGetResult.h:
+        (WebCore::IDBGetResult::IDBGetResult):
+        * Modules/indieui/UIRequestEvent.cpp:
+        (WebCore::UIRequestEvent::create):
+        (WebCore::UIRequestEvent::UIRequestEvent):
+        * Modules/indieui/UIRequestEvent.h:
+        (WebCore::UIRequestEvent::receiver):
+        * Modules/mediasource/MediaSourceRegistry.h:
+        * Modules/mediasource/SampleMap.cpp:
+        (WebCore::SampleMap::addSample):
+        * Modules/mediasource/SampleMap.h:
+        (WebCore::SampleMap::addRange):
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
+        (WebCore::SourceBuffer::textTrackAddCue):
+        (WebCore::SourceBuffer::textTrackRemoveCue):
+        * Modules/mediasource/SourceBuffer.h:
+        * Modules/mediastream/CaptureDeviceManager.cpp:
+        (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
+        * Modules/mediastream/CaptureDeviceManager.h:
+        * Modules/mediastream/MediaDevicesRequest.h:
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::internalAddTrack):
+        (WebCore::MediaStream::internalRemoveTrack):
+        * Modules/mediastream/MediaStreamRegistry.h:
+        * Modules/mediastream/MediaStreamTrackEvent.cpp:
+        (WebCore::MediaStreamTrackEvent::create):
+        (WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent):
+        (WebCore::MediaStreamTrackEvent::track):
+        * Modules/mediastream/MediaStreamTrackEvent.h:
+        * Modules/mediastream/MediaTrackConstraints.cpp:
+        (WebCore::MediaTrackConstraints::create):
+        (WebCore::MediaTrackConstraints::MediaTrackConstraints):
+        (WebCore::MediaTrackConstraints::optional):
+        * Modules/mediastream/MediaTrackConstraints.h:
+        * Modules/mediastream/RTCDTMFSender.cpp:
+        (WebCore::RTCDTMFSender::create):
+        (WebCore::RTCDTMFSender::RTCDTMFSender):
+        * Modules/mediastream/RTCDTMFSender.h:
+        * Modules/mediastream/RTCDataChannelEvent.cpp:
+        (WebCore::RTCDataChannelEvent::create):
+        (WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
+        (WebCore::RTCDataChannelEvent::channel):
+        * Modules/mediastream/RTCDataChannelEvent.h:
+        * Modules/mediastream/RTCIceServer.h:
+        * Modules/mediastream/RTCStatsReport.h:
+        * Modules/mediastream/SourceInfo.cpp:
+        (WebCore::SourceInfo::create):
+        (WebCore::SourceInfo::SourceInfo):
+        * Modules/mediastream/SourceInfo.h:
+        * Modules/mediastream/UserMediaClient.h:
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::UserMediaRequest):
+        (WebCore::UserMediaRequest::didCreateStream):
+        * Modules/mediastream/UserMediaRequest.h:
+        * Modules/webdatabase/Database.cpp:
+        (WebCore::Database::~Database):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::textTrackAddCue):
+        (WebCore::HTMLMediaElement::textTrackRemoveCue):
+        * html/HTMLMediaElement.h:
+        * html/HTMLTrackElement.cpp:
+        (WebCore::HTMLTrackElement::textTrackAddCue):
+        (WebCore::HTMLTrackElement::textTrackRemoveCue):
+        * html/HTMLTrackElement.h:
+        * html/track/TextTrack.h:
+        * platform/graphics/SourceBufferPrivateClient.h:
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
+        * platform/mediastream/MediaStreamCreationClient.h:
+        * platform/mediastream/mac/AVCaptureDeviceManager.h:
+        * platform/mediastream/mac/AVCaptureDeviceManager.mm:
+        (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints):
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
+        (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
+        * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
+        (WebCore::MockSourceBufferPrivate::didReceiveSample):
+
 2016-08-06  Chris Dumez  <cdumez@apple.com>
 
         a.replaceChild(a, a) should throw a HierarchyRequestError
index 7700351..22e0288 100644 (file)
@@ -36,11 +36,11 @@ GamepadList::~GamepadList()
 {
 }
 
-void GamepadList::set(unsigned index, PassRefPtr<Gamepad> gamepad)
+void GamepadList::set(unsigned index, RefPtr<Gamepad>&& gamepad)
 {
     if (index >= kMaximumGamepads)
         return;
-    m_items[index] = gamepad;
+    m_items[index] = WTFMove(gamepad);
 }
 
 unsigned GamepadList::length() const
index c40cbce..6df26b4 100644 (file)
@@ -29,7 +29,6 @@
 #if ENABLE(GAMEPAD_DEPRECATED)
 
 #include "Gamepad.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
@@ -42,7 +41,7 @@ public:
     static Ref<GamepadList> create() { return adoptRef(*new GamepadList); }
     ~GamepadList();
 
-    void set(unsigned index, PassRefPtr<Gamepad>);
+    void set(unsigned index, RefPtr<Gamepad>&&);
     Gamepad* item(unsigned index);
     unsigned length() const;
 
index b7debb6..28fc3fd 100644 (file)
@@ -59,8 +59,8 @@ public:
     {
     }
 
-    IDBGetResult(PassRefPtr<IDBKey> key)
-        : m_keyData(key.get())
+    IDBGetResult(IDBKey& key)
+        : m_keyData(&key)
     {
     }
 
@@ -69,8 +69,8 @@ public:
     {
     }
 
-    IDBGetResult(PassRefPtr<SharedBuffer> buffer, PassRefPtr<IDBKey> key, const IDBKeyPath& path)
-        : m_keyData(key.get())
+    IDBGetResult(SharedBuffer* buffer, IDBKey& key, const IDBKeyPath& path)
+        : m_keyData(&key)
         , m_keyPath(path)
     {
         if (buffer)
index b6bde20..61b29a4 100644 (file)
@@ -35,9 +35,9 @@ Ref<UIRequestEvent> UIRequestEvent::createForBindings(const AtomicString& type,
     return adoptRef(*new UIRequestEvent(type, initializer));
 }
 
-Ref<UIRequestEvent> UIRequestEvent::create(const AtomicString& type, bool bubbles, bool cancelable, AbstractView* view, int detail, PassRefPtr<EventTarget> receiver)
+Ref<UIRequestEvent> UIRequestEvent::create(const AtomicString& type, bool bubbles, bool cancelable, AbstractView* view, int detail, RefPtr<EventTarget>&& receiver)
 {
-    return adoptRef(*new UIRequestEvent(type, bubbles, cancelable, view, detail, receiver));
+    return adoptRef(*new UIRequestEvent(type, bubbles, cancelable, view, detail, WTFMove(receiver)));
 }
 
 UIRequestEvent::UIRequestEvent(const AtomicString& type, const UIRequestEventInit& initializer)
@@ -46,9 +46,9 @@ UIRequestEvent::UIRequestEvent(const AtomicString& type, const UIRequestEventIni
 {
 }
     
-UIRequestEvent::UIRequestEvent(const AtomicString& type, bool bubbles, bool cancelable, AbstractView* view, int detail, PassRefPtr<EventTarget> receiver)
+UIRequestEvent::UIRequestEvent(const AtomicString& type, bool bubbles, bool cancelable, AbstractView* view, int detail, RefPtr<EventTarget>&& receiver)
     : UIEvent(type, bubbles, cancelable, view, detail)
-    , m_receiver(receiver)
+    , m_receiver(WTFMove(receiver))
 {
 }
 
index f1514ca..9eeb6bd 100644 (file)
@@ -39,7 +39,7 @@ struct UIRequestEventInit : public UIEventInit {
 
 class UIRequestEvent : public UIEvent {
 public:
-    static Ref<UIRequestEvent> create(const AtomicString& type, bool bubbles, bool cancelable, AbstractView*, int detail, PassRefPtr<EventTarget> receiver);
+    static Ref<UIRequestEvent> create(const AtomicString& type, bool bubbles, bool cancelable, AbstractView*, int detail, RefPtr<EventTarget>&& receiver);
     static Ref<UIRequestEvent> createForBindings(const AtomicString& eventType, const UIRequestEventInit&);
     
     virtual ~UIRequestEvent();
@@ -47,7 +47,7 @@ public:
     EventTarget* receiver() const { return m_receiver.get(); }
 
 protected:
-    UIRequestEvent(const AtomicString& type, bool bubbles, bool cancelable, AbstractView*, int detail, PassRefPtr<EventTarget> receiver);
+    UIRequestEvent(const AtomicString& type, bool bubbles, bool cancelable, AbstractView*, int detail, RefPtr<EventTarget>&& receiver);
     
     UIRequestEvent(const AtomicString& type, const UIRequestEventInit&);
     
index 3826bcc..03003e7 100644 (file)
@@ -36,7 +36,6 @@
 #include "URLRegistry.h"
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
index 86d5533..32d10f7 100644 (file)
@@ -108,19 +108,16 @@ void SampleMap::clear()
     m_totalSize = 0;
 }
 
-void SampleMap::addSample(PassRefPtr<MediaSample> prpSample)
+void SampleMap::addSample(MediaSample& sample)
 {
-    RefPtr<MediaSample> sample = prpSample;
-    ASSERT(sample);
-
-    MediaTime presentationTime = sample->presentationTime();
+    MediaTime presentationTime = sample.presentationTime();
 
-    presentationOrder().m_samples.insert(PresentationOrderSampleMap::MapType::value_type(presentationTime, sample));
+    presentationOrder().m_samples.insert(PresentationOrderSampleMap::MapType::value_type(presentationTime, &sample));
 
-    auto decodeKey = DecodeOrderSampleMap::KeyType(sample->decodeTime(), presentationTime);
-    decodeOrder().m_samples.insert(DecodeOrderSampleMap::MapType::value_type(decodeKey, sample));
+    auto decodeKey = DecodeOrderSampleMap::KeyType(sample.decodeTime(), presentationTime);
+    decodeOrder().m_samples.insert(DecodeOrderSampleMap::MapType::value_type(decodeKey, &sample));
 
-    m_totalSize += sample->sizeInBytes();
+    m_totalSize += sample.sizeInBytes();
 }
 
 void SampleMap::removeSample(MediaSample* sample)
index 5809e11..973afa9 100644 (file)
@@ -99,7 +99,7 @@ public:
 
     bool empty() const;
     void clear();
-    void addSample(PassRefPtr<MediaSample>);
+    void addSample(MediaSample&);
     void removeSample(MediaSample*);
     size_t sizeInBytes() const { return m_totalSize; }
 
@@ -120,7 +120,7 @@ template<typename I>
 void SampleMap::addRange(I begin, I end)
 {
     for (I iter = begin; iter != end; ++iter)
-        addSample(iter->second);
+        addSample(*iter->second);
 }
 
 }
index ebe009d..a14d0a8 100644 (file)
@@ -1301,7 +1301,7 @@ void SourceBuffer::appendError(bool decodeErrorParam)
         m_source->streamEndedWithError(MediaSource::EndOfStreamError::Decode);
 }
 
-void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample> prpSample)
+void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, MediaSample& sample)
 {
     if (isRemoved())
         return;
@@ -1317,8 +1317,6 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
         return;
     }
 
-    RefPtr<MediaSample> sample = prpSample;
-
     // 3.5.8 Coded Frame Processing
     // http://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-processing
 
@@ -1341,16 +1339,16 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
             // ↳ Otherwise:
             // 1. Let presentation timestamp be a double precision floating point representation of
             // the coded frame's presentation timestamp in seconds.
-            presentationTimestamp = sample->presentationTime();
+            presentationTimestamp = sample.presentationTime();
 
             // 2. Let decode timestamp be a double precision floating point representation of the coded frame's
             // decode timestamp in seconds.
-            decodeTimestamp = sample->decodeTime();
+            decodeTimestamp = sample.decodeTime();
         }
 
         // 1.2 Let frame duration be a double precision floating point representation of the coded frame's
         // duration in seconds.
-        MediaTime frameDuration = sample->duration();
+        MediaTime frameDuration = sample.duration();
 
         // 1.3 If mode equals "sequence" and group start timestamp is set, then run the following steps:
         if (m_mode == AppendMode::Sequence && m_groupStartTimestamp.isValid()) {
@@ -1378,7 +1376,7 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
         }
 
         // 1.5 Let track buffer equal the track buffer that the coded frame will be added to.
-        AtomicString trackID = sample->trackID();
+        AtomicString trackID = sample.trackID();
         auto it = m_trackBufferMap.find(trackID);
         if (it == m_trackBufferMap.end())
             it = m_trackBufferMap.add(trackID, TrackBuffer()).iterator;
@@ -1420,10 +1418,10 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
 
         if (m_mode == AppendMode::Sequence) {
             // Use the generated timestamps instead of the sample's timestamps.
-            sample->setTimestamps(presentationTimestamp, decodeTimestamp);
+            sample.setTimestamps(presentationTimestamp, decodeTimestamp);
         } else if (m_timestampOffset) {
             // Reflect the timestamp offset into the sample.
-            sample->offsetTimestampsBy(m_timestampOffset);
+            sample.offsetTimestampsBy(m_timestampOffset);
         }
 
         // 1.7 Let frame end timestamp equal the sum of presentation timestamp and frame duration.
@@ -1457,7 +1455,7 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
         if (trackBuffer.needRandomAccessFlag) {
             // 1.11.1 If the coded frame is not a random access point, then drop the coded frame and jump
             // to the top of the loop to start processing the next coded frame.
-            if (!sample->isSync()) {
+            if (!sample.isSync()) {
                 didDropSample();
                 return;
             }
@@ -1500,7 +1498,7 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
                     // 1.14.2.3 If the presentation timestamp is less than the remove window timestamp,
                     // then remove overlapped frame and any coded frames that depend on it from track buffer.
                     if (presentationTimestamp < removeWindowTimestamp)
-                        erasedSamples.addSample(iter->second);
+                        erasedSamples.addSample(*iter->second);
                 }
 
                 // If track buffer contains timed text coded frames:
@@ -1589,7 +1587,7 @@ void SourceBuffer::sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, Pas
 
         if (trackBuffer.lastEnqueuedDecodeEndTime.isInvalid() || decodeTimestamp >= trackBuffer.lastEnqueuedDecodeEndTime) {
             DecodeOrderSampleMap::KeyType decodeKey(decodeTimestamp, presentationTimestamp);
-            trackBuffer.decodeQueue.insert(DecodeOrderSampleMap::MapType::value_type(decodeKey, sample));
+            trackBuffer.decodeQueue.insert(DecodeOrderSampleMap::MapType::value_type(decodeKey, &sample));
         }
 
         // 1.18 Set last decode timestamp for track buffer to decode timestamp.
@@ -1732,7 +1730,7 @@ void SourceBuffer::textTrackModeChanged(TextTrack* track)
         m_source->mediaElement()->textTrackModeChanged(track);
 }
 
-void SourceBuffer::textTrackAddCue(TextTrack* track, WTF::PassRefPtr<TextTrackCue> cue)
+void SourceBuffer::textTrackAddCue(TextTrack* track, TextTrackCue& cue)
 {
     if (!isRemoved())
         m_source->mediaElement()->textTrackAddCue(track, cue);
@@ -1744,7 +1742,7 @@ void SourceBuffer::textTrackAddCues(TextTrack* track, TextTrackCueList const* cu
         m_source->mediaElement()->textTrackAddCues(track, cueList);
 }
 
-void SourceBuffer::textTrackRemoveCue(TextTrack* track, WTF::PassRefPtr<TextTrackCue> cue)
+void SourceBuffer::textTrackRemoveCue(TextTrack* track, TextTrackCue& cue)
 {
     if (!isRemoved())
         m_source->mediaElement()->textTrackRemoveCue(track, cue);
index 810348a..6b5a38f 100644 (file)
@@ -44,7 +44,6 @@
 #include "Timer.h"
 #include "VideoTrack.h"
 #include <runtime/ArrayBufferView.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
@@ -143,7 +142,7 @@ private:
 
     // SourceBufferPrivateClient
     void sourceBufferPrivateDidReceiveInitializationSegment(SourceBufferPrivate*, const InitializationSegment&) override;
-    void sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample>) override;
+    void sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, MediaSample&) override;
     bool sourceBufferPrivateHasAudio(const SourceBufferPrivate*) const override;
     bool sourceBufferPrivateHasVideo(const SourceBufferPrivate*) const override;
     void sourceBufferPrivateDidBecomeReadyForMoreSamples(SourceBufferPrivate*, AtomicString trackID) override;
@@ -162,8 +161,8 @@ private:
     void textTrackModeChanged(TextTrack*) override;
     void textTrackAddCues(TextTrack*, const TextTrackCueList*) override;
     void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) override;
-    void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) override;
-    void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) override;
+    void textTrackAddCue(TextTrack*, TextTrackCue&) override;
+    void textTrackRemoveCue(TextTrack*, TextTrackCue&) override;
 
     bool isRemoved() const;
     void scheduleEvent(const AtomicString& eventName);
index bac95ca..53d85f6 100644 (file)
@@ -88,7 +88,7 @@ bool CaptureDeviceManager::verifyConstraintsForMediaType(RealtimeMediaSource::Ty
     return true;
 }
 
-Vector<RefPtr<RealtimeMediaSource>> CaptureDeviceManager::bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type type, PassRefPtr<MediaConstraints> constraints)
+Vector<RefPtr<RealtimeMediaSource>> CaptureDeviceManager::bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type type, MediaConstraints& constraints)
 {
     Vector<RefPtr<RealtimeMediaSource>> bestSourcesList;
 
@@ -103,7 +103,7 @@ Vector<RefPtr<RealtimeMediaSource>> CaptureDeviceManager::bestSourcesForTypeAndC
         if (!captureDevice.m_enabled || captureDevice.m_sourceId.isEmpty() || captureDevice.m_sourceType == RealtimeMediaSource::None)
             continue;
 
-        if (RefPtr<RealtimeMediaSource> captureSource = sourceWithUID(captureDevice.m_persistentDeviceID, type, constraints.get()))
+        if (RefPtr<RealtimeMediaSource> captureSource = sourceWithUID(captureDevice.m_persistentDeviceID, type, &constraints))
             bestSourcesList.append(captureSource.leakRef());
     }
     std::sort(bestSourcesList.begin(), bestSourcesList.end(), sortBasedOnFitnessScore);
index 6b02abb..166dbc8 100644 (file)
@@ -40,7 +40,7 @@ public:
     virtual Vector<CaptureDeviceInfo>& captureDeviceList() = 0;
     virtual void refreshCaptureDeviceList() { }
     virtual TrackSourceInfoVector getSourcesInfo(const String&);
-    virtual Vector<RefPtr<RealtimeMediaSource>> bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type, PassRefPtr<MediaConstraints>);
+    virtual Vector<RefPtr<RealtimeMediaSource>> bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type, MediaConstraints&);
     virtual RefPtr<RealtimeMediaSource> sourceWithUID(const String&, RealtimeMediaSource::Type, MediaConstraints*);
 
     virtual bool verifyConstraintsForMediaType(RealtimeMediaSource::Type, MediaConstraints*, const CaptureSessionInfo*, String&);
index 6cc9446..65b6adf 100644 (file)
@@ -34,7 +34,6 @@
 #include "MediaStreamCreationClient.h"
 #include "MediaStreamTrackSourcesRequestClient.h"
 #include "UserMediaPermissionCheck.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
index e6f95ba..bce23c5 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "URLRegistry.h"
 #include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
index 9a95cca..6ece61c 100644 (file)
@@ -32,9 +32,9 @@
 
 namespace WebCore {
 
-Ref<MediaStreamTrackEvent> MediaStreamTrackEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<MediaStreamTrack> track)
+Ref<MediaStreamTrackEvent> MediaStreamTrackEvent::create(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<MediaStreamTrack>&& track)
 {
-    return adoptRef(*new MediaStreamTrackEvent(type, canBubble, cancelable, track));
+    return adoptRef(*new MediaStreamTrackEvent(type, canBubble, cancelable, WTFMove(track)));
 }
 
 Ref<MediaStreamTrackEvent> MediaStreamTrackEvent::createForBindings(const AtomicString& type, const MediaStreamTrackEventInit& initializer)
@@ -42,9 +42,9 @@ Ref<MediaStreamTrackEvent> MediaStreamTrackEvent::createForBindings(const Atomic
     return adoptRef(*new MediaStreamTrackEvent(type, initializer));
 }
 
-MediaStreamTrackEvent::MediaStreamTrackEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<MediaStreamTrack> track)
+MediaStreamTrackEvent::MediaStreamTrackEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<MediaStreamTrack>&& track)
     : Event(type, canBubble, cancelable)
-    , m_track(track)
+    , m_track(WTFMove(track))
 {
 }
 
index dcccc39..5ce3a1f 100644 (file)
@@ -42,7 +42,7 @@ class MediaStreamTrackEvent : public Event {
 public:
     virtual ~MediaStreamTrackEvent();
 
-    static Ref<MediaStreamTrackEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<MediaStreamTrack>);
+    static Ref<MediaStreamTrackEvent> create(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<MediaStreamTrack>&&);
     static Ref<MediaStreamTrackEvent> createForBindings(const AtomicString& type, const MediaStreamTrackEventInit& initializer);
 
     MediaStreamTrack* track() const;
@@ -51,7 +51,7 @@ public:
     EventInterface eventInterface() const override;
 
 private:
-    MediaStreamTrackEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<MediaStreamTrack>);
+    MediaStreamTrackEvent(const AtomicString& type, bool canBubble, bool cancelable, RefPtr<MediaStreamTrack>&&);
     MediaStreamTrackEvent(const AtomicString& type, const MediaStreamTrackEventInit&);
 
     RefPtr<MediaStreamTrack> m_track;
index a053a60..9aeb8fb 100644 (file)
@@ -38,21 +38,21 @@ using namespace JSC;
 
 namespace WebCore {
 
-Ref<MediaTrackConstraints> MediaTrackConstraints::create(PassRefPtr<MediaConstraintsImpl> constraints)
+Ref<MediaTrackConstraints> MediaTrackConstraints::create(MediaConstraintsImpl& constraints)
 {
     return adoptRef(*new MediaTrackConstraints(constraints));
 }
 
-MediaTrackConstraints::MediaTrackConstraints(PassRefPtr<MediaConstraintsImpl> constraints)
+MediaTrackConstraints::MediaTrackConstraints(MediaConstraintsImpl& constraints)
     : m_constraints(constraints)
 {
 }
 
-Vector<PassRefPtr<MediaTrackConstraint>> MediaTrackConstraints::optional() const
+Vector<RefPtr<MediaTrackConstraint>> MediaTrackConstraints::optional() const
 {
     // https://bugs.webkit.org/show_bug.cgi?id=121954
     notImplemented();
-    return Vector<PassRefPtr<MediaTrackConstraint>>();
+    return { };
 }
 
 MediaTrackConstraintSet* MediaTrackConstraints::mandatory() const
index 1bc4ea0..c96fda8 100644 (file)
@@ -42,15 +42,15 @@ class MediaTrackConstraints : public RefCounted<MediaTrackConstraints>, public S
 public:
     virtual ~MediaTrackConstraints() { }
 
-    static Ref<MediaTrackConstraints> create(PassRefPtr<MediaConstraintsImpl>);
+    static Ref<MediaTrackConstraints> create(MediaConstraintsImpl&);
 
-    Vector<PassRefPtr<MediaTrackConstraint>> optional() const;
+    Vector<RefPtr<MediaTrackConstraint>> optional() const;
     MediaTrackConstraintSet* mandatory() const;
 
 private:
-    explicit MediaTrackConstraints(PassRefPtr<MediaConstraintsImpl>);
+    explicit MediaTrackConstraints(MediaConstraintsImpl&);
     
-    RefPtr<MediaConstraintsImpl> m_constraints;
+    Ref<MediaConstraintsImpl> m_constraints;
 };
 
 } // namespace WebCore
index f9ff0db..d28a562 100644 (file)
@@ -44,23 +44,22 @@ static const long maxToneDurationMs = 6000;
 static const long minInterToneGapMs = 30;
 static const long defaultInterToneGapMs = 70;
 
-RefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context, RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCode& ec)
+RefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context, RTCPeerConnectionHandler* peerConnectionHandler, RefPtr<MediaStreamTrack>&& track, ExceptionCode& ec)
 {
-    RefPtr<MediaStreamTrack> track = prpTrack;
     std::unique_ptr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSender(&track->source());
     if (!handler) {
         ec = NOT_SUPPORTED_ERR;
         return nullptr;
     }
 
-    RefPtr<RTCDTMFSender> dtmfSender = adoptRef(new RTCDTMFSender(context, track, WTFMove(handler)));
+    RefPtr<RTCDTMFSender> dtmfSender = adoptRef(new RTCDTMFSender(context, WTFMove(track), WTFMove(handler)));
     dtmfSender->suspendIfNeeded();
     return dtmfSender;
 }
 
-RTCDTMFSender::RTCDTMFSender(ScriptExecutionContext* context, PassRefPtr<MediaStreamTrack> track, std::unique_ptr<RTCDTMFSenderHandler> handler)
+RTCDTMFSender::RTCDTMFSender(ScriptExecutionContext* context, RefPtr<MediaStreamTrack>&& track, std::unique_ptr<RTCDTMFSenderHandler> handler)
     : ActiveDOMObject(context)
-    , m_track(track)
+    , m_track(WTFMove(track))
     , m_duration(defaultToneDurationMs)
     , m_interToneGap(defaultInterToneGapMs)
     , m_handler(WTFMove(handler))
index a7535ff..75b19ee 100644 (file)
@@ -43,7 +43,7 @@ class RTCDTMFSenderHandler;
 
 class RTCDTMFSender final : public RefCounted<RTCDTMFSender>, public EventTargetWithInlineData, public RTCDTMFSenderHandlerClient, public ActiveDOMObject {
 public:
-    static RefPtr<RTCDTMFSender> create(ScriptExecutionContext*, RTCPeerConnectionHandler*, PassRefPtr<MediaStreamTrack>, ExceptionCode&);
+    static RefPtr<RTCDTMFSender> create(ScriptExecutionContext*, RTCPeerConnectionHandler*, RefPtr<MediaStreamTrack>&&, ExceptionCode&);
     ~RTCDTMFSender();
 
     bool canInsertDTMF() const;
@@ -62,7 +62,7 @@ public:
     using RefCounted<RTCDTMFSender>::deref;
 
 private:
-    RTCDTMFSender(ScriptExecutionContext*, PassRefPtr<MediaStreamTrack>, std::unique_ptr<RTCDTMFSenderHandler>);
+    RTCDTMFSender(ScriptExecutionContext*, RefPtr<MediaStreamTrack>&&, std::unique_ptr<RTCDTMFSenderHandler>);
 
     // ActiveDOMObject
     void stop() override;
index ee25b38..5899594 100644 (file)
 
 namespace WebCore {
 
-Ref<RTCDataChannelEvent> RTCDataChannelEvent::create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<RTCDataChannel> channel)
+Ref<RTCDataChannelEvent> RTCDataChannelEvent::create(const AtomicString& type, bool canBubble, bool cancelable, RTCDataChannel& channel)
 {
     return adoptRef(*new RTCDataChannelEvent(type, canBubble, cancelable, channel));
 }
 
-RTCDataChannelEvent::RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<RTCDataChannel> channel)
+RTCDataChannelEvent::RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, RTCDataChannel& channel)
     : Event(type, canBubble, cancelable)
     , m_channel(channel)
 {
@@ -47,9 +47,9 @@ RTCDataChannelEvent::~RTCDataChannelEvent()
 {
 }
 
-RTCDataChannel* RTCDataChannelEvent::channel() const
+RTCDataChannel* RTCDataChannelEvent::channel()
 {
-    return m_channel.get();
+    return m_channel.ptr();
 }
 
 EventInterface RTCDataChannelEvent::eventInterface() const
index 7561f98..8bcdc54 100644 (file)
@@ -37,16 +37,16 @@ class RTCDataChannelEvent : public Event {
 public:
     virtual ~RTCDataChannelEvent();
 
-    static Ref<RTCDataChannelEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<RTCDataChannel>);
+    static Ref<RTCDataChannelEvent> create(const AtomicString& type, bool canBubble, bool cancelable, RTCDataChannel&);
 
-    RTCDataChannel* channel() const;
+    RTCDataChannel* channel();
 
     virtual EventInterface eventInterface() const;
 
 private:
-    RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<RTCDataChannel>);
+    RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, RTCDataChannel&);
 
-    RefPtr<RTCDataChannel> m_channel;
+    Ref<RTCDataChannel> m_channel;
 };
 
 } // namespace WebCore
index 1a397ed..41a64ea 100644 (file)
@@ -28,7 +28,6 @@
 
 #if ENABLE(WEB_RTC)
 
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
index 686aff9..0ad047d 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "ScriptWrappable.h"
 #include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
index 4bb4ef8..b5cb613 100644 (file)
 
 namespace WebCore {
 
-Ref<SourceInfo> SourceInfo::create(PassRefPtr<TrackSourceInfo> trackSourceInfo)
+Ref<SourceInfo> SourceInfo::create(Ref<TrackSourceInfo>&& trackSourceInfo)
 {
-    return adoptRef(*new SourceInfo(trackSourceInfo));
+    return adoptRef(*new SourceInfo(WTFMove(trackSourceInfo)));
 }
 
-SourceInfo::SourceInfo(PassRefPtr<TrackSourceInfo> trackSourceInfo)
-    : m_trackSourceInfo(trackSourceInfo)
+SourceInfo::SourceInfo(Ref<TrackSourceInfo>&& trackSourceInfo)
+    : m_trackSourceInfo(WTFMove(trackSourceInfo))
 {
 }
 
index e5abe0c..6f84d62 100644 (file)
@@ -40,16 +40,16 @@ namespace WebCore {
 
 class SourceInfo : public RefCounted<SourceInfo>, public ScriptWrappable {
 public:
-    static Ref<SourceInfo> create(PassRefPtr<TrackSourceInfo>);
+    static Ref<SourceInfo> create(Ref<TrackSourceInfo>&&);
 
     const AtomicString& sourceId() const { return m_trackSourceInfo->id(); }
     const AtomicString& label() const { return m_trackSourceInfo->label(); }
     const AtomicString& kind() const;
 
 private:
-    SourceInfo(PassRefPtr<TrackSourceInfo>);
+    SourceInfo(Ref<TrackSourceInfo>&&);
 
-    RefPtr<TrackSourceInfo> m_trackSourceInfo;
+    Ref<TrackSourceInfo> m_trackSourceInfo;
 };
 
 } // namespace WebCore
index d2f0457..7fed17e 100644 (file)
@@ -33,8 +33,6 @@
 
 #if ENABLE(MEDIA_STREAM)
 
-#include <wtf/PassRefPtr.h>
-
 namespace WebCore {
 
 class Page;
index 78ba239..f791830 100644 (file)
@@ -92,10 +92,10 @@ void UserMediaRequest::start(Document* document, const Dictionary& options, Medi
     request->start();
 }
 
-UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints, MediaDevices::Promise&& promise)
+UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, RefPtr<MediaConstraints>&& audioConstraints, RefPtr<MediaConstraints>&& videoConstraints, MediaDevices::Promise&& promise)
     : ContextDestructionObserver(context)
-    , m_audioConstraints(audioConstraints)
-    , m_videoConstraints(videoConstraints)
+    , m_audioConstraints(WTFMove(audioConstraints))
+    , m_videoConstraints(WTFMove(videoConstraints))
     , m_controller(controller)
     , m_promise(WTFMove(promise))
 {
@@ -163,13 +163,13 @@ void UserMediaRequest::constraintsInvalid(const String& constraintName)
     failedToCreateStreamWithConstraintsError(constraintName);
 }
 
-void UserMediaRequest::didCreateStream(PassRefPtr<MediaStreamPrivate> privateStream)
+void UserMediaRequest::didCreateStream(RefPtr<MediaStreamPrivate>&& privateStream)
 {
     if (!m_scriptExecutionContext)
         return;
 
     // 4 - Create the MediaStream and pass it to the success callback.
-    Ref<MediaStream> stream = MediaStream::create(*m_scriptExecutionContext, privateStream);
+    Ref<MediaStream> stream = MediaStream::create(*m_scriptExecutionContext, WTFMove(privateStream));
     if (m_audioConstraints) {
         for (auto& track : stream->getAudioTracks()) {
             track->applyConstraints(*m_audioConstraints);
index cbafa4e..36ce6d4 100644 (file)
@@ -38,7 +38,6 @@
 #include "ActiveDOMObject.h"
 #include "MediaDevices.h"
 #include "MediaStreamCreationClient.h"
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
@@ -74,12 +73,12 @@ public:
     const String& allowedVideoDeviceUID() const { return m_allowedVideoDeviceUID; }
 
 private:
-    UserMediaRequest(ScriptExecutionContext*, UserMediaController*, PassRefPtr<MediaConstraints> audioConstraints, PassRefPtr<MediaConstraints> videoConstraints, MediaDevices::Promise&&);
+    UserMediaRequest(ScriptExecutionContext*, UserMediaController*, RefPtr<MediaConstraints>&& audioConstraints, RefPtr<MediaConstraints>&& videoConstraints, MediaDevices::Promise&&);
 
     // MediaStreamCreationClient
     void constraintsValidated(const Vector<RefPtr<RealtimeMediaSource>>& audioTracks, const Vector<RefPtr<RealtimeMediaSource>>& videoTracks) final;
     void constraintsInvalid(const String& constraintName) final;
-    void didCreateStream(PassRefPtr<MediaStreamPrivate>) final;
+    void didCreateStream(RefPtr<MediaStreamPrivate>&&) final;
     void failedToCreateStreamWithConstraintsError(const String& constraintName) final;
     void failedToCreateStreamWithPermissionError() final;
 
index 1031b47..1316f1d 100644 (file)
@@ -54,7 +54,6 @@
 #include "SecurityOrigin.h"
 #include "VoidCallback.h"
 #include <wtf/NeverDestroyed.h>
-#include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
@@ -246,7 +245,7 @@ Database::~Database()
     if (!m_scriptExecutionContext->isContextThread()) {
         // Grab a pointer to the script execution here because we're releasing it when we pass it to
         // DerefContextTask::create.
-        PassRefPtr<ScriptExecutionContext> passedContext = m_scriptExecutionContext.release();
+        RefPtr<ScriptExecutionContext> passedContext = WTFMove(m_scriptExecutionContext);
         passedContext->postTask({ScriptExecutionContext::Task::CleanupTask, [passedContext] (ScriptExecutionContext& context) {
             ASSERT_UNUSED(context, &context == passedContext);
             RefPtr<ScriptExecutionContext> scriptExecutionContext(passedContext);
index 2b0d422..db6d4ee 100644 (file)
@@ -1837,61 +1837,58 @@ void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList
 
     TrackDisplayUpdateScope scope(this);
     for (size_t i = 0; i < cues->length(); ++i)
-        textTrackAddCue(track, cues->item(i));
+        textTrackAddCue(track, *cues->item(i));
 }
 
 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* cues)
 {
     TrackDisplayUpdateScope scope(this);
     for (size_t i = 0; i < cues->length(); ++i)
-        textTrackRemoveCue(cues->item(i)->track(), cues->item(i));
+        textTrackRemoveCue(cues->item(i)->track(), *cues->item(i));
 }
 
-void HTMLMediaElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> prpCue)
+void HTMLMediaElement::textTrackAddCue(TextTrack* track, TextTrackCue& cue)
 {
     if (track->mode() == TextTrack::Mode::Disabled)
         return;
 
-    RefPtr<TextTrackCue> cue = prpCue;
-
     // Negative duration cues need be treated in the interval tree as
     // zero-length cues.
-    MediaTime endTime = std::max(cue->startMediaTime(), cue->endMediaTime());
+    MediaTime endTime = std::max(cue.startMediaTime(), cue.endMediaTime());
 
-    CueInterval interval = m_cueTree.createInterval(cue->startMediaTime(), endTime, cue.get());
+    CueInterval interval = m_cueTree.createInterval(cue.startMediaTime(), endTime, &cue);
     if (!m_cueTree.contains(interval))
         m_cueTree.add(interval);
     updateActiveTextTrackCues(currentMediaTime());
 }
 
-void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> prpCue)
+void HTMLMediaElement::textTrackRemoveCue(TextTrack*, TextTrackCue& cue)
 {
-    RefPtr<TextTrackCue> cue = prpCue;
     // Negative duration cues need to be treated in the interval tree as
     // zero-length cues.
-    MediaTime endTime = std::max(cue->startMediaTime(), cue->endMediaTime());
+    MediaTime endTime = std::max(cue.startMediaTime(), cue.endMediaTime());
 
-    CueInterval interval = m_cueTree.createInterval(cue->startMediaTime(), endTime, cue.get());
+    CueInterval interval = m_cueTree.createInterval(cue.startMediaTime(), endTime, &cue);
     m_cueTree.remove(interval);
 
     // Since the cue will be removed from the media element and likely the
     // TextTrack might also be destructed, notifying the region of the cue
     // removal shouldn't be done.
-    if (cue->isRenderable())
-        toVTTCue(cue.get())->notifyRegionWhenRemovingDisplayTree(false);
+    if (cue.isRenderable())
+        toVTTCue(&cue)->notifyRegionWhenRemovingDisplayTree(false);
 
     size_t index = m_currentlyActiveCues.find(interval);
     if (index != notFound) {
-        cue->setIsActive(false);
+        cue.setIsActive(false);
         m_currentlyActiveCues.remove(index);
     }
 
-    if (cue->isRenderable())
-        toVTTCue(cue.get())->removeDisplayTree();
+    if (cue.isRenderable())
+        toVTTCue(&cue)->removeDisplayTree();
     updateActiveTextTrackCues(currentMediaTime());
 
-    if (cue->isRenderable())
-        toVTTCue(cue.get())->notifyRegionWhenRemovingDisplayTree(true);
+    if (cue.isRenderable())
+        toVTTCue(&cue)->notifyRegionWhenRemovingDisplayTree(true);
 }
 
 #endif
index 9e36689..9a22117 100644 (file)
@@ -333,8 +333,8 @@ public:
     void textTrackModeChanged(TextTrack*) override;
     void textTrackAddCues(TextTrack*, const TextTrackCueList*) override;
     void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) override;
-    void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) override;
-    void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) override;
+    void textTrackAddCue(TextTrack*, TextTrackCue&) override;
+    void textTrackRemoveCue(TextTrack*, TextTrackCue&) override;
 
     // VideoTrackClient
     void videoTrackSelectedChanged(VideoTrack*) override;
index cd288d4..3c63166 100644 (file)
@@ -306,13 +306,13 @@ void HTMLTrackElement::textTrackRemoveCues(TextTrack* track, const TextTrackCueL
         return parent->textTrackRemoveCues(track, cues);
 }
     
-void HTMLTrackElement::textTrackAddCue(TextTrack* track, PassRefPtr<TextTrackCue> cue)
+void HTMLTrackElement::textTrackAddCue(TextTrack* track, TextTrackCue& cue)
 {
     if (HTMLMediaElement* parent = mediaElement())
         return parent->textTrackAddCue(track, cue);
 }
     
-void HTMLTrackElement::textTrackRemoveCue(TextTrack* track, PassRefPtr<TextTrackCue> cue)
+void HTMLTrackElement::textTrackRemoveCue(TextTrack* track, TextTrackCue& cue)
 {
     if (HTMLMediaElement* parent = mediaElement())
         return parent->textTrackRemoveCue(track, cue);
index d316d84..8bb5736 100644 (file)
@@ -78,8 +78,8 @@ private:
     void textTrackKindChanged(TextTrack*) final;
     void textTrackAddCues(TextTrack*, const TextTrackCueList*) final;
     void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) final;
-    void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) final;
-    void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) final;
+    void textTrackAddCue(TextTrack*, TextTrackCue&) final;
+    void textTrackRemoveCue(TextTrack*, TextTrackCue&) final;
 
     LoadableTextTrack& ensureTrack();
     bool canLoadURL(const URL&);
index 1bfd42b..164dda2 100644 (file)
@@ -326,7 +326,7 @@ void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue, ExceptionCode& ec)
     ensureTextTrackCueList().add(cue);
     
     if (m_client)
-        m_client->textTrackAddCue(this, cue.get());
+        m_client->textTrackAddCue(this, *cue);
 }
 
 void TextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)
@@ -353,7 +353,7 @@ void TextTrack::removeCue(TextTrackCue* cue, ExceptionCode& ec)
 
     cue->setTrack(0);
     if (m_client)
-        m_client->textTrackRemoveCue(this, cue);
+        m_client->textTrackRemoveCue(this, *cue);
 }
 
 VTTRegionList& TextTrack::ensureVTTRegionList()
@@ -434,7 +434,7 @@ void TextTrack::cueWillChange(TextTrackCue* cue)
 
     // The cue may need to be repositioned in the media element's interval tree, may need to
     // be re-rendered, etc, so remove it before the modification...
-    m_client->textTrackRemoveCue(this, cue);
+    m_client->textTrackRemoveCue(this, *cue);
 }
 
 void TextTrack::cueDidChange(TextTrackCue* cue)
@@ -446,7 +446,7 @@ void TextTrack::cueDidChange(TextTrackCue* cue)
     ensureTextTrackCueList().updateCueIndex(cue);
 
     // ... and add it back again.
-    m_client->textTrackAddCue(this, cue);
+    m_client->textTrackAddCue(this, *cue);
 }
 
 int TextTrack::trackIndex()
index 4ede229..f1e216b 100644 (file)
@@ -49,8 +49,8 @@ public:
     virtual void textTrackModeChanged(TextTrack*) = 0;
     virtual void textTrackAddCues(TextTrack*, const TextTrackCueList*) = 0;
     virtual void textTrackRemoveCues(TextTrack*, const TextTrackCueList*) = 0;
-    virtual void textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0;
-    virtual void textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue>) = 0;
+    virtual void textTrackAddCue(TextTrack*, TextTrackCue&) = 0;
+    virtual void textTrackRemoveCue(TextTrack*, TextTrackCue&) = 0;
 };
 
 class TextTrack : public TrackBase, public EventTargetWithInlineData {
index b6f9ea5..b0974ad 100644 (file)
@@ -224,7 +224,7 @@ void GamepadsEfl::updateGamepadList(GamepadList* into)
             gamepad->axes(gamepadDevice->axesCount(), gamepadDevice->axesData());
             gamepad->buttons(gamepadDevice->buttonsCount(), gamepadDevice->buttonsData());
 
-            into->set(i, gamepad);
+            into->set(i, WTFMove(gamepad));
         } else
             into->set(i, 0);
     }
index 33e6cc1..e1a7751 100644 (file)
@@ -66,7 +66,7 @@ public:
         Vector<TextTrackInformation> textTracks;
     };
     virtual void sourceBufferPrivateDidReceiveInitializationSegment(SourceBufferPrivate*, const InitializationSegment&) = 0;
-    virtual void sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, PassRefPtr<MediaSample>) = 0;
+    virtual void sourceBufferPrivateDidReceiveSample(SourceBufferPrivate*, MediaSample&) = 0;
     virtual bool sourceBufferPrivateHasAudio(const SourceBufferPrivate*) const = 0;
     virtual bool sourceBufferPrivateHasVideo(const SourceBufferPrivate*) const = 0;
 
index 28638df..eb5a79a 100644 (file)
@@ -568,9 +568,9 @@ bool SourceBufferPrivateAVFObjC::processCodedFrame(int trackID, CMSampleBufferRe
 
 
     if (m_client) {
-        RefPtr<MediaSample> mediaSample = MediaSampleAVFObjC::create(sampleBuffer, trackID);
-        LOG(MediaSourceSamples, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - sample(%s)", this, toString(*mediaSample).utf8().data());
-        m_client->sourceBufferPrivateDidReceiveSample(this, WTFMove(mediaSample));
+        Ref<MediaSample> mediaSample = MediaSampleAVFObjC::create(sampleBuffer, trackID);
+        LOG(MediaSourceSamples, "SourceBufferPrivateAVFObjC::processCodedFrame(%p) - sample(%s)", this, toString(mediaSample.get()).utf8().data());
+        m_client->sourceBufferPrivateDidReceiveSample(this, mediaSample);
     }
 
     return true;
index aa09ad0..1b0a83d 100644 (file)
@@ -42,7 +42,7 @@ public:
     virtual void constraintsValidated(const Vector<RefPtr<RealtimeMediaSource>>& audioTracks, const Vector<RefPtr<RealtimeMediaSource>>& videoTracks) = 0;
     virtual void constraintsInvalid(const String& constraintName) = 0;
 
-    virtual void didCreateStream(PassRefPtr<MediaStreamPrivate>) = 0;
+    virtual void didCreateStream(RefPtr<MediaStreamPrivate>&&) = 0;
     virtual void failedToCreateStreamWithConstraintsError(const String& constraintName) = 0;
     virtual void failedToCreateStreamWithPermissionError() = 0;
 };
index e795f05..b36242b 100644 (file)
@@ -61,7 +61,7 @@ public:
     static AVCaptureDeviceManager& singleton();
 
     RefPtr<RealtimeMediaSource> sourceWithUID(const String&, RealtimeMediaSource::Type, MediaConstraints*) override;
-    Vector<RefPtr<RealtimeMediaSource>> bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type, PassRefPtr<MediaConstraints>) override;
+    Vector<RefPtr<RealtimeMediaSource>> bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type, MediaConstraints&) override;
 
     TrackSourceInfoVector getSourcesInfo(const String&) override;
     bool verifyConstraintsForMediaType(RealtimeMediaSource::Type, MediaConstraints*, const CaptureSessionInfo*, String&) override;
index 07ccd92..2bee51b 100644 (file)
@@ -224,7 +224,7 @@ AVCaptureDeviceManager::~AVCaptureDeviceManager()
     [m_objcObserver disconnect];
 }
 
-Vector<RefPtr<RealtimeMediaSource>> AVCaptureDeviceManager::bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type type, PassRefPtr<MediaConstraints> constraints)
+Vector<RefPtr<RealtimeMediaSource>> AVCaptureDeviceManager::bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type type, MediaConstraints& constraints)
 {
     if (!isAvailable())
         return Vector<RefPtr<RealtimeMediaSource>>();
index 9a1b2d6..cbf6aea 100644 (file)
@@ -82,7 +82,7 @@ void RealtimeMediaSourceCenterMac::validateRequestConstraints(MediaStreamCreatio
             return;
         }
 
-        audioSources = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type::Audio, audioConstraints);
+        audioSources = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type::Audio, *audioConstraints);
     }
 
     if (videoConstraints) {
@@ -93,7 +93,7 @@ void RealtimeMediaSourceCenterMac::validateRequestConstraints(MediaStreamCreatio
             return;
         }
 
-        videoSources = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type::Video, videoConstraints);
+        videoSources = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Type::Video, *videoConstraints);
     }
     client->constraintsValidated(audioSources, videoSources);
 }
@@ -116,7 +116,7 @@ void RealtimeMediaSourceCenterMac::createMediaStream(PassRefPtr<MediaStreamCreat
         }
         // FIXME: Consider the constraints when choosing among multiple devices. For now just select the first available
         // device of the appropriate type.
-        auto audioSource = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Audio, audioConstraints.get()).at(0);
+        auto audioSource = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Audio, *audioConstraints).at(0);
         ASSERT(audioSource);
         
         audioSources.append(WTFMove(audioSource));
@@ -131,7 +131,7 @@ void RealtimeMediaSourceCenterMac::createMediaStream(PassRefPtr<MediaStreamCreat
         }
         // FIXME: Consider the constraints when choosing among multiple devices. For now just select the first available
         // device of the appropriate type.
-        auto videoSource = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Video, videoConstraints.get()).at(0);
+        auto videoSource = AVCaptureDeviceManager::singleton().bestSourcesForTypeAndConstraints(RealtimeMediaSource::Video, *videoConstraints).at(0);
         ASSERT(videoSource);
         
         videoSources.append(WTFMove(videoSource));
index 4a27f2e..3eebbd0 100644 (file)
@@ -20,7 +20,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -44,7 +44,7 @@ namespace WebCore {
 
 class MockMediaSample final : public MediaSample {
 public:
-    static RefPtr<MockMediaSample> create(const MockSampleBox& box) { return adoptRef(new MockMediaSample(box)); }
+    static Ref<MockMediaSample> create(const MockSampleBox& box) { return adoptRef(*new MockMediaSample(box)); }
     virtual ~MockMediaSample() { }
 
 private: