summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/Logging.h
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2016-08-25 19:20:41 +0300
committerKonstantin Tokarev <annulen@yandex.ru>2017-02-02 12:30:55 +0000
commit6882a04fb36642862b11efe514251d32070c3d65 (patch)
treeb7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/platform/Logging.h
parentab6df191029eeeb0b0f16f127d553265659f739e (diff)
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/platform/Logging.h')
-rw-r--r--Source/WebCore/platform/Logging.h118
1 files changed, 82 insertions, 36 deletions
diff --git a/Source/WebCore/platform/Logging.h b/Source/WebCore/platform/Logging.h
index ee9a34e75..afa151952 100644
--- a/Source/WebCore/platform/Logging.h
+++ b/Source/WebCore/platform/Logging.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2013, 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
@@ -10,10 +10,10 @@
* 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 COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* 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
@@ -26,49 +26,95 @@
#ifndef Logging_h
#define Logging_h
+#include <functional>
#include <wtf/Assertions.h>
#include <wtf/Forward.h>
-#if !LOG_DISABLED
+namespace WebCore {
+
+#if LOG_DISABLED
+
+#define LOG_RESULT(channel, function) ((void)0)
+#define LOG_WITH_STREAM(channel, commands) ((void)0)
+
+#else
#ifndef LOG_CHANNEL_PREFIX
#define LOG_CHANNEL_PREFIX Log
#endif
-namespace WebCore {
+#define WEBCORE_LOG_CHANNELS(M) \
+ M(Animations) \
+ M(Archives) \
+ M(Compositing) \
+ M(ContentFiltering) \
+ M(DisplayLists) \
+ M(DOMTimers) \
+ M(Editing) \
+ M(Events) \
+ M(FTP) \
+ M(FileAPI) \
+ M(Frames) \
+ M(Fullscreen) \
+ M(Gamepad) \
+ M(History) \
+ M(IconDatabase) \
+ M(IndexedDB) \
+ M(Layout) \
+ M(Loading) \
+ M(Media) \
+ M(MediaSource) \
+ M(MediaSourceSamples) \
+ M(MemoryPressure) \
+ M(Network) \
+ M(NotYetImplemented) \
+ M(PageCache) \
+ M(PlatformLeaks) \
+ M(Plugins) \
+ M(PopupBlocking) \
+ M(Progress) \
+ M(RemoteInspector) \
+ M(ResourceLoading) \
+ M(SQLDatabase) \
+ M(SVG) \
+ M(Services) \
+ M(Scrolling) \
+ M(SpellingAndGrammar) \
+ M(StorageAPI) \
+ M(Threading) \
+ M(WebAudio) \
+ M(WebGL) \
+ M(WebReplay) \
+ M(WheelEventTestTriggers) \
+ M(ResourceLoadObserver) \
+
+#define DECLARE_LOG_CHANNEL(name) \
+ WEBCORE_EXPORT extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
+
+WEBCORE_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
- extern WTFLogChannel LogNotYetImplemented;
- extern WTFLogChannel LogFrames;
- extern WTFLogChannel LogLoading;
- extern WTFLogChannel LogPopupBlocking;
- extern WTFLogChannel LogEvents;
- extern WTFLogChannel LogEditing;
- extern WTFLogChannel LogLiveConnect;
- extern WTFLogChannel LogIconDatabase;
- extern WTFLogChannel LogSQLDatabase;
- extern WTFLogChannel LogSpellingAndGrammar;
- extern WTFLogChannel LogBackForward;
- extern WTFLogChannel LogHistory;
- extern WTFLogChannel LogPageCache;
- extern WTFLogChannel LogPlatformLeaks;
- extern WTFLogChannel LogResourceLoading;
- extern WTFLogChannel LogAnimations;
- extern WTFLogChannel LogNetwork;
- extern WTFLogChannel LogFTP;
- extern WTFLogChannel LogThreading;
- extern WTFLogChannel LogStorageAPI;
- extern WTFLogChannel LogMedia;
- extern WTFLogChannel LogPlugins;
- extern WTFLogChannel LogArchives;
- extern WTFLogChannel LogProgress;
- extern WTFLogChannel LogFileAPI;
- extern WTFLogChannel LogWebAudio;
- extern WTFLogChannel LogCompositing;
- extern WTFLogChannel LogGamepad;
-
- WTFLogChannel* getChannelFromName(const String& channelName);
-}
+#undef DECLARE_LOG_CHANNEL
+
+String logLevelString();
+bool isLogChannelEnabled(const String& name);
+WEBCORE_EXPORT void initializeLoggingChannelsIfNecessary();
+#ifndef NDEBUG
+void registerNotifyCallback(const String& notifyID, std::function<void()> callback);
+#endif
+
+void logFunctionResult(WTFLogChannel*, std::function<const char*()>);
+
+#define LOG_RESULT(channel, function) logFunctionResult(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), function)
+
+#define LOG_WITH_STREAM(channel, commands) logFunctionResult(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), \
+ [&]() { \
+ TextStream stream(TextStream::LineMode::SingleLine); \
+ commands; \
+ return stream.release().utf8().data(); \
+ });
#endif // !LOG_DISABLED
+} // namespace WebCore
+
#endif // Logging_h