Title: [250576] trunk/Source
Revision
250576
Author
timothy_hor...@apple.com
Date
2019-10-01 13:15:04 -0700 (Tue, 01 Oct 2019)

Log Message

Clean up some includes to make the build a bit faster
https://bugs.webkit.org/show_bug.cgi?id=202417

Reviewed by Jer Noble.

Source/WebCore:

No new tests, just reorganizing.

Apply some profile-guided optimizations to our headers.

* Modules/mediasource/SourceBuffer.cpp:
* WebCorePrefix.h:
Add HashMap, which ends up included in all source files.

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::selectImageSource):
(WebCore::HTMLImageElement::didAttachRenderers):
(WebCore::HTMLImageElement::insertedIntoAncestor):
(WebCore::HTMLImageElement::width):
(WebCore::HTMLImageElement::height):
(WebCore::HTMLImageElement::naturalWidth const):
(WebCore::HTMLImageElement::naturalHeight const):
(WebCore::HTMLImageElement::complete const):
(WebCore::HTMLImageElement::decode):
(WebCore::HTMLImageElement::didMoveToNewDocument):
(WebCore::HTMLImageElement::cachedImage const):
(WebCore::HTMLImageElement::setLoadManually):
(WebCore::HTMLImageElement::hasPendingActivity const):
(WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const):
* html/HTMLImageElement.h:
(WebCore::HTMLImageElement::cachedImage const): Deleted.
(WebCore::HTMLImageElement::setLoadManually): Deleted.
(WebCore::HTMLImageElement::hasPendingActivity const): Deleted.
(WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const): Deleted.
HTMLImageLoader brings in JSDOMPromiseDeferred, which is known to be horribly expensive.
Out-of-line m_imageLoader.

* platform/graphics/GraphicsLayer.h:
Swap Animation for TimingFunction, which is much smaller.

* platform/graphics/MediaPlayer.h:
InbandTextTrackPrivate brings in SerializedPlatformRepresentation.h,
which is very expensive. MediaPlayer.h is included in many places.
Break the link.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:

Source/WebKit:

* WebProcess/Plugins/Netscape/NetscapePlugin.h:
* WebProcess/Plugins/Plugin.h:
Fix the build.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (250575 => 250576)


--- trunk/Source/WebCore/ChangeLog	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/ChangeLog	2019-10-01 20:15:04 UTC (rev 250576)
@@ -1,3 +1,52 @@
+2019-10-01  Tim Horton  <timothy_hor...@apple.com>
+
+        Clean up some includes to make the build a bit faster
+        https://bugs.webkit.org/show_bug.cgi?id=202417
+
+        Reviewed by Jer Noble.
+
+        No new tests, just reorganizing.
+
+        Apply some profile-guided optimizations to our headers.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        * WebCorePrefix.h:
+        Add HashMap, which ends up included in all source files.
+
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::HTMLImageElement):
+        (WebCore::HTMLImageElement::selectImageSource):
+        (WebCore::HTMLImageElement::didAttachRenderers):
+        (WebCore::HTMLImageElement::insertedIntoAncestor):
+        (WebCore::HTMLImageElement::width):
+        (WebCore::HTMLImageElement::height):
+        (WebCore::HTMLImageElement::naturalWidth const):
+        (WebCore::HTMLImageElement::naturalHeight const):
+        (WebCore::HTMLImageElement::complete const):
+        (WebCore::HTMLImageElement::decode):
+        (WebCore::HTMLImageElement::didMoveToNewDocument):
+        (WebCore::HTMLImageElement::cachedImage const):
+        (WebCore::HTMLImageElement::setLoadManually):
+        (WebCore::HTMLImageElement::hasPendingActivity const):
+        (WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const):
+        * html/HTMLImageElement.h:
+        (WebCore::HTMLImageElement::cachedImage const): Deleted.
+        (WebCore::HTMLImageElement::setLoadManually): Deleted.
+        (WebCore::HTMLImageElement::hasPendingActivity const): Deleted.
+        (WebCore::HTMLImageElement::pendingDecodePromisesCountForTesting const): Deleted.
+        HTMLImageLoader brings in JSDOMPromiseDeferred, which is known to be horribly expensive.
+        Out-of-line m_imageLoader.
+
+        * platform/graphics/GraphicsLayer.h:
+        Swap Animation for TimingFunction, which is much smaller.
+
+        * platform/graphics/MediaPlayer.h:
+        InbandTextTrackPrivate brings in SerializedPlatformRepresentation.h,
+        which is very expensive. MediaPlayer.h is included in many places.
+        Break the link.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+
 2019-10-01  youenn fablet  <you...@apple.com>
 
         RTCDataChannel should not prevent entering page cache except if in open state

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (250575 => 250576)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2019-10-01 20:15:04 UTC (rev 250576)
@@ -41,6 +41,7 @@
 #include "GenericEventQueue.h"
 #include "HTMLMediaElement.h"
 #include "InbandTextTrack.h"
+#include "InbandTextTrackPrivate.h"
 #include "Logging.h"
 #include "MediaDescription.h"
 #include "MediaSample.h"

Modified: trunk/Source/WebCore/WebCorePrefix.h (250575 => 250576)


--- trunk/Source/WebCore/WebCorePrefix.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/WebCorePrefix.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -173,6 +173,7 @@
 
 #if !PLATFORM(WIN)
 #import <wtf/FastMalloc.h>
+#import <wtf/HashMap.h>
 #import <wtf/Optional.h>
 #import <wtf/StdLibExtras.h>
 #import <wtf/text/AtomString.h>

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (250575 => 250576)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2019-10-01 20:15:04 UTC (rev 250576)
@@ -37,6 +37,7 @@
 #include "HTMLAttachmentElement.h"
 #include "HTMLDocument.h"
 #include "HTMLFormElement.h"
+#include "HTMLImageLoader.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLPictureElement.h"
 #include "HTMLMapElement.h"
@@ -70,7 +71,7 @@
 
 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser)
     : HTMLElement(tagName, document)
-    , m_imageLoader(*this)
+    , m_imageLoader(WTF::makeUnique<HTMLImageLoader>(*this))
     , m_form(nullptr)
     , m_formSetByParser(makeWeakPtr(form))
     , m_compositeOperator(CompositeSourceOver)
@@ -213,7 +214,7 @@
         candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), attributeWithoutSynchronization(srcAttr), attributeWithoutSynchronization(srcsetAttr), sourceSize);
     }
     setBestFitURLAndDPRFromImageCandidate(candidate);
-    m_imageLoader.updateFromElementIgnoringPreviousError();
+    m_imageLoader->updateFromElementIgnoringPreviousError();
 }
 
 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomString& value)
@@ -313,7 +314,7 @@
 {
     if (!is<RenderImage>(renderer()))
         return;
-    if (m_imageLoader.hasPendingBeforeLoadEvent())
+    if (m_imageLoader->hasPendingBeforeLoadEvent())
         return;
 
 #if ENABLE(SERVICE_CONTROLS)
@@ -324,11 +325,11 @@
     RenderImageResource& renderImageResource = renderImage.imageResource();
     if (renderImageResource.cachedImage())
         return;
-    renderImageResource.setCachedImage(m_imageLoader.image());
+    renderImageResource.setCachedImage(m_imageLoader->image());
 
     // If we have no image at all because we have no src attribute, set
     // image height and width for the alt text instead.
-    if (!m_imageLoader.image() && !renderImageResource.cachedImage())
+    if (!m_imageLoader->image() && !renderImageResource.cachedImage())
         renderImage.setImageSizeForAltText();
 }
 
@@ -368,8 +369,8 @@
 
     // If we have been inserted from a renderer-less document,
     // our loader may have not fetched the image, so do it now.
-    if (insertionType.connectedToDocument && !m_imageLoader.image())
-        m_imageLoader.updateFromElement();
+    if (insertionType.connectedToDocument && !m_imageLoader->image())
+        m_imageLoader->updateFromElement();
 
     return insertNotificationRequest;
 }
@@ -473,8 +474,8 @@
             return optionalWidth.value();
 
         // if the image is available, use its width
-        if (m_imageLoader.image())
-            return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).width().toUnsigned();
+        if (m_imageLoader->image())
+            return m_imageLoader->image()->imageSizeForRenderer(renderer(), 1.0f).width().toUnsigned();
     }
 
     if (ignorePendingStylesheets)
@@ -498,8 +499,8 @@
             return optionalHeight.value();
 
         // if the image is available, use its height
-        if (m_imageLoader.image())
-            return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).height().toUnsigned();
+        if (m_imageLoader->image())
+            return m_imageLoader->image()->imageSizeForRenderer(renderer(), 1.0f).height().toUnsigned();
     }
 
     if (ignorePendingStylesheets)
@@ -516,18 +517,18 @@
 
 int HTMLImageElement::naturalWidth() const
 {
-    if (!m_imageLoader.image())
+    if (!m_imageLoader->image())
         return 0;
 
-    return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).width();
+    return m_imageLoader->image()->imageSizeForRenderer(renderer(), 1.0f).width();
 }
 
 int HTMLImageElement::naturalHeight() const
 {
-    if (!m_imageLoader.image())
+    if (!m_imageLoader->image())
         return 0;
 
-    return m_imageLoader.image()->imageSizeForRenderer(renderer(), 1.0f).height();
+    return m_imageLoader->image()->imageSizeForRenderer(renderer(), 1.0f).height();
 }
 
 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const
@@ -635,7 +636,7 @@
 
 bool HTMLImageElement::complete() const
 {
-    return m_imageLoader.imageComplete();
+    return m_imageLoader->imageComplete();
 }
 
 DecodingMode HTMLImageElement::decodingMode() const
@@ -650,7 +651,7 @@
     
 void HTMLImageElement::decode(Ref<DeferredPromise>&& promise)
 {
-    return m_imageLoader.decode(WTFMove(promise));
+    return m_imageLoader->decode(WTFMove(promise));
 }
 
 void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
@@ -664,7 +665,7 @@
 
 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument)
 {
-    m_imageLoader.elementDidMoveToNewDocument();
+    m_imageLoader->elementDidMoveToNewDocument();
     HTMLElement::didMoveToNewDocument(oldDocument, newDocument);
 }
 
@@ -840,4 +841,24 @@
     HTMLElement::defaultEventHandler(event);
 }
 
+CachedImage* HTMLImageElement::cachedImage() const
+{
+    return m_imageLoader->image();
 }
+
+void HTMLImageElement::setLoadManually(bool loadManually)
+{
+    m_imageLoader->setLoadManually(loadManually);
+}
+
+bool HTMLImageElement::hasPendingActivity() const
+{
+    return m_imageLoader->hasPendingActivity();
+}
+
+size_t HTMLImageElement::pendingDecodePromisesCountForTesting() const
+{
+    return m_imageLoader->pendingDecodePromisesCountForTesting();
+}
+
+}

Modified: trunk/Source/WebCore/html/HTMLImageElement.h (250575 => 250576)


--- trunk/Source/WebCore/html/HTMLImageElement.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/html/HTMLImageElement.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -28,13 +28,15 @@
 #include "GraphicsLayer.h"
 #include "GraphicsTypes.h"
 #include "HTMLElement.h"
-#include "HTMLImageLoader.h"
 
 namespace WebCore {
 
+class CachedImage;
+class DeferredPromise;
 class EditableImageReference;
 class HTMLAttachmentElement;
 class HTMLFormElement;
+class HTMLImageLoader;
 class HTMLMapElement;
 
 struct ImageCandidate;
@@ -65,9 +67,9 @@
 
     CompositeOperator compositeOperator() const { return m_compositeOperator; }
 
-    CachedImage* cachedImage() const { return m_imageLoader.image(); }
+    WEBCORE_EXPORT CachedImage* cachedImage() const;
 
-    void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
+    void setLoadManually(bool);
 
     bool matchesUsemap(const AtomStringImpl&) const;
     HTMLMapElement* associatedMapElement() const;
@@ -103,8 +105,8 @@
     const String& attachmentIdentifier() const;
 #endif
 
-    bool hasPendingActivity() const { return m_imageLoader.hasPendingActivity(); }
-    size_t pendingDecodePromisesCountForTesting() const { return m_imageLoader.pendingDecodePromisesCountForTesting(); }
+    bool hasPendingActivity() const;
+    WEBCORE_EXPORT size_t pendingDecodePromisesCountForTesting() const;
 
     bool canContainRangeEndPoint() const override { return false; }
 
@@ -180,7 +182,7 @@
     bool childShouldCreateRenderer(const Node&) const override;
 #endif
 
-    HTMLImageLoader m_imageLoader;
+    std::unique_ptr<HTMLImageLoader> m_imageLoader;
     WeakPtr<HTMLFormElement> m_form;
     WeakPtr<HTMLFormElement> m_formSetByParser;
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (250575 => 250576)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -25,7 +25,6 @@
 
 #pragma once
 
-#include "Animation.h"
 #include "Color.h"
 #include "EventRegion.h"
 #include "FilterOperations.h"
@@ -38,6 +37,7 @@
 #include "PlatformLayer.h"
 #include "Region.h"
 #include "ScrollableArea.h"
+#include "TimingFunction.h"
 #include "TransformOperations.h"
 #include "WindRule.h"
 #include <wtf/Function.h>
@@ -53,6 +53,7 @@
 
 namespace WebCore {
 
+class Animation;
 class GraphicsContext;
 class GraphicsLayerFactory;
 class Image;

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (250575 => 250576)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -30,7 +30,6 @@
 #include "AudioTrackPrivate.h"
 #include "ContentType.h"
 #include "GraphicsTypes3D.h"
-#include "InbandTextTrackPrivate.h"
 #include "LayoutRect.h"
 #include "LegacyCDMSession.h"
 #include "MediaPlayerEnums.h"
@@ -64,6 +63,7 @@
 class CachedResourceLoader;
 class GraphicsContext3D;
 class GraphicsContext;
+class InbandTextTrackPrivate;
 class LegacyCDMSessionClient;
 class MediaPlaybackTarget;
 class MediaPlayer;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (250575 => 250576)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -30,6 +30,7 @@
 
 #include "MediaPlayerPrivate.h"
 #include "SourceBufferPrivateClient.h"
+#include <wtf/Deque.h>
 #include <wtf/Function.h>
 #include <wtf/HashMap.h>
 #include <wtf/LoggerHelper.h>

Modified: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h (250575 => 250576)


--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include "Animation.h"
 #include "GraphicsLayer.h"
 
 namespace WebCore {

Modified: trunk/Source/WebKit/ChangeLog (250575 => 250576)


--- trunk/Source/WebKit/ChangeLog	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebKit/ChangeLog	2019-10-01 20:15:04 UTC (rev 250576)
@@ -1,3 +1,14 @@
+2019-10-01  Tim Horton  <timothy_hor...@apple.com>
+
+        Clean up some includes to make the build a bit faster
+        https://bugs.webkit.org/show_bug.cgi?id=202417
+
+        Reviewed by Jer Noble.
+
+        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
+        * WebProcess/Plugins/Plugin.h:
+        Fix the build.
+
 2019-10-01  Alex Christensen  <achristen...@webkit.org>
 
         Fix GTK build after r250558

Modified: trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.h (250575 => 250576)


--- trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebKit/WebProcess/Plugins/Netscape/NetscapePlugin.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -42,6 +42,7 @@
 }
 
 namespace WebCore {
+class Element;
 class HTTPHeaderMap;
 class ProtectionSpace;
 class SharedBuffer;

Modified: trunk/Source/WebKit/WebProcess/Plugins/Plugin.h (250575 => 250576)


--- trunk/Source/WebKit/WebProcess/Plugins/Plugin.h	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebKit/WebProcess/Plugins/Plugin.h	2019-10-01 20:15:04 UTC (rev 250576)
@@ -53,6 +53,7 @@
 
 namespace WebCore {
 class AffineTransform;
+class Element;
 class FloatPoint;
 class GraphicsContext;
 class IntPoint;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp (250575 => 250576)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp	2019-10-01 19:44:32 UTC (rev 250575)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp	2019-10-01 20:15:04 UTC (rev 250576)
@@ -29,6 +29,7 @@
 #include "DrawingArea.h"
 #include "WebInspector.h"
 #include "WebPage.h"
+#include <WebCore/Animation.h>
 #include <WebCore/Frame.h>
 #include <WebCore/InspectorController.h>
 #include <WebCore/Page.h>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to