[iOS] Avoid dlopening QuickLooks in the common case where the main resource is HTML...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 01:58:14 +0000 (01:58 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 May 2018 01:58:14 +0000 (01:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185966

Reviewed by Geoffrey Garen.

Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text
for performance reasons.

* loader/ios/PreviewLoader.mm:
(WebCore::PreviewLoader::shouldCreateForMIMEType):

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

Source/WebCore/ChangeLog
Source/WebCore/loader/ios/PreviewLoader.mm

index 514f099..67d9de1 100644 (file)
@@ -1,3 +1,16 @@
+2018-05-24  Chris Dumez  <cdumez@apple.com>
+
+        [iOS] Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text
+        https://bugs.webkit.org/show_bug.cgi?id=185966
+
+        Reviewed by Geoffrey Garen.
+
+        Avoid dlopening QuickLooks in the common case where the main resource is HTML or plain text
+        for performance reasons.
+
+        * loader/ios/PreviewLoader.mm:
+        (WebCore::PreviewLoader::shouldCreateForMIMEType):
+
 2018-05-24  Sam Weinig  <sam@webkit.org>
 
         Modernize RenderStyleConstants.h - Part 2
index 95334cc..66c0c9e 100644 (file)
@@ -243,6 +243,9 @@ PreviewLoader::~PreviewLoader()
 
 bool PreviewLoader::shouldCreateForMIMEType(const String& mimeType)
 {
+    if (equalLettersIgnoringASCIICase(mimeType, "text/html") || equalLettersIgnoringASCIICase(mimeType, "text/plain"))
+        return false;
+
     static std::once_flag onceFlag;
     static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> supportedMIMETypes;
     std::call_once(onceFlag, [] {