Clean up some includes to make the build a bit faster
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2019 06:39:07 +0000 (06:39 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2019 06:39:07 +0000 (06:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202444

Reviewed by Geoff Garen.

No new tests, just reorganizing.

Apply some profile-guided optimizations to our headers.

* bindings/js/CallTracerTypes.h:
* css/typedom/TypedOMCSSImageValue.h:
* html/canvas/WebGLObject.h:
* html/canvas/WebGLVertexArrayObjectBase.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice):
(WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
(WebCore::InspectorInstrumentation::instrumentingAgentsForPage):
(WebCore::InspectorInstrumentation::instrumentingAgentsForContext):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didCreateWebGPUDevice):
(WebCore::InspectorInstrumentation::willDestroyWebGPUDevice):
(WebCore::InspectorInstrumentation::didCreateWebGPUPipeline):
* platform/graphics/BitmapImage.cpp:
* platform/graphics/Font.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::getUserToBaseCTM):
* platform/graphics/cg/GraphicsContextCG.h:
(WebCore::getUserToBaseCTM): Deleted.
* platform/graphics/cg/ImageBufferCG.cpp:
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/mac/PDFDocumentImageMac.mm:
InspectorInstrumentation.h is one of the most expensive headers in the entire project.
While not included in many places (70), it is fairly straightforward to reduce
its per-inclusion cost by rougly 80%.

* UIProcess/API/Cocoa/_WKThumbnailView.mm:

* WebView/WebFrame.mm:
* WebView/WebView.mm:

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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/CallTracerTypes.h
Source/WebCore/css/typedom/TypedOMCSSImageValue.h
Source/WebCore/html/canvas/WebGLObject.h
Source/WebCore/html/canvas/WebGLVertexArrayObjectBase.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.h
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cocoa/IOSurface.h
Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebFrame.mm
Source/WebKitLegacy/mac/WebView/WebView.mm

index 1d6cd2f..b6eaf1a 100644 (file)
@@ -1,3 +1,40 @@
+2019-10-01  Tim Horton  <timothy_horton@apple.com>
+
+        Clean up some includes to make the build a bit faster
+        https://bugs.webkit.org/show_bug.cgi?id=202444
+
+        Reviewed by Geoff Garen.
+
+        No new tests, just reorganizing.
+
+        Apply some profile-guided optimizations to our headers.
+
+        * bindings/js/CallTracerTypes.h:
+        * css/typedom/TypedOMCSSImageValue.h:
+        * html/canvas/WebGLObject.h:
+        * html/canvas/WebGLVertexArrayObjectBase.h:
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForPage):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForContext):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::didCreateWebGPUDevice):
+        (WebCore::InspectorInstrumentation::willDestroyWebGPUDevice):
+        (WebCore::InspectorInstrumentation::didCreateWebGPUPipeline):
+        * platform/graphics/BitmapImage.cpp:
+        * platform/graphics/Font.h:
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::getUserToBaseCTM):
+        * platform/graphics/cg/GraphicsContextCG.h:
+        (WebCore::getUserToBaseCTM): Deleted.
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        * platform/graphics/cocoa/IOSurface.h:
+        * platform/graphics/mac/PDFDocumentImageMac.mm:
+        InspectorInstrumentation.h is one of the most expensive headers in the entire project.
+        While not included in many places (70), it is fairly straightforward to reduce
+        its per-inclusion cost by rougly 80%.
+
 2019-10-01  Alex Christensen  <achristensen@webkit.org>
 
         Progress towards a functioning CMake build on Mac
index e730a76..2db7410 100644 (file)
@@ -33,7 +33,6 @@
 #include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLVideoElement.h"
-#include "ImageBitmap.h"
 #include "ImageData.h"
 #include "Path2D.h"
 #include "TypedOMCSSImageValue.h"
index 9e4f9df..dac23e4 100644 (file)
@@ -28,8 +28,6 @@
 #if ENABLE(CSS_TYPED_OM)
 
 #include "CSSImageValue.h"
-#include "ImageBitmap.h"
-#include "RenderElement.h"
 #include "TypedOMCSSStyleValue.h"
 #include <wtf/RefCounted.h>
 #include <wtf/text/StringConcatenateNumbers.h>
index cef383f..0da5d71 100644 (file)
 
 #if ENABLE(WEBGL)
 
-#include "GraphicsContext3D.h"
+#include "GraphicsTypes3D.h"
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
+class GraphicsContext3D;
 class WebGLContextGroup;
 class WebGLRenderingContextBase;
 
index bb07ee8..2071f34 100644 (file)
@@ -27,6 +27,7 @@
 
 #if ENABLE(WEBGL)
 
+#include "GraphicsContext3D.h"
 #include "WebGLBuffer.h"
 #include "WebGLContextObject.h"
 
index 912c845..83e342e 100644 (file)
@@ -42,6 +42,7 @@
 #include "InspectorApplicationCacheAgent.h"
 #include "InspectorCSSAgent.h"
 #include "InspectorCanvasAgent.h"
+#include "InspectorController.h"
 #include "InspectorDOMAgent.h"
 #include "InspectorDOMDebuggerAgent.h"
 #include "InspectorDOMStorageAgent.h"
 #include "WebConsoleAgent.h"
 #include "WebDebuggerAgent.h"
 #include "WebGLRenderingContextBase.h"
+#include "WebGPUDevice.h"
 #include "WebSocketFrame.h"
+#include "WorkerGlobalScope.h"
+#include "WorkerInspectorController.h"
 #include <JavaScriptCore/ConsoleMessage.h>
 #include <JavaScriptCore/ConsoleTypes.h>
 #include <JavaScriptCore/InspectorDebuggerAgent.h>
@@ -1136,6 +1140,11 @@ void InspectorInstrumentation::willDestroyWebGPUPipelineImpl(InstrumentingAgents
     if (auto* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
         canvasAgent->willDestroyWebGPUPipeline(pipeline);
 }
+
+InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWebGPUDevice(WebGPUDevice& device)
+{
+    return instrumentingAgentsForContext(device.scriptExecutionContext());
+}
 #endif
 
 #if ENABLE(RESOURCE_USAGE)
@@ -1280,4 +1289,24 @@ void InspectorInstrumentation::renderLayerDestroyedImpl(InstrumentingAgents& ins
         layerTreeAgent->renderLayerDestroyed(renderLayer);
 }
 
+InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope)
+{
+    return workerGlobalScope.inspectorController().m_instrumentingAgents;
+}
+
+InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForPage(Page& page)
+{
+    ASSERT(isMainThread());
+    return page.inspectorController().m_instrumentingAgents.get();
+}
+
+InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext& context)
+{
+    if (is<Document>(context))
+        return instrumentingAgentsForPage(downcast<Document>(context).page());
+    if (is<WorkerGlobalScope>(context))
+        return &instrumentingAgentsForWorkerGlobalScope(downcast<WorkerGlobalScope>(context));
+    return nullptr;
+}
+
 } // namespace WebCore
index 549aa17..551f90e 100644 (file)
 #include "FormData.h"
 #include "Frame.h"
 #include "HitTestResult.h"
-#include "InspectorController.h"
 #include "InspectorInstrumentationCookie.h"
 #include "InspectorInstrumentationPublic.h"
-#include "OffscreenCanvas.h"
 #include "Page.h"
 #include "StorageArea.h"
-#include "WorkerGlobalScope.h"
-#include "WorkerInspectorController.h"
-#include <JavaScriptCore/JSCInlines.h>
+#include <JavaScriptCore/ConsoleMessage.h>
 #include <initializer_list>
 #include <wtf/CompletionHandler.h>
 #include <wtf/MemoryPressureHandler.h>
@@ -62,7 +58,6 @@
 
 #if ENABLE(WEBGPU)
 #include "GPUCanvasContext.h"
-#include "WebGPUDevice.h"
 #include "WebGPUPipeline.h"
 #endif
 
@@ -99,6 +94,7 @@ class ShadowRoot;
 class SharedBuffer;
 class TimerBase;
 class WebKitNamedFlow;
+class WorkerGlobalScope;
 class WorkerInspectorProxy;
 
 #if ENABLE(WEBGL)
@@ -106,6 +102,7 @@ class WebGLProgram;
 #endif
 
 #if ENABLE(WEBGPU)
+class WebGPUDevice;
 class WebGPUSwapChain;
 #endif
 
@@ -495,6 +492,7 @@ private:
     static void willConfigureSwapChainImpl(InstrumentingAgents&, GPUCanvasContext&, WebGPUSwapChain&);
     static void didCreateWebGPUPipelineImpl(InstrumentingAgents&, WebGPUDevice&, WebGPUPipeline&);
     static void willDestroyWebGPUPipelineImpl(InstrumentingAgents&, WebGPUPipeline&);
+    static InstrumentingAgents* instrumentingAgentsForWebGPUDevice(WebGPUDevice&);
 #endif
 
     static void layerTreeDidChangeImpl(InstrumentingAgents&);
@@ -1424,14 +1422,14 @@ inline bool InspectorInstrumentation::isWebGLProgramHighlighted(WebGLRenderingCo
 inline void InspectorInstrumentation::didCreateWebGPUDevice(WebGPUDevice& device)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (auto* instrumentingAgents = instrumentingAgentsForContext(device.scriptExecutionContext()))
+    if (auto* instrumentingAgents = instrumentingAgentsForWebGPUDevice(device))
         didCreateWebGPUDeviceImpl(*instrumentingAgents, device);
 }
 
 inline void InspectorInstrumentation::willDestroyWebGPUDevice(WebGPUDevice& device)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (auto* instrumentingAgents = instrumentingAgentsForContext(device.scriptExecutionContext()))
+    if (auto* instrumentingAgents = instrumentingAgentsForWebGPUDevice(device))
         willDestroyWebGPUDeviceImpl(*instrumentingAgents, device);
 }
 
@@ -1445,7 +1443,7 @@ inline void InspectorInstrumentation::willConfigureSwapChain(GPUCanvasContext& c
 inline void InspectorInstrumentation::didCreateWebGPUPipeline(WebGPUDevice& device, WebGPUPipeline& pipeline)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (auto* instrumentingAgents = instrumentingAgentsForContext(device.scriptExecutionContext()))
+    if (auto* instrumentingAgents = instrumentingAgentsForWebGPUDevice(device))
         didCreateWebGPUPipelineImpl(*instrumentingAgents, device, pipeline);
 }
 
@@ -1629,15 +1627,6 @@ inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForCont
     return context ? instrumentingAgentsForContext(*context) : nullptr;
 }
 
-inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForContext(ScriptExecutionContext& context)
-{
-    if (is<Document>(context))
-        return instrumentingAgentsForPage(downcast<Document>(context).page());
-    if (is<WorkerGlobalScope>(context))
-        return &instrumentingAgentsForWorkerGlobalScope(downcast<WorkerGlobalScope>(context));
-    return nullptr;
-}
-
 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForFrame(const Frame* frame)
 {
     return frame ? instrumentingAgentsForFrame(*frame) : nullptr;
@@ -1666,22 +1655,11 @@ inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForPage
     return page ? &instrumentingAgentsForPage(*page) : nullptr;
 }
 
-inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForPage(Page& page)
-{
-    ASSERT(isMainThread());
-    return page.inspectorController().m_instrumentingAgents.get();
-}
-
 inline InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope* workerGlobalScope)
 {
     return workerGlobalScope ? &instrumentingAgentsForWorkerGlobalScope(*workerGlobalScope) : nullptr;
 }
 
-inline InstrumentingAgents& InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope(WorkerGlobalScope& workerGlobalScope)
-{
-    return workerGlobalScope.inspectorController().m_instrumentingAgents;
-}
-
 inline void InspectorInstrumentation::frontendCreated()
 {
     ASSERT(isMainThread());
index 6265040..2761a52 100644 (file)
 #include <wtf/text/TextStream.h>
 #include <wtf/text/WTFString.h>
 
+#if USE(CG)
+#include <pal/spi/cg/CoreGraphicsSPI.h>
+#endif
+
 namespace WebCore {
 
 BitmapImage::BitmapImage(ImageObserver* observer)
index f8b8233..9f40b31 100644 (file)
 #include <usp10.h>
 #endif
 
-#if USE(CG)
-#include <pal/spi/cg/CoreGraphicsSPI.h>
-#endif
-
 #if USE(DIRECT2D)
 interface IDWriteFactory5;
 interface IDWriteGdiInterop;
index f06fe50..970fd07 100644 (file)
@@ -67,6 +67,11 @@ static void setCGStrokeColor(CGContextRef context, const Color& color)
     CGContextSetStrokeColorWithColor(context, cachedCGColor(color));
 }
 
+inline CGAffineTransform getUserToBaseCTM(CGContextRef context)
+{
+    return CGAffineTransformConcat(CGContextGetCTM(context), CGAffineTransformInvert(CGContextGetBaseCTM(context)));
+}
+
 CGColorSpaceRef sRGBColorSpaceRef()
 {
     static CGColorSpaceRef sRGBColorSpace;
index b6c64f7..d037040 100644 (file)
@@ -36,10 +36,7 @@ WEBCORE_EXPORT CGColorSpaceRef extendedSRGBColorSpaceRef();
 WEBCORE_EXPORT CGColorSpaceRef displayP3ColorSpaceRef();
 WEBCORE_EXPORT CGColorSpaceRef linearRGBColorSpaceRef();
 
-inline CGAffineTransform getUserToBaseCTM(CGContextRef context)
-{
-    return CGAffineTransformConcat(CGContextGetCTM(context), CGAffineTransformInvert(CGContextGetBaseCTM(context)));
-}
+CGAffineTransform getUserToBaseCTM(CGContextRef);
 
 static inline CGColorSpaceRef cachedCGColorSpace(ColorSpace colorSpace)
 {
index 837b877..0f39223 100644 (file)
@@ -40,6 +40,7 @@
 #include <math.h>
 #include <CoreGraphics/CoreGraphics.h>
 #include <ImageIO/ImageIO.h>
+#include <pal/spi/cg/CoreGraphicsSPI.h>
 #include <wtf/Assertions.h>
 #include <wtf/CheckedArithmetic.h>
 #include <wtf/MainThread.h>
index 74b3ec3..9800ca9 100644 (file)
@@ -28,6 +28,7 @@
 #if HAVE(IOSURFACE)
 
 #include <objc/objc.h>
+#include <pal/spi/cocoa/IOSurfaceSPI.h>
 #include "GraphicsContext.h"
 #include "IntSize.h"
 
index 2726bdc..83e6af7 100644 (file)
@@ -32,6 +32,7 @@
 #import "SharedBuffer.h"
 #import <Quartz/Quartz.h>
 #import <objc/objc-class.h>
+#import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/SoftLinking.h>
 
index 77094bc..6d60fad 100644 (file)
@@ -1,3 +1,12 @@
+2019-10-01  Tim Horton  <timothy_horton@apple.com>
+
+        Clean up some includes to make the build a bit faster
+        https://bugs.webkit.org/show_bug.cgi?id=202444
+
+        Reviewed by Geoff Garen.
+
+        * UIProcess/API/Cocoa/_WKThumbnailView.mm:
+
 2019-10-01  Alex Christensen  <achristensen@webkit.org>
 
         Progress towards a functioning CMake build on Mac
index b1ca26b..858597a 100644 (file)
@@ -34,6 +34,7 @@
 #import "WKViewInternal.h"
 #import "WKWebViewInternal.h"
 #import "WebPageProxy.h"
+#import <pal/spi/cg/CoreGraphicsSPI.h>
 
 // FIXME: Make it possible to leave a snapshot of the content presented in the WKView while the thumbnail is live.
 // FIXME: Don't make new speculative tiles while thumbnailed.
index 36680a4..a35b81b 100644 (file)
@@ -1,3 +1,13 @@
+2019-10-01  Tim Horton  <timothy_horton@apple.com>
+
+        Clean up some includes to make the build a bit faster
+        https://bugs.webkit.org/show_bug.cgi?id=202444
+
+        Reviewed by Geoff Garen.
+
+        * WebView/WebFrame.mm:
+        * WebView/WebView.mm:
+
 2019-10-01  Antti Koivisto  <antti@apple.com>
 
         [CSS Shadow Parts] Parse 'part' attribute
index 7481532..4a4a400 100644 (file)
 #import <WebCore/ThreadCheck.h>
 #import <WebCore/VisibleUnits.h>
 #import <WebCore/markup.h>
+#import <pal/spi/cg/CoreGraphicsSPI.h>
 
 #if PLATFORM(IOS_FAMILY)
 #import "WebMailDelegate.h"
index c91229c..d8dacd9 100644 (file)
 #import <objc/runtime.h>
 #import <pal/spi/cf/CFNetworkSPI.h>
 #import <pal/spi/cf/CFUtilitiesSPI.h>
+#import <pal/spi/cg/CoreGraphicsSPI.h>
 #import <pal/spi/cocoa/NSTouchBarSPI.h>
 #import <pal/spi/cocoa/NSURLDownloadSPI.h>
 #import <pal/spi/cocoa/NSURLFileTypeMappingsSPI.h>