[WK2] Stop using WKDiagnosticLoggingResultType.h C API header in Cocoa API
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jan 2015 18:55:00 +0000 (18:55 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jan 2015 18:55:00 +0000 (18:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140655

Reviewed by Anders Carlsson.

Stop using WKDiagnosticLoggingResultType.h C API header in Cocoa API.
Instead, introduce a new _WKDiagnosticLoggingResultType enum in
_WKDiagnosticLoggingDelegate.h.

A few defines mapping WKDiagnosticLoggingResultType enum and its values
to the new _WKDiagnosticLoggingResultType are temporarily added until
the client-side is transitioned.

* UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
* UIProcess/Cocoa/DiagnosticLoggingClient.mm:
(WebKit::toWKDiagnosticLoggingResultType):
(WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithResult):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h
Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.mm

index 597a4c5..ae8a80f 100644 (file)
@@ -1,3 +1,23 @@
+2015-01-21  Chris Dumez  <cdumez@apple.com>
+
+        [WK2] Stop using WKDiagnosticLoggingResultType.h C API header in Cocoa API
+        https://bugs.webkit.org/show_bug.cgi?id=140655
+
+        Reviewed by Anders Carlsson.
+
+        Stop using WKDiagnosticLoggingResultType.h C API header in Cocoa API.
+        Instead, introduce a new _WKDiagnosticLoggingResultType enum in
+        _WKDiagnosticLoggingDelegate.h.
+
+        A few defines mapping WKDiagnosticLoggingResultType enum and its values
+        to the new _WKDiagnosticLoggingResultType are temporarily added until
+        the client-side is transitioned.
+
+        * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
+        * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
+        (WebKit::toWKDiagnosticLoggingResultType):
+        (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithResult):
+
 2015-01-21  Zan Dobersek  <zdobersek@igalia.com>
 
         [WK2] Use C++ lambdas in ProcessLauncher class
index 10ec856..abe64cb 100644 (file)
 #if WK_API_ENABLED
 
 #import <Foundation/Foundation.h>
-#import <WebKit/WKDiagnosticLoggingResultType.h>
+
+typedef NS_ENUM(NSInteger, _WKDiagnosticLoggingResultType) {
+    _WKDiagnosticLoggingResultPass,
+    _WKDiagnosticLoggingResultFail,
+    _WKDiagnosticLoggingResultNoop,
+} WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
+// FIXME: Remove these once the client-side has been ported.
+#define WKDiagnosticLoggingResultType _WKDiagnosticLoggingResultType
+#define kWKDiagnosticLoggingResultPass _WKDiagnosticLoggingResultPass
+#define kWKDiagnosticLoggingResultFail _WKDiagnosticLoggingResultFail
+#define kWKDiagnosticLoggingResultNoop _WKDiagnosticLoggingResultNoop
 
 @protocol _WKDiagnosticLoggingDelegate <NSObject>
 @optional
 
 - (void)_webView:(WKWebView *)webView logDiagnosticMessage:(NSString *)message description:(NSString *)description;
-- (void)_webView:(WKWebView *)webView logDiagnosticMessageWithResult:(NSString *)message description:(NSString *)description result:(WKDiagnosticLoggingResultType)result;
+- (void)_webView:(WKWebView *)webView logDiagnosticMessageWithResult:(NSString *)message description:(NSString *)description result:(_WKDiagnosticLoggingResultType)result;
 - (void)_webView:(WKWebView *)webView logDiagnosticMessageWithValue:(NSString *)message description:(NSString *)description value:(NSString *) value;
 
 @end
index e70e8e6..2308dba 100644 (file)
@@ -58,10 +58,22 @@ void DiagnosticLoggingClient::logDiagnosticMessage(WebKit::WebPageProxy*, const
         [m_delegate.get() _webView:m_webView logDiagnosticMessage:message description:description];
 }
 
+static _WKDiagnosticLoggingResultType toWKDiagnosticLoggingResultType(WebCore::DiagnosticLoggingResultType result)
+{
+    switch (result) {
+    case WebCore::DiagnosticLoggingResultPass:
+        return _WKDiagnosticLoggingResultPass;
+    case WebCore::DiagnosticLoggingResultFail:
+        return _WKDiagnosticLoggingResultFail;
+    case WebCore::DiagnosticLoggingResultNoop:
+        return _WKDiagnosticLoggingResultNoop;
+    }
+}
+
 void DiagnosticLoggingClient::logDiagnosticMessageWithResult(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, WebCore::DiagnosticLoggingResultType result)
 {
     if (m_delegateMethods.webviewLogDiagnosticMessageWithResult)
-        [m_delegate.get() _webView:m_webView logDiagnosticMessageWithResult:message description:description result:toAPI(result)];
+        [m_delegate.get() _webView:m_webView logDiagnosticMessageWithResult:message description:description result:toWKDiagnosticLoggingResultType(result)];
 }
 
 void DiagnosticLoggingClient::logDiagnosticMessageWithValue(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, const WTF::String& value)