Diff
Modified: trunk/Source/WebKit2/ChangeLog (178629 => 178630)
--- trunk/Source/WebKit2/ChangeLog 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/ChangeLog 2015-01-18 01:41:15 UTC (rev 178630)
@@ -1,3 +1,48 @@
+2015-01-17 Chris Dumez <cdu...@apple.com>
+
+ [WK2][iOS] Add Cocoa delegate for logging diagnostic messages
+ https://bugs.webkit.org/show_bug.cgi?id=140410
+
+ Reviewed by Sam Weinig.
+
+ Add Cocoa delegate for logging diagnostic messages.
+
+ * UIProcess/API/APIDiagnosticLoggingClient.h: Copied from Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h.
+ (API::DiagnosticLoggingClient::~DiagnosticLoggingClient):
+ (API::DiagnosticLoggingClient::logDiagnosticMessage):
+ (API::DiagnosticLoggingClient::logDiagnosticMessageWithResult):
+ (API::DiagnosticLoggingClient::logDiagnosticMessageWithValue):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageDiagnosticLoggingClient):
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ (-[WKWebView _diagnosticLoggingDelegate]):
+ (-[WKWebView _setDiagnosticLoggingDelegate:]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h: Copied from Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h.
+ * UIProcess/Cocoa/DiagnosticLoggingClient.h: Copied from Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h.
+ * UIProcess/Cocoa/DiagnosticLoggingClient.mm: Added.
+ (WebKit::DiagnosticLoggingClient::DiagnosticLoggingClient):
+ (WebKit::DiagnosticLoggingClient::delegate):
+ (WebKit::DiagnosticLoggingClient::setDelegate):
+ (WebKit::DiagnosticLoggingClient::logDiagnosticMessage):
+ (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithResult):
+ (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValue):
+ * UIProcess/WebPageDiagnosticLoggingClient.cpp:
+ (WebKit::WebPageDiagnosticLoggingClient::WebPageDiagnosticLoggingClient):
+ * UIProcess/WebPageDiagnosticLoggingClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::setDiagnosticLoggingClient):
+ (WebKit::WebPageProxy::close):
+ (WebKit::WebPageProxy::logDiagnosticMessage):
+ (WebKit::WebPageProxy::logDiagnosticMessageWithResult):
+ (WebKit::WebPageProxy::logDiagnosticMessageWithValue):
+ (WebKit::WebPageProxy::initializeDiagnosticLoggingClient): Deleted.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::diagnosticLoggingClient):
+ * WebKit2.xcodeproj/project.pbxproj:
+
2015-01-17 David Kilzer <ddkil...@apple.com>
REGRESSION (r178618): Change to WKWebViewConfiguration broke iOS build
Copied: trunk/Source/WebKit2/UIProcess/API/APIDiagnosticLoggingClient.h (from rev 178629, trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h) (0 => 178630)
--- trunk/Source/WebKit2/UIProcess/API/APIDiagnosticLoggingClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIDiagnosticLoggingClient.h 2015-01-18 01:41:15 UTC (rev 178630)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef APIDiagnosticLoggingClient_h
+#define APIDiagnosticLoggingClient_h
+
+#include <WebCore/DiagnosticLoggingResultType.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+class WebPageProxy;
+}
+
+namespace API {
+
+class DiagnosticLoggingClient {
+public:
+ virtual ~DiagnosticLoggingClient() { }
+
+ virtual void logDiagnosticMessage(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description) { UNUSED_PARAM(message); UNUSED_PARAM(description); }
+ virtual void logDiagnosticMessageWithResult(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, WebCore::DiagnosticLoggingResultType) { UNUSED_PARAM(message); UNUSED_PARAM(description); }
+ virtual void logDiagnosticMessageWithValue(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, const WTF::String& value) { UNUSED_PARAM(message); UNUSED_PARAM(description); UNUSED_PARAM(value); }
+};
+
+} // namespace API
+
+#endif // APIDiagnosticLoggingClient_h
+
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-01-18 01:41:15 UTC (rev 178630)
@@ -729,7 +729,7 @@
void WKPageSetPageDiagnosticLoggingClient(WKPageRef pageRef, const WKPageDiagnosticLoggingClientBase* wkClient)
{
- toImpl(pageRef)->initializeDiagnosticLoggingClient(wkClient);
+ toImpl(pageRef)->setDiagnosticLoggingClient(std::make_unique<WebPageDiagnosticLoggingClient>(wkClient));
}
void WKPageSetPageFindClient(WKPageRef pageRef, const WKPageFindClientBase* wkClient)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-01-18 01:41:15 UTC (rev 178630)
@@ -31,6 +31,7 @@
#import "APIFormClient.h"
#import "APISerializedScriptValue.h"
#import "CompletionHandlerCallChecker.h"
+#import "DiagnosticLoggingClient.h"
#import "FindClient.h"
#import "LegacySessionStateCoding.h"
#import "NavigationState.h"
@@ -66,6 +67,7 @@
#import "WebPreferencesKeys.h"
#import "WebProcessPool.h"
#import "WebProcessProxy.h"
+#import "_WKDiagnosticLoggingDelegate.h"
#import "_WKFindDelegate.h"
#import "_WKFormDelegate.h"
#import "_WKRemoteObjectRegistryInternal.h"
@@ -362,6 +364,7 @@
_page->setUIClient(_uiDelegate->createUIClient());
_page->setFindClient(std::make_unique<WebKit::FindClient>(self));
+ _page->setDiagnosticLoggingClient(std::make_unique<WebKit::DiagnosticLoggingClient>(self));
pageToViewMap().add(_page.get(), self);
@@ -1970,6 +1973,16 @@
_page->setPageZoomFactor(zoomFactor);
}
+- (id <_WKDiagnosticLoggingDelegate>)_diagnosticLoggingDelegate
+{
+ return [static_cast<WebKit::DiagnosticLoggingClient&>(_page->diagnosticLoggingClient()).delegate().leakRef() autorelease];
+}
+
+- (void)_setDiagnosticLoggingDelegate:(id<_WKDiagnosticLoggingDelegate>)diagnosticLoggingDelegate
+{
+ static_cast<WebKit::DiagnosticLoggingClient&>(_page->diagnosticLoggingClient()).setDelegate(diagnosticLoggingDelegate);
+}
+
- (id <_WKFindDelegate>)_findDelegate
{
return [static_cast<WebKit::FindClient&>(_page->findClient()).delegate().leakRef() autorelease];
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-01-18 01:41:15 UTC (rev 178630)
@@ -55,6 +55,7 @@
@class _WKWebViewPrintFormatter;
@protocol WKHistoryDelegatePrivate;
+@protocol _WKDiagnosticLoggingDelegate;
@protocol _WKFindDelegate;
@protocol _WKFormDelegate;
@@ -175,6 +176,7 @@
@property (nonatomic, setter=_setTextZoomFactor:) double _textZoomFactor;
@property (nonatomic, setter=_setPageZoomFactor:) double _pageZoomFactor;
+@property (nonatomic, weak, setter=_setDiagnosticLoggingDelegate:) id <_WKDiagnosticLoggingDelegate> _diagnosticLoggingDelegate WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
@property (nonatomic, weak, setter=_setFindDelegate:) id <_WKFindDelegate> _findDelegate;
- (void)_findString:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
- (void)_countStringMatches:(NSString *)string options:(_WKFindOptions)options maxCount:(NSUInteger)maxCount;
Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h (from rev 178629, trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h) (0 => 178630)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h 2015-01-18 01:41:15 UTC (rev 178630)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+#import <WebKit/WKDiagnosticLoggingResultType.h>
+
+@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 logDiagnosticMessageWithValue:(NSString *)message description:(NSString *)description value:(NSString *) value;
+
+@end
+
+#endif // WK_API_ENABLED
+
Copied: trunk/Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.h (from rev 178629, trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h) (0 => 178630)
--- trunk/Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.h 2015-01-18 01:41:15 UTC (rev 178630)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef DiagnosticLoggingClient_h
+#define DiagnosticLoggingClient_h
+
+#import "WKFoundation.h"
+
+#if WK_API_ENABLED
+
+#import "APIDiagnosticLoggingClient.h"
+#import "WeakObjCPtr.h"
+#import <WebCore/DiagnosticLoggingResultType.h>
+
+@class WKWebView;
+@protocol _WKDiagnosticLoggingDelegate;
+
+namespace WebKit {
+
+class DiagnosticLoggingClient final : public API::DiagnosticLoggingClient {
+public:
+ explicit DiagnosticLoggingClient(WKWebView *);
+
+ RetainPtr<id <_WKDiagnosticLoggingDelegate>> delegate();
+ void setDelegate(id <_WKDiagnosticLoggingDelegate>);
+
+private:
+ // From API::DiagnosticLoggingClient
+ virtual void logDiagnosticMessage(WebPageProxy*, const String& message, const String& description) override;
+ virtual void logDiagnosticMessageWithResult(WebPageProxy*, const String& message, const String& description, WebCore::DiagnosticLoggingResultType) override;
+ virtual void logDiagnosticMessageWithValue(WebPageProxy*, const String& message, const String& description, const String& value) override;
+
+ WKWebView *m_webView;
+ WeakObjCPtr<id <_WKDiagnosticLoggingDelegate>> m_delegate;
+
+ struct {
+ unsigned webviewLogDiagnosticMessage : 1;
+ unsigned webviewLogDiagnosticMessageWithResult : 1;
+ unsigned webviewLogDiagnosticMessageWithValue : 1;
+ } m_delegateMethods;
+};
+
+} // WebKit
+
+#endif // WK_API_ENABLED
+
+#endif // DiagnosticLoggingClient_h
+
Added: trunk/Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.mm (0 => 178630)
--- trunk/Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/DiagnosticLoggingClient.mm 2015-01-18 01:41:15 UTC (rev 178630)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+#import "DiagnosticLoggingClient.h"
+
+#if WK_API_ENABLED
+
+#import "WKSharedAPICast.h"
+#import "_WKDiagnosticLoggingDelegate.h"
+
+namespace WebKit {
+
+DiagnosticLoggingClient::DiagnosticLoggingClient(WKWebView *webView)
+ : m_webView(webView)
+{
+}
+
+RetainPtr<id <_WKDiagnosticLoggingDelegate>> DiagnosticLoggingClient::delegate()
+{
+ return m_delegate.get();
+}
+
+void DiagnosticLoggingClient::setDelegate(id <_WKDiagnosticLoggingDelegate> delegate)
+{
+ m_delegate = delegate;
+
+ m_delegateMethods.webviewLogDiagnosticMessage = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessage:description:)];
+ m_delegateMethods.webviewLogDiagnosticMessageWithResult = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithResult:description:result:)];
+ m_delegateMethods.webviewLogDiagnosticMessageWithValue = [delegate respondsToSelector:@selector(_webView:logDiagnosticMessageWithValue:description:value:)];
+}
+
+void DiagnosticLoggingClient::logDiagnosticMessage(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description)
+{
+ if (m_delegateMethods.webviewLogDiagnosticMessage)
+ [m_delegate.get() _webView:m_webView logDiagnosticMessage:message description:description];
+}
+
+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)];
+}
+
+void DiagnosticLoggingClient::logDiagnosticMessageWithValue(WebKit::WebPageProxy*, const WTF::String& message, const WTF::String& description, const WTF::String& value)
+{
+ if (m_delegateMethods.webviewLogDiagnosticMessageWithValue)
+ [m_delegate.get() _webView:m_webView logDiagnosticMessageWithValue:message description:description value:value];
+}
+
+} // namespace WebKit
+
+#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.cpp (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.cpp 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.cpp 2015-01-18 01:41:15 UTC (rev 178630)
@@ -32,6 +32,11 @@
namespace WebKit {
+WebPageDiagnosticLoggingClient::WebPageDiagnosticLoggingClient(const WKPageDiagnosticLoggingClientBase* client)
+{
+ initialize(client);
+}
+
void WebPageDiagnosticLoggingClient::logDiagnosticMessage(WebPageProxy* page, const String& message, const String& description)
{
if (!m_client.logDiagnosticMessage)
Modified: trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/WebPageDiagnosticLoggingClient.h 2015-01-18 01:41:15 UTC (rev 178630)
@@ -27,6 +27,7 @@
#define WebPageDiagnosticLoggingClient_h
#include "APIClient.h"
+#include "APIDiagnosticLoggingClient.h"
#include "WKPage.h"
#include <WebCore/DiagnosticLoggingResultType.h>
#include <wtf/Forward.h>
@@ -43,11 +44,13 @@
class WebPageProxy;
-class WebPageDiagnosticLoggingClient : public API::Client<WKPageDiagnosticLoggingClientBase> {
+class WebPageDiagnosticLoggingClient final : public API::Client<WKPageDiagnosticLoggingClientBase>, public API::DiagnosticLoggingClient {
public:
- void logDiagnosticMessage(WebPageProxy*, const String& message, const String& description);
- void logDiagnosticMessageWithResult(WebPageProxy*, const String& message, const String& description, WebCore::DiagnosticLoggingResultType);
- void logDiagnosticMessageWithValue(WebPageProxy*, const String& message, const String& description, const String& value);
+ explicit WebPageDiagnosticLoggingClient(const WKPageDiagnosticLoggingClientBase*);
+
+ virtual void logDiagnosticMessage(WebPageProxy*, const String& message, const String& description) override;
+ virtual void logDiagnosticMessageWithResult(WebPageProxy*, const String& message, const String& description, WebCore::DiagnosticLoggingResultType) override;
+ virtual void logDiagnosticMessageWithValue(WebPageProxy*, const String& message, const String& description, const String& value) override;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-01-18 01:41:15 UTC (rev 178630)
@@ -264,6 +264,7 @@
, m_formClient(std::make_unique<API::FormClient>())
, m_uiClient(std::make_unique<API::UIClient>())
, m_findClient(std::make_unique<API::FindClient>())
+ , m_diagnosticLoggingClient(std::make_unique<API::DiagnosticLoggingClient>())
, m_navigationState(std::make_unique<WebNavigationState>())
, m_process(process)
, m_pageGroup(*configuration.pageGroup)
@@ -553,9 +554,14 @@
m_findMatchesClient.initialize(client);
}
-void WebPageProxy::initializeDiagnosticLoggingClient(const WKPageDiagnosticLoggingClientBase* client)
+void WebPageProxy::setDiagnosticLoggingClient(std::unique_ptr<API::DiagnosticLoggingClient> diagnosticLoggingClient)
{
- m_diagnosticLoggingClient.initialize(client);
+ if (!diagnosticLoggingClient) {
+ m_diagnosticLoggingClient = std::make_unique<API::DiagnosticLoggingClient>();
+ return;
+ }
+
+ m_diagnosticLoggingClient = WTF::move(diagnosticLoggingClient);
}
#if ENABLE(CONTEXT_MENUS)
@@ -716,7 +722,7 @@
#endif
m_findClient = std::make_unique<API::FindClient>();
m_findMatchesClient.initialize(nullptr);
- m_diagnosticLoggingClient.initialize(nullptr);
+ m_diagnosticLoggingClient = std::make_unique<API::DiagnosticLoggingClient>();
#if ENABLE(CONTEXT_MENUS)
m_contextMenuClient.initialize(nullptr);
#endif
@@ -4391,17 +4397,17 @@
void WebPageProxy::logDiagnosticMessage(const String& message, const String& description)
{
- m_diagnosticLoggingClient.logDiagnosticMessage(this, message, description);
+ m_diagnosticLoggingClient->logDiagnosticMessage(this, message, description);
}
void WebPageProxy::logDiagnosticMessageWithResult(const String& message, const String& description, uint32_t result)
{
- m_diagnosticLoggingClient.logDiagnosticMessageWithResult(this, message, description, static_cast<WebCore::DiagnosticLoggingResultType>(result));
+ m_diagnosticLoggingClient->logDiagnosticMessageWithResult(this, message, description, static_cast<WebCore::DiagnosticLoggingResultType>(result));
}
void WebPageProxy::logDiagnosticMessageWithValue(const String& message, const String& description, const String& value)
{
- m_diagnosticLoggingClient.logDiagnosticMessageWithValue(this, message, description, value);
+ m_diagnosticLoggingClient->logDiagnosticMessageWithValue(this, message, description, value);
}
void WebPageProxy::rectForCharacterRangeCallback(const IntRect& rect, const EditingRange& actualRange, uint64_t callbackID)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (178629 => 178630)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-01-18 01:41:15 UTC (rev 178630)
@@ -311,8 +311,9 @@
#endif
API::FindClient& findClient() { return *m_findClient; }
void setFindClient(std::unique_ptr<API::FindClient>);
+ API::DiagnosticLoggingClient& diagnosticLoggingClient() { return *m_diagnosticLoggingClient; }
+ void setDiagnosticLoggingClient(std::unique_ptr<API::DiagnosticLoggingClient>);
void initializeFindMatchesClient(const WKPageFindMatchesClientBase*);
- void initializeDiagnosticLoggingClient(const WKPageDiagnosticLoggingClientBase*);
void setFormClient(std::unique_ptr<API::FormClient>);
void setLoaderClient(std::unique_ptr<API::LoaderClient>);
void setPolicyClient(std::unique_ptr<API::PolicyClient>);
@@ -1367,7 +1368,7 @@
#endif
std::unique_ptr<API::FindClient> m_findClient;
WebFindMatchesClient m_findMatchesClient;
- WebPageDiagnosticLoggingClient m_diagnosticLoggingClient;
+ std::unique_ptr<API::DiagnosticLoggingClient> m_diagnosticLoggingClient;
#if ENABLE(CONTEXT_MENUS)
WebPageContextMenuClient m_contextMenuClient;
#endif
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (178629 => 178630)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-01-18 00:20:49 UTC (rev 178629)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-01-18 01:41:15 UTC (rev 178630)
@@ -1119,6 +1119,10 @@
8372DB281A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8372DB261A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp */; };
8372DB291A67562800C697C5 /* WebPageDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB271A67562800C697C5 /* WebPageDiagnosticLoggingClient.h */; };
8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB2E1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 83891B631A68B3420030F386 /* APIDiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */; };
+ 83891B691A68BEBC0030F386 /* _WKDiagnosticLoggingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 83891B681A68BEBC0030F386 /* _WKDiagnosticLoggingDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83891B6A1A68C30B0030F386 /* DiagnosticLoggingClient.h */; };
+ 83891B6D1A68C30B0030F386 /* DiagnosticLoggingClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83891B6B1A68C30B0030F386 /* DiagnosticLoggingClient.mm */; };
84477853176FCC0800CDC7BB /* InjectedBundleHitTestResultMediaType.h in Headers */ = {isa = PBXBuildFile; fileRef = 84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */; };
868160D0187645570021E79D /* WindowServerConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 868160CF187645370021E79D /* WindowServerConnection.mm */; };
86E67A251910B9D100004AB7 /* ProcessThrottler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E67A21190F411800004AB7 /* ProcessThrottler.h */; };
@@ -3241,6 +3245,10 @@
8372DB261A67562800C697C5 /* WebPageDiagnosticLoggingClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageDiagnosticLoggingClient.cpp; sourceTree = "<group>"; };
8372DB271A67562800C697C5 /* WebPageDiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageDiagnosticLoggingClient.h; sourceTree = "<group>"; };
8372DB2E1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDiagnosticLoggingResultType.h; sourceTree = "<group>"; };
+ 83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIDiagnosticLoggingClient.h; sourceTree = "<group>"; };
+ 83891B681A68BEBC0030F386 /* _WKDiagnosticLoggingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDiagnosticLoggingDelegate.h; sourceTree = "<group>"; };
+ 83891B6A1A68C30B0030F386 /* DiagnosticLoggingClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingClient.h; sourceTree = "<group>"; };
+ 83891B6B1A68C30B0030F386 /* DiagnosticLoggingClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DiagnosticLoggingClient.mm; sourceTree = "<group>"; };
84477851176FCAC100CDC7BB /* InjectedBundleHitTestResultMediaType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResultMediaType.h; sourceTree = "<group>"; };
868160CD18763D4B0021E79D /* WindowServerConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowServerConnection.h; sourceTree = "<group>"; };
868160CF187645370021E79D /* WindowServerConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowServerConnection.mm; sourceTree = "<group>"; };
@@ -4730,6 +4738,8 @@
isa = PBXGroup;
children = (
517DD5BB180DA7C40081660B /* Databases */,
+ 83891B6A1A68C30B0030F386 /* DiagnosticLoggingClient.h */,
+ 83891B6B1A68C30B0030F386 /* DiagnosticLoggingClient.mm */,
A1DF631118E0B7C8003A3E2A /* DownloadClient.h */,
A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */,
00B9661818E25AE100CE1F88 /* FindClient.h */,
@@ -5131,6 +5141,7 @@
37A5E01218BBF937000A081E /* _WKActivatedElementInfo.h */,
37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */,
379A873518BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h */,
+ 83891B681A68BEBC0030F386 /* _WKDiagnosticLoggingDelegate.h */,
A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */,
A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */,
A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */,
@@ -6069,6 +6080,7 @@
BC8A501311765F4500757573 /* cpp */,
2DA944771884E3AB00ED86DB /* ios */,
BC111B47112F616900337BAB /* mac */,
+ 83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */,
1F7D36C018DA513F00D9D659 /* APIDownloadClient.h */,
00B9661518E24CBA00CE1F88 /* APIFindClient.h */,
37E25D6D18FDE5D6005D3A00 /* APIFormClient.h */,
@@ -7429,6 +7441,7 @@
1A64229A12DD029200CAAE2C /* DrawingAreaMessages.h in Headers */,
BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */,
1A64230912DD09EB00CAAE2C /* DrawingAreaProxyMessages.h in Headers */,
+ 83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */,
5DA6ED0A1490606900B41D12 /* DynamicLinkerEnvironmentExtractor.h in Headers */,
E105FE5418D7B9DE008F57A8 /* EditingRange.h in Headers */,
1AA41AB512C02EC4002BE67B /* EditorState.h in Headers */,
@@ -7737,6 +7750,7 @@
51834593134532E90092B696 /* WebIconDatabaseClient.h in Headers */,
51D02F6A132EC73700BEAA96 /* WebIconDatabaseMessages.h in Headers */,
511B24A7132E095700065A0C /* WebIconDatabaseProxy.h in Headers */,
+ 83891B691A68BEBC0030F386 /* _WKDiagnosticLoggingDelegate.h in Headers */,
51D02F6C132EC73700BEAA96 /* WebIconDatabaseProxyMessages.h in Headers */,
51E351F6180F5C7500E53BE9 /* WebIDBFactoryBackend.h in Headers */,
51290993183ACEAF005522A6 /* WebIDBServerConnection.h in Headers */,
@@ -7983,6 +7997,7 @@
BC4075FE124FF0270068F20A /* WKMutableArray.h in Headers */,
BC407600124FF0270068F20A /* WKMutableDictionary.h in Headers */,
C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */,
+ 83891B631A68B3420030F386 /* APIDiagnosticLoggingClient.h in Headers */,
1A5B1C511898606F004FCF9B /* WKNavigation.h in Headers */,
1A256E3818A1A788006FB922 /* WKNavigationAction.h in Headers */,
1A256E3A18A1A7DF006FB922 /* WKNavigationActionInternal.h in Headers */,
@@ -9711,6 +9726,7 @@
37BF2F071947DEB400723C48 /* WKNSURLRequest.mm in Sources */,
BC407601124FF0270068F20A /* WKNumber.cpp in Sources */,
7CD5EBB81746A15B000C1C45 /* WKObjCTypeWrapperRef.mm in Sources */,
+ 83891B6D1A68C30B0030F386 /* DiagnosticLoggingClient.mm in Sources */,
374436881820E7240049579F /* WKObject.mm in Sources */,
BC85806312B8505700EDEB2E /* WKOpenPanelParameters.cpp in Sources */,
BC85806212B8505700EDEB2E /* WKOpenPanelResultListener.cpp in Sources */,