MediaResourceLoader::requestResource should take a ResourceRequest&& as input
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Oct 2016 06:26:35 +0000 (06:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Oct 2016 06:26:35 +0000 (06:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160397

Patch by Youenn Fablet <youenn@apple.com> on 2016-10-11
Reviewed by Alex Christensen.

No change in behavior.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Passing a ResourceRequest&& as input parameter.
* loader/MediaResourceLoader.h:
* platform/graphics/PlatformMediaResourceLoader.h: Ditto.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcStart): Creating an extra copy since MediaResourceLoader::requestResource expects a Resourcerequest&&.

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

Source/WebCore/ChangeLog
Source/WebCore/loader/MediaResourceLoader.cpp
Source/WebCore/loader/MediaResourceLoader.h
Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h
Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

index f0f555e..66b8b4b 100644 (file)
@@ -1,3 +1,19 @@
+2016-10-11  Youenn Fablet  <youenn@apple.com>
+
+        MediaResourceLoader::requestResource should take a ResourceRequest&& as input
+        https://bugs.webkit.org/show_bug.cgi?id=160397
+
+        Reviewed by Alex Christensen.
+
+        No change in behavior.
+
+        * loader/MediaResourceLoader.cpp:
+        (WebCore::MediaResourceLoader::requestResource): Passing a ResourceRequest&& as input parameter.
+        * loader/MediaResourceLoader.h:
+        * platform/graphics/PlatformMediaResourceLoader.h: Ditto.
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webKitWebSrcStart): Creating an extra copy since MediaResourceLoader::requestResource expects a Resourcerequest&&.
+
 2016-10-11  Chris Dumez  <cdumez@apple.com>
 
         Update AnimationEvent to stop using legacy [ConstructorTemplate=Event]
index 4af920d..6474e56 100644 (file)
@@ -57,7 +57,7 @@ void MediaResourceLoader::contextDestroyed()
     m_document = nullptr;
 }
 
-RefPtr<PlatformMediaResource> MediaResourceLoader::requestResource(const ResourceRequest& request, LoadOptions options)
+RefPtr<PlatformMediaResource> MediaResourceLoader::requestResource(ResourceRequest&& request, LoadOptions options)
 {
     if (!m_document)
         return nullptr;
@@ -65,9 +65,8 @@ RefPtr<PlatformMediaResource> MediaResourceLoader::requestResource(const Resourc
     DataBufferingPolicy bufferingPolicy = options & LoadOption::BufferData ? WebCore::BufferData : WebCore::DoNotBufferData;
     auto cachingPolicy = options & LoadOption::DisallowCaching ? CachingPolicy::DisallowCaching : CachingPolicy::AllowCaching;
 
-    // FIXME: We should try to remove the copy of request when crearing cacheRequest.
-    // FIXME: Skip Content Security Policy check if the element that inititated this request is in a user-agent shadow tree. See <https://bugs.webkit.org/show_bug.cgi?id=155505>.
-    CachedResourceRequest cacheRequest(ResourceRequest(request), ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, AllowStoredCredentials, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, DoSecurityCheck, FetchOptions::Mode::NoCors, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, cachingPolicy));
+    // FIXME: Skip Content Security Policy check if the element that initiated this request is in a user-agent shadow tree. See <https://bugs.webkit.org/show_bug.cgi?id=155505>.
+    CachedResourceRequest cacheRequest(WTFMove(request), ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, AllowStoredCredentials, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, DoSecurityCheck, FetchOptions::Mode::NoCors, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, cachingPolicy));
 
     cacheRequest.setAsPotentiallyCrossOrigin(m_crossOriginMode, *m_document);
 
index 8199782..8d2b1bb 100644 (file)
@@ -46,7 +46,7 @@ public:
     WEBCORE_EXPORT MediaResourceLoader(Document&, const String& crossOriginMode);
     WEBCORE_EXPORT virtual ~MediaResourceLoader();
 
-    RefPtr<PlatformMediaResource> requestResource(const ResourceRequest&, LoadOptions) override;
+    RefPtr<PlatformMediaResource> requestResource(ResourceRequest&&, LoadOptions) final;
     void removeResource(MediaResource&);
 
     Document* document() { return m_document; }
index 96035fc..bc06316 100644 (file)
@@ -66,7 +66,7 @@ public:
 
     virtual ~PlatformMediaResourceLoader() { }
 
-    virtual RefPtr<PlatformMediaResource> requestResource(const ResourceRequest&, LoadOptions) = 0;
+    virtual RefPtr<PlatformMediaResource> requestResource(ResourceRequest&&, LoadOptions) = 0;
 
 protected:
     PlatformMediaResourceLoader() { }
index d2a7c6b..0da4a88 100644 (file)
@@ -580,7 +580,8 @@ static void webKitWebSrcStart(WebKitWebSrc* src)
         PlatformMediaResourceLoader::LoadOptions loadOptions = 0;
         if (request.url().protocolIsBlob())
             loadOptions |= PlatformMediaResourceLoader::LoadOption::BufferData;
-        priv->resource = priv->loader->requestResource(request, loadOptions);
+        // FIXME: request should be moved for efficiency
+        priv->resource = priv->loader->requestResource(ResourceRequest(request), loadOptions);
         if (priv->resource) {
             priv->resource->setClient(std::make_unique<CachedResourceStreamingClient>(protector.get()));
             GST_DEBUG_OBJECT(protector.get(), "Started request");