Title: [153714] branches/safari-537-branch/Source/WebCore

Diff

Modified: branches/safari-537-branch/Source/WebCore/ChangeLog (153713 => 153714)


--- branches/safari-537-branch/Source/WebCore/ChangeLog	2013-08-05 17:49:42 UTC (rev 153713)
+++ branches/safari-537-branch/Source/WebCore/ChangeLog	2013-08-05 18:04:45 UTC (rev 153714)
@@ -1,5 +1,34 @@
 2013-08-05  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r153706
+
+    2013-08-03  Jer Noble  <jer.no...@apple.com>
+
+            Loading a video with a custom URL scheme will result in stalling playback
+            https://bugs.webkit.org/show_bug.cgi?id=119469
+
+            Reviewed by Eric Carlson.
+
+            Break the assumption that only one AVAssetResourceRequest will be outstanding simultaneously
+            by storing a HashMap of AVAssetResourceRequests and their resulting WebCoreAVFResourceLoader.
+            When loading is stopped (due to completion or error), notify the MediaPlayerPrivateAVFoundation
+            parent so that the map can be emptied.
+
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): Store the request
+                in m_resourceLoaderMap.
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest): Pull the request from
+                m_resourceLoaderMap.
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest): Remove the requset from
+                m_resourceLoaderMap.
+            * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
+            * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
+            (WebCore::WebCoreAVFResourceLoader::create): Return a PassRefPtr, rather than a PassOwnPtr.
+            (WebCore::WebCoreAVFResourceLoader::stopLoading): Call didStopLoadingRequest.
+
+2013-08-05  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r153699
 
     2013-08-04  Andreas Kling  <akl...@apple.com>

Modified: branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (153713 => 153714)


--- branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2013-08-05 17:49:42 UTC (rev 153713)
+++ branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2013-08-05 18:04:45 UTC (rev 153714)
@@ -32,6 +32,7 @@
 #include <wtf/HashMap.h>
 
 OBJC_CLASS AVAssetImageGenerator;
+OBJC_CLASS AVAssetResourceLoadingRequest;
 OBJC_CLASS AVMediaSelectionGroup;
 OBJC_CLASS AVPlayer;
 OBJC_CLASS AVPlayerItem;
@@ -77,6 +78,7 @@
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     bool shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest*);
     void didCancelLoadingRequest(AVAssetResourceLoadingRequest*);
+    void didStopLoadingRequest(AVAssetResourceLoadingRequest *);
 #endif
 
 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
@@ -203,7 +205,7 @@
     RetainPtr<VTPixelTransferSessionRef> m_pixelTransferSession;
 
     friend class WebCoreAVFResourceLoader;
-    OwnPtr<WebCoreAVFResourceLoader> m_resourceLoader;
+    HashMap<RetainPtr<AVAssetResourceLoadingRequest>, RefPtr<WebCoreAVFResourceLoader> > m_resourceLoaderMap;
     RetainPtr<WebCoreAVFLoaderDelegate> m_loaderDelegate;
     HashMap<String, RetainPtr<AVAssetResourceLoadingRequest> > m_keyURIToRequestMap;
     HashMap<String, RetainPtr<AVAssetResourceLoadingRequest> > m_sessionIDToRequestMap;

Modified: branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (153713 => 153714)


--- branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2013-08-05 17:49:42 UTC (rev 153713)
+++ branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2013-08-05 18:04:45 UTC (rev 153714)
@@ -942,8 +942,9 @@
     }
 #endif
 
-    m_resourceLoader = WebCoreAVFResourceLoader::create(this, avRequest);
-    m_resourceLoader->startLoading();
+    RefPtr<WebCoreAVFResourceLoader> resourceLoader = WebCoreAVFResourceLoader::create(this, avRequest);
+    m_resourceLoaderMap.add(avRequest, resourceLoader);
+    resourceLoader->startLoading();
     return true;
 }
 
@@ -951,9 +952,16 @@
 {
     String scheme = [[[avRequest request] URL] scheme];
 
-    if (m_resourceLoader)
-        m_resourceLoader->stopLoading();
+    WebCoreAVFResourceLoader* resourceLoader = m_resourceLoaderMap.get(avRequest);
+
+    if (resourceLoader)
+        resourceLoader->stopLoading();
 }
+
+void MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest(AVAssetResourceLoadingRequest *avRequest)
+{
+    m_resourceLoaderMap.remove(avRequest);
+}
 #endif
 
 bool MediaPlayerPrivateAVFoundationObjC::isAvailable()

Modified: branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h (153713 => 153714)


--- branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h	2013-08-05 17:49:42 UTC (rev 153713)
+++ branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h	2013-08-05 18:04:45 UTC (rev 153714)
@@ -31,7 +31,8 @@
 #include "CachedRawResourceClient.h"
 #include "CachedResourceHandle.h"
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
 #include <wtf/RetainPtr.h>
 
 OBJC_CLASS AVAssetResourceLoadingRequest;
@@ -42,10 +43,10 @@
 class CachedResourceLoader;
 class MediaPlayerPrivateAVFoundationObjC;
 
-class WebCoreAVFResourceLoader : public CachedRawResourceClient {
+class WebCoreAVFResourceLoader : public RefCounted<WebCoreAVFResourceLoader>, CachedRawResourceClient {
     WTF_MAKE_NONCOPYABLE(WebCoreAVFResourceLoader); WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<WebCoreAVFResourceLoader> create(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest*);
+    static PassRefPtr<WebCoreAVFResourceLoader> create(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest *);
     virtual ~WebCoreAVFResourceLoader();
 
     void startLoading();
@@ -61,7 +62,7 @@
 
     void fulfillRequestWithResource(CachedResource*);
 
-    WebCoreAVFResourceLoader(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest*);
+    WebCoreAVFResourceLoader(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest *);
     MediaPlayerPrivateAVFoundationObjC* m_parent;
     RetainPtr<AVAssetResourceLoadingRequest> m_avRequest;
     CachedResourceHandle<CachedRawResource> m_resource;

Modified: branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm (153713 => 153714)


--- branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2013-08-05 17:49:42 UTC (rev 153713)
+++ branches/safari-537-branch/Source/WebCore/platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm	2013-08-05 18:04:45 UTC (rev 153714)
@@ -43,14 +43,14 @@
 
 namespace WebCore {
 
-PassOwnPtr<WebCoreAVFResourceLoader> WebCoreAVFResourceLoader::create(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest* avRequest)
+PassRefPtr<WebCoreAVFResourceLoader> WebCoreAVFResourceLoader::create(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest *avRequest)
 {
     ASSERT(avRequest);
     ASSERT(parent);
-    return adoptPtr(new WebCoreAVFResourceLoader(parent, avRequest));
+    return adoptRef(new WebCoreAVFResourceLoader(parent, avRequest));
 }
 
-WebCoreAVFResourceLoader::WebCoreAVFResourceLoader(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest* avRequest)
+WebCoreAVFResourceLoader::WebCoreAVFResourceLoader(MediaPlayerPrivateAVFoundationObjC* parent, AVAssetResourceLoadingRequest *avRequest)
     : m_parent(parent)
     , m_avRequest(avRequest)
 {
@@ -88,6 +88,8 @@
 
     m_resource->removeClient(this);
     m_resource = 0;
+
+    m_parent->didStopLoadingRequest(m_avRequest.get());
 }
 
 void WebCoreAVFResourceLoader::responseReceived(CachedResource* resource, const ResourceResponse& response)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to