Title: [232550] trunk/Source/WebCore/PAL
Revision
232550
Author
[email protected]
Date
2018-06-06 11:20:31 -0700 (Wed, 06 Jun 2018)

Log Message

Logging macros are sensitive to pal/Logging.h vs Logging.h include order
https://bugs.webkit.org/show_bug.cgi?id=185893

Reviewed by Zalan Bujtas.

Remove unused functionality from pal/Logging code until we need it. Primarily this removes the
#define LOG_CHANNEL_PREFIX from pal/Logging.h, which caused include-order problems with unified sources.

Future work should move shared logging code up to WTF (or into PAL).

* PAL.xcodeproj/project.pbxproj:
* pal/CMakeLists.txt:
* pal/LogInitialization.h: Removed.
* pal/Logging.cpp:
(PAL::isLogChannelEnabled): Deleted.
(PAL::setLogChannelToAccumulate): Deleted.
(PAL::initializeLogChannelsIfNecessary): Deleted.
* pal/Logging.h:
* pal/cocoa/LoggingCocoa.mm: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/PAL/ChangeLog (232549 => 232550)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-06-06 18:20:31 UTC (rev 232550)
@@ -1,3 +1,25 @@
+2018-06-06  Simon Fraser  <[email protected]>
+
+        Logging macros are sensitive to pal/Logging.h vs Logging.h include order
+        https://bugs.webkit.org/show_bug.cgi?id=185893
+
+        Reviewed by Zalan Bujtas.
+        
+        Remove unused functionality from pal/Logging code until we need it. Primarily this removes the
+        #define LOG_CHANNEL_PREFIX from pal/Logging.h, which caused include-order problems with unified sources.
+        
+        Future work should move shared logging code up to WTF (or into PAL).
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/CMakeLists.txt:
+        * pal/LogInitialization.h: Removed.
+        * pal/Logging.cpp:
+        (PAL::isLogChannelEnabled): Deleted.
+        (PAL::setLogChannelToAccumulate): Deleted.
+        (PAL::initializeLogChannelsIfNecessary): Deleted.
+        * pal/Logging.h:
+        * pal/cocoa/LoggingCocoa.mm: Removed.
+
 2018-06-05  Brent Fulgham  <[email protected]>
 
         Adjust compile and runtime flags to match shippable state of features

Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (232549 => 232550)


--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2018-06-06 18:20:31 UTC (rev 232550)
@@ -105,7 +105,6 @@
 		1C09D0581E31C57E00725F18 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C09D0571E31C57E00725F18 /* config.h */; };
 		1C4876D81F8D7F4E00CCEEBD /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4876D61F8D7F4E00CCEEBD /* Logging.cpp */; };
 		1C4876D91F8D7F4E00CCEEBD /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4876D71F8D7F4E00CCEEBD /* Logging.h */; };
-		1C4876E01F8D837500CCEEBD /* LoggingCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C4876DF1F8D837500CCEEBD /* LoggingCocoa.mm */; };
 		2D02E93C2056FAA700A13797 /* AudioToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D02E93B2056FAA700A13797 /* AudioToolboxSPI.h */; };
 		31308B1420A21705003FB929 /* SystemPreviewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31308B1320A21705003FB929 /* SystemPreviewSPI.h */; };
 		570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */; };
@@ -251,8 +250,6 @@
 		1C4876D61F8D7F4E00CCEEBD /* Logging.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Logging.cpp; sourceTree = "<group>"; };
 		1C4876D71F8D7F4E00CCEEBD /* Logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
 		1C4876DC1F8D7FC600CCEEBD /* LogMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogMacros.h; sourceTree = "<group>"; };
-		1C4876DD1F8D812B00CCEEBD /* LogInitialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogInitialization.h; sourceTree = "<group>"; };
-		1C4876DF1F8D837500CCEEBD /* LoggingCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingCocoa.mm; sourceTree = "<group>"; };
 		1C67CEA11E32EDA800F80F2E /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
 		1C67CEA21E32EE2600F80F2E /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
 		2D02E93B2056FAA700A13797 /* AudioToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioToolboxSPI.h; sourceTree = "<group>"; };
@@ -500,7 +497,6 @@
 				A39DE74D1F7C443C007BCB00 /* HysteresisActivity.h */,
 				1C4876D61F8D7F4E00CCEEBD /* Logging.cpp */,
 				1C4876D71F8D7F4E00CCEEBD /* Logging.h */,
-				1C4876DD1F8D812B00CCEEBD /* LogInitialization.h */,
 				1C4876DC1F8D7FC600CCEEBD /* LogMacros.h */,
 				A3C66CDA1F462D6A009E6EE9 /* SessionID.cpp */,
 				A3C66CDB1F462D6A009E6EE9 /* SessionID.h */,
@@ -542,7 +538,6 @@
 			isa = PBXGroup;
 			children = (
 				F44291661FA52705002CC93E /* FileSizeFormatterCocoa.mm */,
-				1C4876DF1F8D837500CCEEBD /* LoggingCocoa.mm */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";
@@ -821,7 +816,6 @@
 				A30D41221F0DD0EA00B71954 /* KillRing.cpp in Sources */,
 				A30D41251F0DD12D00B71954 /* KillRingMac.mm in Sources */,
 				1C4876D81F8D7F4E00CCEEBD /* Logging.cpp in Sources */,
-				1C4876E01F8D837500CCEEBD /* LoggingCocoa.mm in Sources */,
 				0CF99CA41F736375007EE793 /* MediaTimeAVFoundation.cpp in Sources */,
 				A1175B4F1F6B337300C4B9F0 /* PopupMenu.mm in Sources */,
 				A3C66CDC1F462D6A009E6EE9 /* SessionID.cpp in Sources */,

Modified: trunk/Source/WebCore/PAL/pal/CMakeLists.txt (232549 => 232550)


--- trunk/Source/WebCore/PAL/pal/CMakeLists.txt	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/pal/CMakeLists.txt	2018-06-06 18:20:31 UTC (rev 232550)
@@ -2,7 +2,6 @@
     ExportMacros.h
     FileSizeFormatter.h
     HysteresisActivity.h
-    LogInitialization.h
     LogMacros.h
     Logging.h
     SessionID.h

Deleted: trunk/Source/WebCore/PAL/pal/LogInitialization.h (232549 => 232550)


--- trunk/Source/WebCore/PAL/pal/LogInitialization.h	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/pal/LogInitialization.h	2018-06-06 18:20:31 UTC (rev 232550)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2013, 2015, 2016, 2017 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. ``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
- * 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.
- */
-
-#pragma once
-
-#include <wtf/Assertions.h>
-#include <wtf/Forward.h>
-#include <wtf/Optional.h>
-#include <wtf/text/WTFString.h>
-
-namespace PAL {
-
-#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
-String logLevelString();
-bool isLogChannelEnabled(const String& name);
-PAL_EXPORT void setLogChannelToAccumulate(const String& name);
-PAL_EXPORT void initializeLogChannelsIfNecessary(std::optional<String> = std::nullopt);
-
-#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/PAL/pal/Logging.cpp (232549 => 232550)


--- trunk/Source/WebCore/PAL/pal/Logging.cpp	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/pal/Logging.cpp	2018-06-06 18:20:31 UTC (rev 232550)
@@ -26,10 +26,6 @@
 #include "config.h"
 #include "Logging.h"
 
-#include "LogInitialization.h"
-
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
 #if PLATFORM(COCOA)
@@ -39,50 +35,6 @@
 
 namespace PAL {
 
-#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
-#define DEFINE_PAL_LOG_CHANNEL(name) DEFINE_LOG_CHANNEL(name, LOG_CHANNEL_WEBKIT_SUBSYSTEM)
-PAL_LOG_CHANNELS(DEFINE_PAL_LOG_CHANNEL)
-
-static WTFLogChannel* logChannels[] = {
-    PAL_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
-};
-
-static const size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels);
-
-bool isLogChannelEnabled(const String& name)
-{
-    WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
-    if (!channel)
-        return false;
-    return channel->state != WTFLogChannelOff;
-}
-
-static bool logChannelsNeedInitialization = true;
-
-void setLogChannelToAccumulate(const String& name)
-{
-    WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
-    if (!channel)
-        return;
-
-    channel->state = WTFLogChannelOnWithAccumulation;
-    logChannelsNeedInitialization = true;
-}
-
-void initializeLogChannelsIfNecessary(std::optional<String> logChannelString)
-{
-    if (!logChannelsNeedInitialization && !logChannelString)
-        return;
-
-    logChannelsNeedInitialization = false;
-
-    String enabledChannelsString = logChannelString ? logChannelString.value() : logLevelString();
-    WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, enabledChannelsString.utf8().data());
-}
-
-#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
 void registerNotifyCallback(const String& notifyID, WTF::Function<void()>&& callback)
 {
 #if PLATFORM(COCOA)
@@ -97,4 +49,3 @@
 }
 
 } // namespace WebCore
-

Modified: trunk/Source/WebCore/PAL/pal/Logging.h (232549 => 232550)


--- trunk/Source/WebCore/PAL/pal/Logging.h	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/pal/Logging.h	2018-06-06 18:20:31 UTC (rev 232550)
@@ -25,29 +25,10 @@
 
 #pragma once
 
-#include "LogMacros.h"
-#include <wtf/Assertions.h>
 #include <wtf/Forward.h>
 
 namespace PAL {
 
-#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
-#ifndef LOG_CHANNEL_PREFIX
-#define LOG_CHANNEL_PREFIX PALLog
-#endif
-
-#define PAL_LOG_CHANNELS(M) \
-    M(Network) \
-
-PAL_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
-
-String logLevelString();
-bool isLogChannelEnabled(const String& name);
-PAL_EXPORT void setLogChannelToAccumulate(const String& name);
-
-#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
 PAL_EXPORT void registerNotifyCallback(const String&, WTF::Function<void()>&&);
 
 } // namespace PAL

Deleted: trunk/Source/WebCore/PAL/pal/cocoa/LoggingCocoa.mm (232549 => 232550)


--- trunk/Source/WebCore/PAL/pal/cocoa/LoggingCocoa.mm	2018-06-06 18:07:50 UTC (rev 232549)
+++ trunk/Source/WebCore/PAL/pal/cocoa/LoggingCocoa.mm	2018-06-06 18:20:31 UTC (rev 232550)
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2003, 2006, 2013 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. ``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
- * 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.
- */
-
-#include "config.h"
-#include "Logging.h"
-
-#include <wtf/text/WTFString.h>
-
-#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
-namespace PAL {
-
-String logLevelString()
-{
-#if !LOG_DISABLED
-    static NSString * const defaultsDomain = @"PALLogging";
-    return [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain];
-#else
-    return String();
-#endif
-}
-
-}
-
-#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
-
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to