Title: [207792] trunk/Source/WebCore
- Revision
- 207792
- Author
- simon.fra...@apple.com
- Date
- 2016-10-24 17:22:08 -0700 (Mon, 24 Oct 2016)
Log Message
Fix the lifetime of strings used in LOG_WITH_STREAM
https://bugs.webkit.org/show_bug.cgi?id=163923
Reviewed by Brent Fulgham.
Make sure the const char* passed to WTFLog() outlives the call.
Removed logFunctionResult which wasn't used anywhere else, and encourages this bad
pattern.
* platform/LogMacros.h:
* platform/Logging.cpp:
(WebCore::logFunctionResult): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (207791 => 207792)
--- trunk/Source/WebCore/ChangeLog 2016-10-25 00:16:29 UTC (rev 207791)
+++ trunk/Source/WebCore/ChangeLog 2016-10-25 00:22:08 UTC (rev 207792)
@@ -1,3 +1,19 @@
+2016-10-24 Simon Fraser <simon.fra...@apple.com>
+
+ Fix the lifetime of strings used in LOG_WITH_STREAM
+ https://bugs.webkit.org/show_bug.cgi?id=163923
+
+ Reviewed by Brent Fulgham.
+
+ Make sure the const char* passed to WTFLog() outlives the call.
+
+ Removed logFunctionResult which wasn't used anywhere else, and encourages this bad
+ pattern.
+
+ * platform/LogMacros.h:
+ * platform/Logging.cpp:
+ (WebCore::logFunctionResult): Deleted.
+
2016-10-24 Chris Dumez <cdu...@apple.com>
Reduce special handling for typed arrays in JSDOMConvert.h
Modified: trunk/Source/WebCore/platform/LogMacros.h (207791 => 207792)
--- trunk/Source/WebCore/platform/LogMacros.h 2016-10-25 00:16:29 UTC (rev 207791)
+++ trunk/Source/WebCore/platform/LogMacros.h 2016-10-25 00:22:08 UTC (rev 207792)
@@ -29,22 +29,14 @@
#if LOG_DISABLED
-#define LOG_RESULT(channel, function) ((void)0)
#define LOG_WITH_STREAM(channel, commands) ((void)0)
#else
-namespace WebCore {
-WEBCORE_EXPORT void logFunctionResult(WTFLogChannel*, std::function<const char*()>);
-}
-
-#define LOG_RESULT(channel, function) WebCore::logFunctionResult(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), function)
-
-#define LOG_WITH_STREAM(channel, commands) WebCore::logFunctionResult(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), \
- [&]() { \
+#define LOG_WITH_STREAM(channel, commands) do { \
WebCore::TextStream stream(WebCore::TextStream::LineMode::SingleLine); \
commands; \
- return stream.release().utf8().data(); \
- });
+ WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), "%s", stream.release().utf8().data()); \
+ } while (0);
#endif // !LOG_DISABLED
Modified: trunk/Source/WebCore/platform/Logging.cpp (207791 => 207792)
--- trunk/Source/WebCore/platform/Logging.cpp 2016-10-25 00:16:29 UTC (rev 207791)
+++ trunk/Source/WebCore/platform/Logging.cpp 2016-10-25 00:22:08 UTC (rev 207792)
@@ -95,12 +95,4 @@
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-#if !LOG_DISABLED
-void logFunctionResult(WTFLogChannel* channel, std::function<const char*()> function)
-{
- WTFLog(channel, "%s", function());
-}
-
-#endif // !LOG_DISABLED
-
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes