Title: [228642] releases/WebKitGTK/webkit-2.20/Source/WebCore
Revision
228642
Author
carlo...@webkit.org
Date
2018-02-19 03:02:22 -0800 (Mon, 19 Feb 2018)

Log Message

Merge r228201 - Use downcast in createLinkPreloadResourceClient
https://bugs.webkit.org/show_bug.cgi?id=182488

Patch by Youenn Fablet <you...@apple.com> on 2018-02-06
Reviewed by Antti Koivisto.

No observable change of behavior.
Add a new link preloader client for text track.

* loader/LinkLoader.cpp:
(WebCore::createLinkPreloadResourceClient):
* loader/LinkPreloadResourceClients.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (228641 => 228642)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-19 10:49:56 UTC (rev 228641)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-19 11:02:22 UTC (rev 228642)
@@ -1,3 +1,17 @@
+2018-02-06  Youenn Fablet  <you...@apple.com>
+
+        Use downcast in createLinkPreloadResourceClient
+        https://bugs.webkit.org/show_bug.cgi?id=182488
+
+        Reviewed by Antti Koivisto.
+
+        No observable change of behavior.
+        Add a new link preloader client for text track.
+
+        * loader/LinkLoader.cpp:
+        (WebCore::createLinkPreloadResourceClient):
+        * loader/LinkPreloadResourceClients.h:
+
 2018-02-06  Andy Estes  <aes...@apple.com>
 
         [WebIDL] Support optional Promise arguments

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/loader/LinkLoader.cpp (228641 => 228642)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/loader/LinkLoader.cpp	2018-02-19 10:49:56 UTC (rev 228641)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/loader/LinkLoader.cpp	2018-02-19 11:02:22 UTC (rev 228642)
@@ -139,22 +139,22 @@
 {
     switch (resource.type()) {
     case CachedResource::ImageResource:
-        return LinkPreloadImageResourceClient::create(loader, static_cast<CachedImage&>(resource));
+        return LinkPreloadImageResourceClient::create(loader, downcast<CachedImage>(resource));
     case CachedResource::Script:
-        return LinkPreloadScriptResourceClient::create(loader, static_cast<CachedScript&>(resource));
+        return LinkPreloadDefaultResourceClient::create(loader, downcast<CachedScript>(resource));
     case CachedResource::CSSStyleSheet:
-        return LinkPreloadStyleResourceClient::create(loader, static_cast<CachedCSSStyleSheet&>(resource));
+        return LinkPreloadStyleResourceClient::create(loader, downcast<CachedCSSStyleSheet>(resource));
     case CachedResource::FontResource:
-        return LinkPreloadFontResourceClient::create(loader, static_cast<CachedFont&>(resource));
-    case CachedResource::MediaResource:
-        if (!RuntimeEnabledFeatures::sharedFeatures().mediaPreloadingEnabled())
-            ASSERT_NOT_REACHED();
-        FALLTHROUGH;
+        return LinkPreloadFontResourceClient::create(loader, downcast<CachedFont>(resource));
 #if ENABLE(VIDEO_TRACK)
     case CachedResource::TextTrackResource:
+        return LinkPreloadDefaultResourceClient::create(loader, downcast<CachedTextTrack>(resource));
 #endif
+    case CachedResource::MediaResource:
+        ASSERT(RuntimeEnabledFeatures::sharedFeatures().mediaPreloadingEnabled());
+        FALLTHROUGH;
     case CachedResource::RawResource:
-        return LinkPreloadRawResourceClient::create(loader, static_cast<CachedRawResource&>(resource));
+        return LinkPreloadRawResourceClient::create(loader, downcast<CachedRawResource>(resource));
     case CachedResource::MainResource:
     case CachedResource::Icon:
 #if ENABLE(SVG_FONTS)

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/loader/LinkPreloadResourceClients.h (228641 => 228642)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/loader/LinkPreloadResourceClients.h	2018-02-19 10:49:56 UTC (rev 228641)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/loader/LinkPreloadResourceClients.h	2018-02-19 11:02:22 UTC (rev 228642)
@@ -36,6 +36,7 @@
 #include "CachedResourceHandle.h"
 #include "CachedScript.h"
 #include "CachedStyleSheetClient.h"
+#include "CachedTextTrack.h"
 
 #include <wtf/WeakPtr.h>
 
@@ -76,16 +77,21 @@
     CachedResourceHandle<CachedResource> m_resource;
 };
 
-class LinkPreloadScriptResourceClient: public LinkPreloadResourceClient, CachedResourceClient {
+class LinkPreloadDefaultResourceClient: public LinkPreloadResourceClient, CachedResourceClient {
 public:
-    static std::unique_ptr<LinkPreloadScriptResourceClient> create(LinkLoader& loader, CachedScript& resource)
+    static std::unique_ptr<LinkPreloadDefaultResourceClient> create(LinkLoader& loader, CachedScript& resource)
     {
-        return std::unique_ptr<LinkPreloadScriptResourceClient>(new LinkPreloadScriptResourceClient(loader, resource));
+        return std::unique_ptr<LinkPreloadDefaultResourceClient>(new LinkPreloadDefaultResourceClient(loader, resource));
     }
 
-    virtual ~LinkPreloadScriptResourceClient() = default;
+    static std::unique_ptr<LinkPreloadDefaultResourceClient> create(LinkLoader& loader, CachedTextTrack& resource)
+    {
+        return std::unique_ptr<LinkPreloadDefaultResourceClient>(new LinkPreloadDefaultResourceClient(loader, resource));
+    }
 
+    virtual ~LinkPreloadDefaultResourceClient() = default;
 
+
     void notifyFinished(CachedResource& resource) override { triggerEvents(resource); }
 
     void clear() override { clearResource(*this); }
@@ -92,7 +98,7 @@
     bool shouldMarkAsReferenced() const override { return false; }
 
 private:
-    LinkPreloadScriptResourceClient(LinkLoader& loader, CachedScript& resource)
+    LinkPreloadDefaultResourceClient(LinkLoader& loader, CachedResource& resource)
         : LinkPreloadResourceClient(loader, resource)
     {
         addResource(*this);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to