Commit f3869e43 authored by benjamin@webkit.org's avatar benjamin@webkit.org

Do not do any logging initialization when logging is disabled

https://bugs.webkit.org/show_bug.cgi?id=90228

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-07-02
Reviewed by Simon Fraser.

Source/WebCore: 

Initializating of the logging channels was taking time on startup. When logging is disabled
(and the LOG macro does nothing), we should aslo disable logging channels and initialization.

This patch #ifdef the Logging initialization with the macro LOG_DISABLED.

* WebCore.exp.in:
* make-export-file-generator: Explicitely adds Assertions.h so that LOG_DISABLED is defined.
* platform/Logging.cpp:
* platform/Logging.h:
* platform/blackberry/LoggingBlackBerry.cpp:
* platform/efl/LoggingEfl.cpp:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
* platform/gtk/LoggingGtk.cpp:
* platform/mac/LoggingMac.mm:
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ensureSessionIsInitialized):
* platform/qt/LoggingQt.cpp:
* platform/win/LoggingWin.cpp:
* platform/wx/LoggingWx.cpp:

Source/WebKit/blackberry: 

* Api/BlackBerryGlobal.cpp:
(BlackBerry::WebKit::globalInitialize):

Source/WebKit/chromium: 

* src/WebKit.cpp:
(WebKit::enableLogChannel):

Source/WebKit/efl: 

* ewk/ewk_main.cpp:
(_ewk_init_body):

Source/WebKit/gtk: 

* webkit/webkitglobals.cpp:
(webkitInit):

Source/WebKit/mac: 

* Misc/WebIconDatabase.mm:
(-[WebIconDatabase _scaleIcon:toSize:]):
* Misc/WebKitLogging.h:
* Misc/WebKitLogging.m:
* WebView/WebHTMLView.mm:
(-[WebHTMLView _attributeStringFromDOMRange:]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit/qt: 

* WebCoreSupport/InitWebCoreQt.cpp:
(WebCore::initializeWebCoreQt):

Source/WebKit/win: 

* WebView.cpp:
(WebView::initWithFrame):

Source/WebKit/wx: 

* WebView.cpp:
(WebKit::WebView::Create):

Source/WebKit2: 

* Platform/Logging.cpp:
* Platform/Logging.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 735352f6
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
Initializating of the logging channels was taking time on startup. When logging is disabled
(and the LOG macro does nothing), we should aslo disable logging channels and initialization.
This patch #ifdef the Logging initialization with the macro LOG_DISABLED.
* WebCore.exp.in:
* make-export-file-generator: Explicitely adds Assertions.h so that LOG_DISABLED is defined.
* platform/Logging.cpp:
* platform/Logging.h:
* platform/blackberry/LoggingBlackBerry.cpp:
* platform/efl/LoggingEfl.cpp:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
* platform/gtk/LoggingGtk.cpp:
* platform/mac/LoggingMac.mm:
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ensureSessionIsInitialized):
* platform/qt/LoggingQt.cpp:
* platform/win/LoggingWin.cpp:
* platform/wx/LoggingWx.cpp:
2012-07-02 Dan Bernstein <mitz@apple.com>
<rdar://problem/11787030> In vertical writing modes, child following float-clearing block has incorrect logical top
......@@ -625,7 +625,6 @@ __ZN7WebCore31CrossOriginPreflightResultCache5emptyEv
__ZN7WebCore31CrossOriginPreflightResultCache6sharedEv
__ZN7WebCore32plainTextToMallocAllocatedBufferEPKNS_5RangeERjbNS_20TextIteratorBehaviorE
__ZN7WebCore33stripLeadingAndTrailingHTMLSpacesERKN3WTF6StringE
__ZN7WebCore36initializeLoggingChannelsIfNecessaryEv
__ZN7WebCore3macERKNS_10CredentialE
__ZN7WebCore3macERKNS_23AuthenticationChallengeE
__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
......@@ -1976,6 +1975,10 @@ __ZN7WebCore20LogNotYetImplementedE
__ZNK7WebCore7Element26fastAttributeLookupAllowedERKNS_13QualifiedNameE
#endif
#if !LOG_DISABLED
__ZN7WebCore36initializeLoggingChannelsIfNecessaryEv
#endif // !LOG_DISABLED
#if !defined(NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES) && !PLATFORM(IOS)
__ZN7WebCore7IntSizeC1ERK7_NSSize
__ZNK7WebCore7IntSizecv7_NSSizeEv
......
......@@ -36,6 +36,7 @@ end
TEMPLATE = <<-EOF
#include "config.h"
#include <stdio.h>
#include <wtf/Assertions.h>
int main(int, char**)
{
......
......@@ -27,6 +27,8 @@
#include "Logging.h"
#include "PlatformString.h"
#if !LOG_DISABLED
namespace WebCore {
WTFLogChannel LogNotYetImplemented = { 0x00000001, "WebCoreLogLevel", WTFLogChannelOff };
......@@ -149,3 +151,5 @@ WTFLogChannel* getChannelFromName(const String& channelName)
}
}
#endif // !LOG_DISABLED
......@@ -29,6 +29,8 @@
#include <wtf/Assertions.h>
#include <wtf/Forward.h>
#if !LOG_DISABLED
#ifndef LOG_CHANNEL_PREFIX
#define LOG_CHANNEL_PREFIX Log
#endif
......@@ -66,4 +68,6 @@ namespace WebCore {
WTFLogChannel* getChannelFromName(const String& channelName);
}
#endif // !LOG_DISABLED
#endif // Logging_h
......@@ -19,6 +19,8 @@
#include "config.h"
#include "Logging.h"
#if !LOG_DISABLED
#include <wtf/text/WTFString.h>
namespace WebCore {
......@@ -53,3 +55,5 @@ void initializeLoggingChannelsIfNecessary()
}
} // namespace WebCore
#endif // !LOG_DISABLED
......@@ -23,6 +23,8 @@
#include "config.h"
#include "Logging.h"
#if !LOG_DISABLED
#include "PlatformString.h"
#include <Eina.h>
......@@ -62,3 +64,5 @@ void initializeLoggingChannelsIfNecessary()
}
}
#endif // !LOG_DISABLED
......@@ -1719,9 +1719,13 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
g_object_set(m_fpsSink, "silent", TRUE , NULL);
// Turn off text overlay unless logging is enabled.
#if LOG_DISABLED
g_object_set(m_fpsSink, "text-overlay", FALSE , NULL);
#else
WTFLogChannel* channel = getChannelFromName("Media");
if (channel->state != WTFLogChannelOn)
g_object_set(m_fpsSink, "text-overlay", FALSE , NULL);
#endif // LOG_DISABLED
if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), "video-sink")) {
g_object_set(m_fpsSink, "video-sink", m_webkitVideoSink, NULL);
......
......@@ -20,8 +20,10 @@
#include "config.h"
#include "Logging.h"
#include "PlatformString.h"
#if !LOG_DISABLED
#include "PlatformString.h"
#include <glib.h>
#include <string.h>
......@@ -62,3 +64,5 @@ void initializeLoggingChannelsIfNecessary()
}
} // namespace WebCore
#endif // !LOG_DISABLED
......@@ -27,6 +27,8 @@
#include "Logging.h"
#if !LOG_DISABLED
namespace WebCore {
static inline void initializeWithUserDefault(WTFLogChannel& channel)
......@@ -77,3 +79,5 @@ void initializeLoggingChannelsIfNecessary()
}
}
#endif // !LOG_DISABLED
......@@ -200,11 +200,13 @@ static void ensureSessionIsInitialized(SoupSession* session)
setSoupCookieJar(jar);
}
#if !LOG_DISABLED
if (!soup_session_get_feature(session, SOUP_TYPE_LOGGER) && LogNetwork.state == WTFLogChannelOn) {
SoupLogger* logger = soup_logger_new(static_cast<SoupLoggerLogLevel>(SOUP_LOGGER_LOG_BODY), -1);
soup_session_add_feature(session, SOUP_SESSION_FEATURE(logger));
g_object_unref(logger);
}
#endif // !LOG_DISABLED
if (!soup_session_get_feature(session, SOUP_TYPE_REQUESTER)) {
SoupRequester* requester = soup_requester_new();
......
......@@ -20,6 +20,8 @@
#include "config.h"
#include "Logging.h"
#if !LOG_DISABLED
#include "PlatformString.h"
#include <QDebug>
#include <QStringList>
......@@ -54,3 +56,5 @@ void initializeLoggingChannelsIfNecessary()
}
} // namespace WebCore
#endif // !LOG_DISABLED
......@@ -26,6 +26,8 @@
#include "config.h"
#include "Logging.h"
#if !LOG_DISABLED
#include "PlatformString.h"
#include <windows.h>
#include <wtf/OwnArrayPtr.h>
......@@ -102,3 +104,5 @@ void initializeLoggingChannelsIfNecessary()
}
} // namespace WebCore
#endif // !LOG_DISABLED
......@@ -26,6 +26,8 @@
#include "config.h"
#include "Logging.h"
#if !LOG_DISABLED
#include "PlatformString.h"
#include <wtf/Vector.h>
#include <wtf/text/CString.h>
......@@ -62,3 +64,5 @@ void initializeLoggingChannelsIfNecessary()
}
}
#endif // !LOG_DISABLED
......@@ -60,8 +60,10 @@ void globalInitialize()
blackberryDebugInitialize();
#endif
#if !LOG_DISABLED
// Turn on logging.
initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
// Initialize threading/
JSC::initializeThreading();
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* Api/BlackBerryGlobal.cpp:
(BlackBerry::WebKit::globalInitialize):
2012-07-01 George Staikos <staikos@webkit.org>
Clear visited links when clearing history.
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* src/WebKit.cpp:
(WebKit::enableLogChannel):
2012-07-01 Keishi Hattori <keishi@webkit.org>
Unreviewed, rolling out r121650.
......
......@@ -50,6 +50,7 @@
#include <wtf/Assertions.h>
#include <wtf/MainThread.h>
#include <wtf/Threading.h>
#include <wtf/UnusedParam.h>
#include <wtf/text/AtomicString.h>
#if OS(DARWIN)
......@@ -185,9 +186,13 @@ bool layoutTestMode()
void enableLogChannel(const char* name)
{
#if !LOG_DISABLED
WTFLogChannel* channel = WebCore::getChannelFromName(name);
if (channel)
channel->state = WTFLogChannelOn;
#else
UNUSED_PARAM(name);
#endif // !LOG_DISABLED
}
void resetPluginCache(bool reloadPages)
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* ewk/ewk_main.cpp:
(_ewk_init_body):
2012-07-02 Gyuyoung Kim <gyuyoung.kim@samsung.com>
[EFL] Rename NotificationPresenterEfl with NotificationClientEfl
......
......@@ -146,7 +146,9 @@ Eina_Bool _ewk_init_body(void)
"work (ie: Adobe Flash)");
WebCore::ScriptController::initializeThreading();
#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
WebCore::Settings::setDefaultMinDOMTimerInterval(0.004);
PlatformStrategiesEfl::initialize();
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* webkit/webkitglobals.cpp:
(webkitInit):
2012-06-29 Tony Chang <tony@chromium.org>
[GTK] Enable CSS grid layout LayoutTests on GTK+
......
......@@ -504,7 +504,9 @@ void webkitInit()
JSC::initializeThreading();
WTF::initializeMainThread();
#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
PlatformStrategiesGtk::initialize();
// We make sure the text codecs have been initialized, because
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* Misc/WebIconDatabase.mm:
(-[WebIconDatabase _scaleIcon:toSize:]):
* Misc/WebKitLogging.h:
* Misc/WebKitLogging.m:
* WebView/WebHTMLView.mm:
(-[WebHTMLView _attributeStringFromDOMRange:]):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
2012-07-01 Timothy Hatcher <timothy@apple.com>
Make the "Inspect Element" context menu item appear in nightly builds again.
......
......@@ -441,7 +441,7 @@ static WebIconDatabaseClient* defaultClient()
ASSERT(size.width);
ASSERT(size.height);
#if !LOG_DISABLED
#if !LOG_DISABLED
double start = CFAbsoluteTimeGetCurrent();
#endif
......
......@@ -36,6 +36,7 @@
extern "C" {
#endif
#if !LOG_DISABLED
extern WTFLogChannel WebKitLogTiming;
extern WTFLogChannel WebKitLogLoading;
extern WTFLogChannel WebKitLogFontCache;
......@@ -62,6 +63,7 @@ extern WTFLogChannel WebKitLogIconDatabase;
extern WTFLogChannel WebKitLogTextInput;
void WebKitInitializeLoggingChannelsIfNecessary(void);
#endif // !LOG_DISABLED
// FIXME: Why is this in the "logging" header file?
// Use WebCoreThreadViolationCheck instead for checks that throw an exception even in production builds.
......
......@@ -28,6 +28,8 @@
#import "WebKitLogging.h"
#if !LOG_DISABLED
WTFLogChannel WebKitLogTextInput = { 0x00000010, "WebKitLogLevel", WTFLogChannelOff };
WTFLogChannel WebKitLogTiming = { 0x00000020, "WebKitLogLevel", WTFLogChannelOff };
WTFLogChannel WebKitLogLoading = { 0x00000040, "WebKitLogLevel", WTFLogChannelOff };
......@@ -98,6 +100,7 @@ void WebKitInitializeLoggingChannelsIfNecessary()
initializeLogChannel(&WebKitLogIconDatabase);
initializeLogChannel(&WebKitLogTextInput);
}
#endif // !LOG_DISABLED
void ReportDiscardedDelegateException(SEL delegateSelector, id exception)
{
......
......@@ -6140,7 +6140,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
- (NSAttributedString *)_attributeStringFromDOMRange:(DOMRange *)range
{
NSAttributedString *attributedString;
#if !LOG_DISABLED
#if !LOG_DISABLED
double start = CFAbsoluteTimeGetCurrent();
#endif
attributedString = [[[NSAttributedString alloc] _initWithDOMRange:range] autorelease];
......
......@@ -723,8 +723,10 @@ static bool shouldRespectPriorityInCSSAttributeSetters()
static bool didOneTimeInitialization = false;
if (!didOneTimeInitialization) {
#if !LOG_DISABLED
WebKitInitializeLoggingChannelsIfNecessary();
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
[WebHistoryItem initWindowWatcherIfNecessary];
#if ENABLE(SQL_DATABASE)
WebKitInitializeDatabasesIfNecessary();
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* WebCoreSupport/InitWebCoreQt.cpp:
(WebCore::initializeWebCoreQt):
2012-06-29 Konrad Piascik <kpiascik@rim.com>
Don't hardcode target dpi of 160 (it should be 96 on desktop)
......
......@@ -66,7 +66,9 @@ void initializeWebCoreQt()
if (initialized)
return;
#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
ScriptController::initializeThreading();
WTF::initializeMainThread();
WebCore::SecurityPolicy::setLocalLoadPolicy(WebCore::SecurityPolicy::AllowLocalLoadsForLocalAndSubstituteData);
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* WebView.cpp:
(WebView::initWithFrame):
2012-06-29 Mihai Balan <mibalan@adobe.com>
[CSS Regions] Adding feature defines for CSS Regions for Windows
......
......@@ -2641,7 +2641,9 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
static bool didOneTimeInitialization;
if (!didOneTimeInitialization) {
#if !LOG_DISABLED
initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
#if ENABLE(SQL_DATABASE)
WebKitInitializeWebDatabasesIfNecessary();
#endif
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* WebView.cpp:
(WebKit::WebView::Create):
2012-05-31 Hajime Morrita <morrita@chromium.org>
REGRESSION(r117572): editing/spelling/spellcheck-async-remove-frame.html crashes on Mac
......
......@@ -389,7 +389,9 @@ bool WebView::Create(wxWindow* parent, const wxString& url, int id, const wxPoin
m_impl = new WebViewPrivate();
WebCore::initializeLoggingChannelsIfNecessary();
#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
WebCore::HTMLFrameOwnerElement* parentFrame = 0;
WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx();
......
2012-07-02 Benjamin Poulain <bpoulain@apple.com>
Do not do any logging initialization when logging is disabled
https://bugs.webkit.org/show_bug.cgi?id=90228
Reviewed by Simon Fraser.
* Platform/Logging.cpp:
* Platform/Logging.h:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
2012-07-02 No'am Rosenthal <noam.rosenthal@nokia.com>
[Qt][WK2] New API tests introduced in r121620 fail
......
......@@ -90,4 +90,4 @@ void initializeLogChannelsIfNecessary()
} // namespace WebKit
#endif // LOG_DISABLED
#endif // !LOG_DISABLED
......@@ -52,6 +52,6 @@ WTFLogChannel* getChannelFromName(const String& channelName);
} // namespace WebKit
#endif // LOG_DISABLED
#endif // !LOG_DISABLED
#endif // Logging_h
......@@ -157,7 +157,9 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
addLanguageChangeObserver(this, languageChanged);
#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
#ifndef NDEBUG
webContextCounter.increment();
......
......@@ -161,7 +161,9 @@ WebProcess::WebProcess()
WebPlatformStrategies::initialize();
#endif // USE(PLATFORM_STRATEGIES)
#if !LOG_DISABLED
WebCore::initializeLoggingChannelsIfNecessary();
#endif // !LOG_DISABLED
}
void WebProcess::initialize(CoreIPC::Connection::Identifier serverIdentifier, RunLoop* runLoop)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment