Title: [192797] trunk/Source/WebCore
Revision
192797
Author
aes...@apple.com
Date
2015-11-30 10:06:23 -0800 (Mon, 30 Nov 2015)

Log Message

[Content Filtering] Avoid creating a ContentFilter when loading the empty document
https://bugs.webkit.org/show_bug.cgi?id=151615

Reviewed by Daniel Bates.

It's expensive to create the first ContentFilter since two frameworks must be soft-linked. There's no reason to
pay this cost if we're just loading the empty document.

No new tests. It's not possible to write a test that would fail without this change since ContentFilter is not
notified of empty document loads.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startLoadingMainResource): Don't initialize m_contentFilter until we know we aren't
loading the empty document.
(WebCore::DocumentLoader::DocumentLoader):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (192796 => 192797)


--- trunk/Source/WebCore/ChangeLog	2015-11-30 17:49:15 UTC (rev 192796)
+++ trunk/Source/WebCore/ChangeLog	2015-11-30 18:06:23 UTC (rev 192797)
@@ -1,3 +1,21 @@
+2015-11-25  Andy Estes  <aes...@apple.com>
+
+        [Content Filtering] Avoid creating a ContentFilter when loading the empty document
+        https://bugs.webkit.org/show_bug.cgi?id=151615
+
+        Reviewed by Daniel Bates.
+
+        It's expensive to create the first ContentFilter since two frameworks must be soft-linked. There's no reason to
+        pay this cost if we're just loading the empty document.
+
+        No new tests. It's not possible to write a test that would fail without this change since ContentFilter is not
+        notified of empty document loads.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::startLoadingMainResource): Don't initialize m_contentFilter until we know we aren't
+        loading the empty document.
+        (WebCore::DocumentLoader::DocumentLoader):
+
 2015-11-29  Antoine Quint  <grao...@apple.com>
 
         Browser does not fall back to SVG attribute value when CSS style value is invalid or not supported

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (192796 => 192797)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-11-30 17:49:15 UTC (rev 192796)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2015-11-30 18:06:23 UTC (rev 192797)
@@ -144,9 +144,6 @@
     , m_dataLoadTimer(*this, &DocumentLoader::handleSubstituteDataLoadNow)
     , m_subresourceLoadersArePageCacheAcceptable(false)
     , m_applicationCacheHost(std::make_unique<ApplicationCacheHost>(*this))
-#if ENABLE(CONTENT_FILTERING)
-    , m_contentFilter(!substituteData.isValid() ? ContentFilter::createIfEnabled(*this) : nullptr)
-#endif
 {
 }
 
@@ -1420,6 +1417,10 @@
     if (maybeLoadEmpty())
         return;
 
+#if ENABLE(CONTENT_FILTERING)
+    m_contentFilter = !m_originalSubstituteDataWasValid ? ContentFilter::createIfEnabled(*this) : nullptr;
+#endif
+
     // FIXME: Is there any way the extra fields could have not been added by now?
     // If not, it would be great to remove this line of code.
     // Note that currently, some requests may have incorrect extra fields even if this function has been called,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to