Title: [275103] trunk/Source
Revision
275103
Author
[email protected]
Date
2021-03-26 10:08:07 -0700 (Fri, 26 Mar 2021)

Log Message

Allow logging minimal info about uploading media files in the system diagnose
https://bugs.webkit.org/show_bug.cgi?id=223706

Reviewed by Alex Christensen.

Source/WebCore:

Give the WebKit client the ability to log info about the media files which
were submitted to a web server through an HTMLFormElement.

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):
* loader/EmptyClients.cpp:
* page/DiagnosticLoggingClient.h:
* page/DiagnosticLoggingDomain.h: Copied from Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h.

Source/WebKit:

Add the new method logDiagnosticMessageWithDomain to the modern ObjC API
WKDiagnosticLoggingDelegate and make it accessible from DiagnosticLoggingClient.

* Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
* UIProcess/API/APIDiagnosticLoggingClient.h:
(API::DiagnosticLoggingClient::logDiagnosticMessageWithDomain):
* UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
* UIProcess/Cocoa/DiagnosticLoggingClient.h:
* UIProcess/Cocoa/DiagnosticLoggingClient.mm:
(WebKit::DiagnosticLoggingClient::setDelegate):
(WebKit::toWKDiagnosticLoggingDomain):
(WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithDomain):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::logDiagnosticMessageWithDomain):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
(WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithDomain):
* WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275102 => 275103)


--- trunk/Source/WebCore/ChangeLog	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebCore/ChangeLog	2021-03-26 17:08:07 UTC (rev 275103)
@@ -1,3 +1,21 @@
+2021-03-26  Said Abou-Hallawa  <[email protected]>
+
+        Allow logging minimal info about uploading media files in the system diagnose
+        https://bugs.webkit.org/show_bug.cgi?id=223706
+
+        Reviewed by Alex Christensen.
+
+        Give the WebKit client the ability to log info about the media files which
+        were submitted to a web server through an HTMLFormElement.
+
+        * Headers.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::submit):
+        * loader/EmptyClients.cpp:
+        * page/DiagnosticLoggingClient.h:
+        * page/DiagnosticLoggingDomain.h: Copied from Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h.
+
 2021-03-26  Imanol Fernandez  <[email protected]>
 
         Implement cachedPropertyValue for WebXR [SameObject] attributes

Modified: trunk/Source/WebCore/Headers.cmake (275102 => 275103)


--- trunk/Source/WebCore/Headers.cmake	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebCore/Headers.cmake	2021-03-26 17:08:07 UTC (rev 275103)
@@ -870,6 +870,7 @@
     page/DeprecatedGlobalSettings.h
     page/DeviceClient.h
     page/DiagnosticLoggingClient.h
+    page/DiagnosticLoggingDomain.h
     page/DiagnosticLoggingKeys.h
     page/DiagnosticLoggingResultType.h
     page/DisabledAdaptations.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (275102 => 275103)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-26 17:08:07 UTC (rev 275103)
@@ -2224,6 +2224,7 @@
 		729D05302531424300422098 /* RenderingResourceIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 729D052E25313E2600422098 /* RenderingResourceIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		72A73BEF245A3F90001C9D03 /* AnimationFrameRate.h in Headers */ = {isa = PBXBuildFile; fileRef = 722A815C238FD50500C00583 /* AnimationFrameRate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		72BAC3AE23E1F0B0008D741C /* ImageBufferBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3A523E17328008D741C /* ImageBufferBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		72F667E1260C26AC00EE36AD /* DiagnosticLoggingDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F667DF260C264400EE36AD /* DiagnosticLoggingDomain.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; };
 		75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793E810D0CE0B3007FC0AC /* MessageEvent.h */; };
 		75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793EC70D0CE72D007FC0AC /* JSMessageEvent.h */; };
@@ -10256,6 +10257,7 @@
 		72F1ADA11A3904C300014E18 /* EXTFragDepth.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTFragDepth.idl; sourceTree = "<group>"; };
 		72F1ADA31A390B9F00014E18 /* JSEXTFragDepth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTFragDepth.cpp; sourceTree = "<group>"; };
 		72F1ADA41A390B9F00014E18 /* JSEXTFragDepth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTFragDepth.h; sourceTree = "<group>"; };
+		72F667DF260C264400EE36AD /* DiagnosticLoggingDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingDomain.h; sourceTree = "<group>"; };
 		72FB238422497AD4007E5AC7 /* SVGValuePropertyAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyAnimatorImpl.h; sourceTree = "<group>"; };
 		72FB238622497AD5007E5AC7 /* SVGValuePropertyAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyAnimator.h; sourceTree = "<group>"; };
 		72FB238722497B15007E5AC7 /* SVGValuePropertyListAnimatorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGValuePropertyListAnimatorImpl.h; sourceTree = "<group>"; };
@@ -22194,6 +22196,7 @@
 				CCC2B51115F613060048CDD6 /* DeviceController.cpp */,
 				CCC2B51215F613060048CDD6 /* DeviceController.h */,
 				CD19A2671A13E700008D650E /* DiagnosticLoggingClient.h */,
+				72F667DF260C264400EE36AD /* DiagnosticLoggingDomain.h */,
 				CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */,
 				CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */,
 				8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */,
@@ -32083,6 +32086,7 @@
 				26A517FE1AB92238006335DF /* DFAMinimizer.h in Headers */,
 				267725FF1A5B3AD9003C24DD /* DFANode.h in Headers */,
 				CD19A2681A13E700008D650E /* DiagnosticLoggingClient.h in Headers */,
+				72F667E1260C26AC00EE36AD /* DiagnosticLoggingDomain.h in Headers */,
 				46FCB6181A70820E00C5A21E /* DiagnosticLoggingKeys.h in Headers */,
 				8372DB311A6780A800C697C5 /* DiagnosticLoggingResultType.h in Headers */,
 				CECADFC7153778FF00E37068 /* DictationAlternative.h in Headers */,

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (275102 => 275103)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2021-03-26 17:08:07 UTC (rev 275103)
@@ -27,6 +27,7 @@
 
 #include "DOMFormData.h"
 #include "DOMWindow.h"
+#include "DiagnosticLoggingClient.h"
 #include "Document.h"
 #include "ElementIterator.h"
 #include "Event.h"
@@ -44,6 +45,7 @@
 #include "HTMLObjectElement.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLTableElement.h"
+#include "MIMETypeRegistry.h"
 #include "MixedContentChecker.h"
 #include "NodeRareData.h"
 #include "Page.h"
@@ -368,6 +370,18 @@
     auto formSubmission = FormSubmission::create(*this, m_attributes, event, shouldLockHistory, formSubmissionTrigger);
     if (m_plannedFormSubmission)
         m_plannedFormSubmission->cancel();
+
+    unsigned imageOrMediaFiles = 0;
+    for (auto& dataElement : formSubmission->data().elements()) {
+        auto* encodedFileData = WTF::get_if<FormDataElement::EncodedFileData>(dataElement.data);
+        if (!encodedFileData)
+            continue;
+
+        auto mimeType = MIMETypeRegistry::mimeTypeForPath(encodedFileData->filename);
+        if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType) || MIMETypeRegistry::isSupportedMediaMIMEType(mimeType))
+            ++imageOrMediaFiles;
+    }
+
     m_plannedFormSubmission = makeWeakPtr(formSubmission.get());
     frame->loader().submitForm(WTFMove(formSubmission));
 
@@ -374,6 +388,12 @@
     if (needButtonActivation && firstSuccessfulSubmitButton)
         firstSuccessfulSubmitButton->setActivatedSubmit(false);
 
+    if (imageOrMediaFiles) {
+        auto& diagnosticLoggingClient = document().page()->diagnosticLoggingClient();
+        auto message = makeString(imageOrMediaFiles, imageOrMediaFiles == 1 ? " media file has been submitted" : " media files have been submitted");
+        diagnosticLoggingClient.logDiagnosticMessageWithDomain(message, DiagnosticLoggingDomain::Media);
+    }
+
     m_shouldSubmit = false;
     m_isSubmittingOrPreparingForSubmission = false;
 }

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (275102 => 275103)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2021-03-26 17:08:07 UTC (rev 275103)
@@ -207,6 +207,7 @@
     void logDiagnosticMessageWithValue(const String&, const String&, double, unsigned, ShouldSample) final { }
     void logDiagnosticMessageWithEnhancedPrivacy(const String&, const String&, ShouldSample) final { }
     void logDiagnosticMessageWithValueDictionary(const String&, const String&, const ValueDictionary&, ShouldSample) final { }
+    void logDiagnosticMessageWithDomain(const String&, DiagnosticLoggingDomain) final { };
 };
 
 #if ENABLE(DRAG_SUPPORT)

Modified: trunk/Source/WebCore/page/DiagnosticLoggingClient.h (275102 => 275103)


--- trunk/Source/WebCore/page/DiagnosticLoggingClient.h	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebCore/page/DiagnosticLoggingClient.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "DiagnosticLoggingDomain.h"
 #include "DiagnosticLoggingResultType.h"
 #include <wtf/FastMalloc.h>
 #include <wtf/HashMap.h>
@@ -48,6 +49,7 @@
     using ValueDictionary = HashMap<String, ValuePayload>;
 
     virtual void logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const ValueDictionary&, ShouldSample) = 0;
+    virtual void logDiagnosticMessageWithDomain(const String& message, DiagnosticLoggingDomain) = 0;
 
     static bool shouldLogAfterSampling(ShouldSample);
 

Copied: trunk/Source/WebCore/page/DiagnosticLoggingDomain.h (from rev 275102, trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h) (0 => 275103)


--- trunk/Source/WebCore/page/DiagnosticLoggingDomain.h	                        (rev 0)
+++ trunk/Source/WebCore/page/DiagnosticLoggingDomain.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class DiagnosticLoggingDomain : uint8_t { Media };
+
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::DiagnosticLoggingDomain> {
+    using values = EnumValues<
+        WebCore::DiagnosticLoggingDomain,
+        WebCore::DiagnosticLoggingDomain::Media
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebKit/ChangeLog (275102 => 275103)


--- trunk/Source/WebKit/ChangeLog	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/ChangeLog	2021-03-26 17:08:07 UTC (rev 275103)
@@ -1,3 +1,31 @@
+2021-03-26  Said Abou-Hallawa  <[email protected]>
+
+        Allow logging minimal info about uploading media files in the system diagnose
+        https://bugs.webkit.org/show_bug.cgi?id=223706
+
+        Reviewed by Alex Christensen.
+
+        Add the new method logDiagnosticMessageWithDomain to the modern ObjC API
+        WKDiagnosticLoggingDelegate and make it accessible from DiagnosticLoggingClient.
+
+        * Scripts/webkit/messages.py:
+        (types_that_cannot_be_forward_declared):
+        * UIProcess/API/APIDiagnosticLoggingClient.h:
+        (API::DiagnosticLoggingClient::logDiagnosticMessageWithDomain):
+        * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
+        * UIProcess/Cocoa/DiagnosticLoggingClient.h:
+        * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
+        (WebKit::DiagnosticLoggingClient::setDelegate):
+        (WebKit::toWKDiagnosticLoggingDomain):
+        (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithDomain):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::logDiagnosticMessageWithDomain):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
+        (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithDomain):
+        * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
+
 2021-03-26  Jer Noble  <[email protected]>
 
         [Cocoa] Enable the UseGPUProcessForMedia preference by default

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (275102 => 275103)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2021-03-26 17:08:07 UTC (rev 275103)
@@ -271,6 +271,7 @@
         'MediaTime',
         'String',
         'WebCore::DestinationColorSpace',
+        'WebCore::DiagnosticLoggingDomain',
         'WebCore::DictationContext',
         'WebCore::DisplayList::FlushIdentifier',
         'WebCore::DisplayList::ItemBufferIdentifier',

Modified: trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/API/APIDiagnosticLoggingClient.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include <WebCore/DiagnosticLoggingDomain.h>
 #include <WebCore/DiagnosticLoggingResultType.h>
 #include <wtf/text/WTFString.h>
 
@@ -47,6 +48,8 @@
     virtual void logDiagnosticMessageWithEnhancedPrivacy(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description) = 0;
 
     virtual void logDiagnosticMessageWithValueDictionary(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, Ref<API::Dictionary>&&) = 0;
+
+    virtual void logDiagnosticMessageWithDomain(WebKit::WebPageProxy*, const WTF::String&, WebCore::DiagnosticLoggingDomain) { }
 };
 
 } // namespace API

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -33,6 +33,10 @@
     _WKDiagnosticLoggingResultNoop,
 } WK_API_AVAILABLE(macos(10.11), ios(9.0));
 
+typedef NS_ENUM(NSInteger, _WKDiagnosticLoggingDomain) {
+    _WKDiagnosticLoggingDomainMedia,
+} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 @class WKWebView;
 
 @protocol _WKDiagnosticLoggingDelegate <NSObject>
@@ -43,5 +47,6 @@
 - (void)_webView:(WKWebView *)webView logDiagnosticMessageWithValue:(NSString *)message description:(NSString *)description value:(NSString *) value;
 - (void)_webView:(WKWebView *)webView logDiagnosticMessageWithEnhancedPrivacy:(NSString *)message description:(NSString *)description WK_API_AVAILABLE(macos(10.13), ios(11.0));
 - (void)_webView:(WKWebView *)webView logDiagnosticMessage:(NSString *)message description:(NSString *)description valueDictionary:(NSDictionary *)valueDictionary WK_API_AVAILABLE(macos(10.15), ios(13.0));
+- (void)_webView:(WKWebView *)webView logDiagnosticMessageWithDomain:(NSString *)message domain:(_WKDiagnosticLoggingDomain)domain WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end

Modified: trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -29,6 +29,7 @@
 #import "WKFoundation.h"
 
 #import "APIDiagnosticLoggingClient.h"
+#import <WebCore/DiagnosticLoggingDomain.h>
 #import <WebCore/DiagnosticLoggingResultType.h>
 #import <wtf/WeakObjCPtr.h>
 
@@ -52,6 +53,7 @@
     void logDiagnosticMessageWithValue(WebPageProxy*, const String& message, const String& description, const String& value) override;
     void logDiagnosticMessageWithEnhancedPrivacy(WebPageProxy*, const String& message, const String& description) override;
     void logDiagnosticMessageWithValueDictionary(WebPageProxy*, const String& message, const String& description, Ref<API::Dictionary>&&) override;
+    void logDiagnosticMessageWithDomain(WebPageProxy*, const String& message, WebCore::DiagnosticLoggingDomain) override;
 
     WKWebView *m_webView;
     WeakObjCPtr<id <_WKDiagnosticLoggingDelegate>> m_delegate;
@@ -62,6 +64,7 @@
         unsigned webviewLogDiagnosticMessageWithValue : 1;
         unsigned webviewLogDiagnosticMessageWithEnhancedPrivacy : 1;
         unsigned webviewLogDiagnosticMessageWithValueDictionary : 1;
+        unsigned webviewLogDiagnosticMessageWithDomain : 1;
     } m_delegateMethods;
 };
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.mm (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.mm	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DiagnosticLoggingClient.mm	2021-03-26 17:08:07 UTC (rev 275103)
@@ -51,6 +51,7 @@
     m_delegateMethods.webviewLogDiagnosticMessageWithValue = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithValue:description:value:)];
     m_delegateMethods.webviewLogDiagnosticMessageWithEnhancedPrivacy = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithEnhancedPrivacy:description:)];
     m_delegateMethods.webviewLogDiagnosticMessageWithValueDictionary = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessage:description:valueDictionary:)];
+    m_delegateMethods.webviewLogDiagnosticMessageWithDomain = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithDomain:domain:)];
 }
 
 void DiagnosticLoggingClient::logDiagnosticMessage(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description)
@@ -71,6 +72,14 @@
     }
 }
 
+static _WKDiagnosticLoggingDomain toWKDiagnosticLoggingDomain(WebCore::DiagnosticLoggingDomain domain)
+{
+    switch (domain) {
+    case WebCore::DiagnosticLoggingDomain::Media:
+        return _WKDiagnosticLoggingDomainMedia;
+    }
+}
+
 void DiagnosticLoggingClient::logDiagnosticMessageWithResult(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, WebCore::DiagnosticLoggingResultType result)
 {
     if (m_delegateMethods.webviewLogDiagnosticMessageWithResult)
@@ -95,5 +104,10 @@
         [m_delegate.get() _webView:m_webView logDiagnosticMessage:message description:description valueDictionary:static_cast<NSDictionary*>(valueDictionary->wrapper())];
 }
 
+void DiagnosticLoggingClient::logDiagnosticMessageWithDomain(WebPageProxy*, const String& message, WebCore::DiagnosticLoggingDomain domain)
+{
+    if (m_delegateMethods.webviewLogDiagnosticMessageWithDomain)
+        [m_delegate.get() _webView:m_webView logDiagnosticMessageWithDomain:message domain:toWKDiagnosticLoggingDomain(domain)];
+}
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-26 17:08:07 UTC (rev 275103)
@@ -7218,6 +7218,15 @@
     effectiveClient->logDiagnosticMessageWithValueDictionary(this, message, description, WTFMove(apiDictionary));
 }
 
+void WebPageProxy::logDiagnosticMessageWithDomain(const String& message, WebCore::DiagnosticLoggingDomain domain)
+{
+    auto* effectiveClient = effectiveDiagnosticLoggingClient(ShouldSample::No);
+    if (!effectiveClient)
+        return;
+
+    effectiveClient->logDiagnosticMessageWithDomain(this, message, domain);
+}
+
 void WebPageProxy::logScrollingEvent(uint32_t eventType, MonotonicTime timestamp, uint64_t data)
 {
     PerformanceLoggingClient::ScrollingEvent event = static_cast<PerformanceLoggingClient::ScrollingEvent>(eventType);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -1519,6 +1519,7 @@
     void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample);
     void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample);
     void logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const WebCore::DiagnosticLoggingClient::ValueDictionary&, WebCore::ShouldSample);
+    void logDiagnosticMessageWithDomain(const String& message, WebCore::DiagnosticLoggingDomain);
 
     // Performance logging.
     void logScrollingEvent(uint32_t eventType, MonotonicTime, uint64_t);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (275102 => 275103)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2021-03-26 17:08:07 UTC (rev 275103)
@@ -211,6 +211,7 @@
     LogDiagnosticMessageWithValue(String message, String description, double value, unsigned significantFigures, enum:bool WebCore::ShouldSample shouldSample)
     LogDiagnosticMessageWithEnhancedPrivacy(String message, String description, enum:bool WebCore::ShouldSample shouldSample)
     LogDiagnosticMessageWithValueDictionary(String message, String description, WebCore::DiagnosticLoggingClient::ValueDictionary value, enum:bool WebCore::ShouldSample shouldSample)
+    LogDiagnosticMessageWithDomain(String message, WebCore::DiagnosticLoggingDomain domain)
 
     # Performance logging
     LogScrollingEvent(uint32_t eventType, MonotonicTime timestamp, uint64_t data)

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp (275102 => 275103)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp	2021-03-26 17:08:07 UTC (rev 275103)
@@ -93,4 +93,11 @@
     m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithValueDictionary(message, description, value, ShouldSample::No));
 }
 
+void WebDiagnosticLoggingClient::logDiagnosticMessageWithDomain(const String& message, WebCore::DiagnosticLoggingDomain domain)
+{
+    ASSERT(!m_page.corePage() || m_page.corePage()->settings().diagnosticLoggingEnabled());
+
+    m_page.send(Messages::WebPageProxy::LogDiagnosticMessageWithDomain(message, domain));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h (275102 => 275103)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h	2021-03-26 16:41:27 UTC (rev 275102)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h	2021-03-26 17:08:07 UTC (rev 275103)
@@ -43,6 +43,7 @@
     void logDiagnosticMessageWithValue(const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample) override;
     void logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, WebCore::ShouldSample) override;
     void logDiagnosticMessageWithValueDictionary(const String& message, const String& description, const ValueDictionary&, WebCore::ShouldSample) override;
+    void logDiagnosticMessageWithDomain(const String& message, WebCore::DiagnosticLoggingDomain) override;
 
     WebPage& m_page;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to