Changeset 153736 in webkit
- Timestamp:
- Aug 5, 2013, 7:53:49 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 deleted
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r153730 r153736 1 2013-07-26 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * wtf/Assertions.cpp: 28 (WTFLogChannelByName): Iterate over the provided array of log channels, returning the first whose name 29 matches case-insensitively. 30 (setStateOfAllChannels): Helper function to set the state of all channels to a single value. 31 (WTFInitializeLogChannelStatesFromString): Parse a string containing a case-insensitive, comma-separated list 32 of channel names to enable or disable, with the latter being prefixed by a "-". 33 * wtf/Assertions.h: Update the layout of WTFLogChannel to include only the state of the channel and its name. 34 Declare WTFLogChannelByName and WTFInitializeLogChannelStatesFromString. 35 * wtf/RefCountedLeakCounter.cpp: Update to the new format of WTFLogChannel. 36 1 37 2013-08-05 Benjamin Poulain <bpoulain@apple.com> 2 38 -
trunk/Source/WTF/wtf/Assertions.cpp
r150228 r153736 1 1 /* 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2007, 2013 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 4 * Copyright (C) 2011 University of Szeged. All rights reserved. … … 37 37 #include "Compiler.h" 38 38 #include "OwnArrayPtr.h" 39 #include <wtf/StdLibExtras.h> 40 #include <wtf/text/CString.h> 41 #include <wtf/text/WTFString.h> 39 42 40 43 #include <stdio.h> … … 434 437 } 435 438 439 WTFLogChannel* WTFLogChannelByName(WTFLogChannel* channels[], size_t count, const char* name) 440 { 441 for (size_t i = 0; i < count; ++i) { 442 WTFLogChannel* channel = channels[i]; 443 if (!strcasecmp(name, channel->name)) 444 return channel; 445 } 446 447 return 0; 448 } 449 450 static void setStateOfAllChannels(WTFLogChannel* channels[], size_t channelCount, WTFLogChannelState state) 451 { 452 for (size_t i = 0; i < channelCount; ++i) 453 channels[i]->state = state; 454 } 455 456 void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t count, const char* logLevel) 457 { 458 String logLevelString = logLevel; 459 Vector<String> components; 460 logLevelString.split(',', components); 461 462 for (size_t i = 0; i < components.size(); ++i) { 463 String component = components[i]; 464 465 WTFLogChannelState logChannelState = WTFLogChannelOn; 466 if (component.startsWith('-')) { 467 logChannelState = WTFLogChannelOff; 468 component = component.substring(1); 469 } 470 471 if (equalIgnoringCase(component, "all")) { 472 setStateOfAllChannels(channels, count, logChannelState); 473 continue; 474 } 475 476 if (WTFLogChannel* channel = WTFLogChannelByName(channels, count, component.utf8().data())) 477 channel->state = logChannelState; 478 else 479 WTFLogAlways("Unknown logging channel: %s", component.utf8().data()); 480 } 481 } 482 436 483 } // extern "C" -
trunk/Source/WTF/wtf/Assertions.h
r150228 r153736 1 1 /* 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2007, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 104 104 105 105 typedef struct { 106 unsigned mask;107 const char *defaultName;108 106 WTFLogChannelState state; 107 const char* name; 109 108 } WTFLogChannel; 110 109 … … 117 116 WTF_EXPORT_PRIVATE void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6); 118 117 WTF_EXPORT_PRIVATE void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); 118 WTF_EXPORT_PRIVATE WTFLogChannel* WTFLogChannelByName(WTFLogChannel*[], size_t count, const char*); 119 WTF_EXPORT_PRIVATE void WTFInitializeLogChannelStatesFromString(WTFLogChannel*[], size_t count, const char*); 119 120 120 121 WTF_EXPORT_PRIVATE void WTFGetBacktrace(void** stack, int* size); -
trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp
r130612 r153736 40 40 41 41 #define LOG_CHANNEL_PREFIX Log 42 static WTFLogChannel LogRefCountedLeaks = { 0x00000000, "", WTFLogChannelOn};42 static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn, "RefCountedLeaks" }; 43 43 44 44 typedef HashCountedSet<const char*, PtrHash<const char*> > ReasonSet; -
trunk/Source/WebCore/ChangeLog
r153734 r153736 1 2013-07-27 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * GNUmakefile.list.am: Remove the now-unused InitializeLogging.h 28 * Target.pri: Ditto. 29 * WebCore.xcodeproj/project.pbxproj: Ditto. 30 * platform/InitializeLogging.h: Removed. Ditto. 31 * platform/Logging.cpp: Use WEBCORE_LOG_CHANNELS to define all of the channels. 32 (WebCore::logChannelByName): Renamed to match our naming conventions. Calls through to the new WTF function 33 to find a log channel rather than repeating the names of the log channels a further two times each. 34 (WebCore::initializeLoggingChannelsIfNecessary): Pass the channels and the log level string to the new 35 WTF function that handles the initialization. 36 * platform/Logging.h: Declare a WEBCORE_LOG_CHANNELS macro that can be used to apply a preprocessor macro 37 across the set of all logging channels. Use this macro to declare the logging channels. 38 * platform/blackberry/LoggingBlackBerry.cpp: 39 (WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable. 40 * platform/efl/LoggingEfl.cpp: 41 (WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable, and then prepend 42 NotYetImplemented to it so that that channel will be enabled by default. 43 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 44 (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): Accommodate the rename to logChannelByName. 45 * platform/gtk/LoggingGtk.cpp: 46 (WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable, and then prepend 47 NotYetImplemented to it so that that channel will be enabled by default. 48 * platform/mac/LoggingMac.mm: 49 (WebCore::logLevelString): Pull the value out of the WebCoreLogging user default key. 50 * platform/qt/LoggingQt.cpp: 51 (WebCore::logLevelString): Pull the value out of the QT_WEBKIT_LOG environment variable, and then prepend 52 NotYetImplemented to it so that the channel will be enabled by default. 53 * platform/win/LoggingWin.cpp: 54 (WebCore::logLevelString): Pull the value out of the WebCoreLogging environment variable. 55 1 56 2013-08-05 Ryosuke Niwa <rniwa@webkit.org> 2 57 -
trunk/Source/WebCore/GNUmakefile.list.am
r153460 r153736 6067 6067 Source/WebCore/platform/HistogramSupport.h \ 6068 6068 Source/WebCore/platform/HostWindow.h \ 6069 Source/WebCore/platform/InitializeLogging.h \6070 6069 Source/WebCore/platform/KURL.cpp \ 6071 6070 Source/WebCore/platform/KURL.h \ -
trunk/Source/WebCore/Target.pri
r152565 r153736 2135 2135 platform/FileSystem.h \ 2136 2136 platform/HistogramSupport.h \ 2137 platform/InitializeLogging.h \2138 2137 platform/image-decoders/ImageDecoder.h \ 2139 2138 platform/mock/DeviceMotionClientMock.h \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r153541 r153736 3592 3592 A81872250977D3C0005826D9 /* ChildNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A818721A0977D3C0005826D9 /* ChildNodeList.cpp */; }; 3593 3593 A8239E0009B3CF8A00B60641 /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8239DFE09B3CF8A00B60641 /* Logging.cpp */; }; 3594 A8239E0109B3CF8A00B60641 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = A8239DFF09B3CF8A00B60641 /* Logging.h */; settings = {ATTRIBUTES = ( ); }; };3594 A8239E0109B3CF8A00B60641 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = A8239DFF09B3CF8A00B60641 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3595 3595 A824B4650E2EF2EA0081A7B7 /* TextRun.h in Headers */ = {isa = PBXBuildFile; fileRef = A824B4640E2EF2EA0081A7B7 /* TextRun.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3596 3596 A833C7CA0A2CF06B00D57664 /* SVGNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581E809D1508D000E61D7 /* SVGNames.cpp */; }; … … 5387 5387 E14F1C4414B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14F1C4214B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp */; }; 5388 5388 E14F1C4514B5DAC600EA9009 /* HTMLFormControlElementWithState.h in Headers */ = {isa = PBXBuildFile; fileRef = E14F1C4314B5DAC600EA9009 /* HTMLFormControlElementWithState.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5389 E1513D4F1677EA8300149FCB /* InitializeLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = E1513D4E1677EA8300149FCB /* InitializeLogging.h */; settings = {ATTRIBUTES = (Private, ); }; };5390 5389 E1513D511677F08800149FCB /* NotImplemented.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1513D501677F08800149FCB /* NotImplemented.cpp */; }; 5391 5390 E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */; }; … … 12178 12177 E14F1C4214B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFormControlElementWithState.cpp; sourceTree = "<group>"; }; 12179 12178 E14F1C4314B5DAC600EA9009 /* HTMLFormControlElementWithState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLFormControlElementWithState.h; sourceTree = "<group>"; }; 12180 E1513D4E1677EA8300149FCB /* InitializeLogging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeLogging.h; sourceTree = "<group>"; };12181 12179 E1513D501677F08800149FCB /* NotImplemented.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotImplemented.cpp; sourceTree = "<group>"; }; 12182 12180 E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreResourceHandleAsOperationQueueDelegate.h; sourceTree = "<group>"; }; … … 19332 19330 D630E2AB149BF344005B2F93 /* HistogramSupport.h */, 19333 19331 BC3BC29B0E91AB0F00835588 /* HostWindow.h */, 19334 E1513D4E1677EA8300149FCB /* InitializeLogging.h */,19335 19332 521D46F711AEC9B100514613 /* KillRing.h */, 19336 19333 4306E4E514955543007F17AC /* KillRingNone.cpp */, … … 22174 22171 07367DDF172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.h in Headers */, 22175 22172 DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */, 22176 E1513D4F1677EA8300149FCB /* InitializeLogging.h in Headers */,22177 22173 F3644B001119805900E0D537 /* InjectedScript.h in Headers */, 22178 22174 AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */, -
trunk/Source/WebCore/platform/Logging.cpp
r148071 r153736 1 1 /* 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2013 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #include "Logging.h" 28 28 29 #include <wtf/StdLibExtras.h> 30 #include <wtf/text/CString.h> 29 31 #include <wtf/text/WTFString.h> 30 32 … … 33 35 namespace WebCore { 34 36 35 WTFLogChannel LogNotYetImplemented = { 0x00000001, "WebCoreLogLevel", WTFLogChannelOff }; 37 #define DEFINE_LOG_CHANNEL(name) \ 38 WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name }; 39 WEBCORE_LOG_CHANNELS(DEFINE_LOG_CHANNEL) 36 40 37 WTFLogChannel LogFrames = { 0x00000010, "WebCoreLogLevel", WTFLogChannelOff }; 38 WTFLogChannel LogLoading = { 0x00000020, "WebCoreLogLevel", WTFLogChannelOff };39 WTFLogChannel LogPopupBlocking = { 0x00000040, "WebCoreLogLevel", WTFLogChannelOff }; 40 WTFLogChannel LogEvents = { 0x00000080, "WebCoreLogLevel", WTFLogChannelOff};41 #define LOG_CHANNEL_ADDRESS(name) &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name), 42 WTFLogChannel* logChannels[] = { 43 WEBCORE_LOG_CHANNELS(LOG_CHANNEL_ADDRESS) 44 }; 41 45 42 WTFLogChannel LogEditing = { 0x00000100, "WebCoreLogLevel", WTFLogChannelOff }; 43 WTFLogChannel LogLiveConnect = { 0x00000200, "WebCoreLogLevel", WTFLogChannelOff }; 44 WTFLogChannel LogIconDatabase = { 0x00000400, "WebCoreLogLevel", WTFLogChannelOff }; 45 WTFLogChannel LogSQLDatabase = { 0x00000800, "WebCoreLogLevel", WTFLogChannelOff }; 46 size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels); 46 47 47 WTFLogChannel LogSpellingAndGrammar ={ 0x00001000, "WebCoreLogLevel", WTFLogChannelOff };48 WTFLogChannel LogBackForward = { 0x00002000, "WebCoreLogLevel", WTFLogChannelOff }; 49 WTFLogChannel LogHistory = { 0x00004000, "WebCoreLogLevel", WTFLogChannelOff };50 WTFLogChannel LogPageCache = { 0x00008000, "WebCoreLogLevel", WTFLogChannelOff }; 48 WTFLogChannel* logChannelByName(const String& name) 49 { 50 return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data()); 51 } 51 52 52 WTFLogChannel LogPlatformLeaks = { 0x00010000, "WebCoreLogLevel", WTFLogChannelOff }; 53 WTFLogChannel LogResourceLoading = { 0x00020000, "WebCoreLogLevel", WTFLogChannelOff }; 54 WTFLogChannel LogAnimations = { 0x00040000, "WebCoreLogLevel", WTFLogChannelOff }; 53 void initializeLoggingChannelsIfNecessary() 54 { 55 static bool haveInitializedLoggingChannels = false; 56 if (haveInitializedLoggingChannels) 57 return; 58 haveInitializedLoggingChannels = true; 55 59 56 WTFLogChannel LogNetwork = { 0x00100000, "WebCoreLogLevel", WTFLogChannelOff }; 57 WTFLogChannel LogFTP = { 0x00200000, "WebCoreLogLevel", WTFLogChannelOff }; 58 WTFLogChannel LogThreading = { 0x00400000, "WebCoreLogLevel", WTFLogChannelOff }; 59 WTFLogChannel LogStorageAPI = { 0x00800000, "WebCoreLogLevel", WTFLogChannelOff }; 60 61 WTFLogChannel LogMedia = { 0x01000000, "WebCoreLogLevel", WTFLogChannelOff }; 62 WTFLogChannel LogPlugins = { 0x02000000, "WebCoreLogLevel", WTFLogChannelOff }; 63 WTFLogChannel LogArchives = { 0x04000000, "WebCoreLogLevel", WTFLogChannelOff }; 64 WTFLogChannel LogProgress = { 0x08000000, "WebCoreLogLevel", WTFLogChannelOff }; 65 66 WTFLogChannel LogFileAPI = { 0x10000000, "WebCoreLogLevel", WTFLogChannelOff }; 67 68 WTFLogChannel LogWebAudio = { 0x20000000, "WebCoreLogLevel", WTFLogChannelOff }; 69 WTFLogChannel LogCompositing = { 0x40000000, "WebCoreLogLevel", WTFLogChannelOff }; 70 WTFLogChannel LogGamepad = { 0x80000000, "WebCoreLogLevel", WTFLogChannelOff }; 71 72 73 WTFLogChannel* getChannelFromName(const String& channelName) 74 { 75 if (!(channelName.length() >= 2)) 76 return 0; 77 78 if (equalIgnoringCase(channelName, String("BackForward"))) 79 return &LogBackForward; 80 81 if (equalIgnoringCase(channelName, String("Editing"))) 82 return &LogEditing; 83 84 if (equalIgnoringCase(channelName, String("Events"))) 85 return &LogEvents; 86 87 if (equalIgnoringCase(channelName, String("Frames"))) 88 return &LogFrames; 89 90 if (equalIgnoringCase(channelName, String("FTP"))) 91 return &LogFTP; 92 93 if (equalIgnoringCase(channelName, String("History"))) 94 return &LogHistory; 95 96 if (equalIgnoringCase(channelName, String("IconDatabase"))) 97 return &LogIconDatabase; 98 99 if (equalIgnoringCase(channelName, String("Loading"))) 100 return &LogLoading; 101 102 if (equalIgnoringCase(channelName, String("Media"))) 103 return &LogMedia; 104 105 if (equalIgnoringCase(channelName, String("Network"))) 106 return &LogNetwork; 107 108 if (equalIgnoringCase(channelName, String("NotYetImplemented"))) 109 return &LogNotYetImplemented; 110 111 if (equalIgnoringCase(channelName, String("PageCache"))) 112 return &LogPageCache; 113 114 if (equalIgnoringCase(channelName, String("PlatformLeaks"))) 115 return &LogPlatformLeaks; 116 117 if (equalIgnoringCase(channelName, String("ResourceLoading"))) 118 return &LogResourceLoading; 119 120 if (equalIgnoringCase(channelName, String("Animations"))) 121 return &LogAnimations; 122 123 if (equalIgnoringCase(channelName, String("Plugins"))) 124 return &LogPlugins; 125 126 if (equalIgnoringCase(channelName, String("PopupBlocking"))) 127 return &LogPopupBlocking; 128 129 if (equalIgnoringCase(channelName, String("Progress"))) 130 return &LogProgress; 131 132 if (equalIgnoringCase(channelName, String("SpellingAndGrammar"))) 133 return &LogSpellingAndGrammar; 134 135 if (equalIgnoringCase(channelName, String("SQLDatabase"))) 136 return &LogSQLDatabase; 137 138 if (equalIgnoringCase(channelName, String("StorageAPI"))) 139 return &LogStorageAPI; 140 141 if (equalIgnoringCase(channelName, String("LiveConnect"))) 142 return &LogLiveConnect; 143 144 if (equalIgnoringCase(channelName, String("Threading"))) 145 return &LogThreading; 146 147 if (equalIgnoringCase(channelName, String("FileAPI"))) 148 return &LogFileAPI; 149 150 if (equalIgnoringCase(channelName, String("WebAudio"))) 151 return &LogWebAudio; 152 153 if (equalIgnoringCase(channelName, String("Compositing"))) 154 return &LogCompositing; 155 156 if (equalIgnoringCase(channelName, String("Gamepad"))) 157 return &LogGamepad; 158 159 return 0; 60 WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, logLevelString().utf8().data()); 160 61 } 161 62 -
trunk/Source/WebCore/platform/Logging.h
r148071 r153736 1 1 /* 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2013 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 38 38 namespace WebCore { 39 39 40 extern WTFLogChannel LogNotYetImplemented; 41 extern WTFLogChannel LogFrames; 42 extern WTFLogChannel LogLoading; 43 extern WTFLogChannel LogPopupBlocking; 44 extern WTFLogChannel LogEvents; 45 extern WTFLogChannel LogEditing; 46 extern WTFLogChannel LogLiveConnect; 47 extern WTFLogChannel LogIconDatabase; 48 extern WTFLogChannel LogSQLDatabase; 49 extern WTFLogChannel LogSpellingAndGrammar; 50 extern WTFLogChannel LogBackForward; 51 extern WTFLogChannel LogHistory; 52 extern WTFLogChannel LogPageCache; 53 extern WTFLogChannel LogPlatformLeaks; 54 extern WTFLogChannel LogResourceLoading; 55 extern WTFLogChannel LogAnimations; 56 extern WTFLogChannel LogNetwork; 57 extern WTFLogChannel LogFTP; 58 extern WTFLogChannel LogThreading; 59 extern WTFLogChannel LogStorageAPI; 60 extern WTFLogChannel LogMedia; 61 extern WTFLogChannel LogPlugins; 62 extern WTFLogChannel LogArchives; 63 extern WTFLogChannel LogProgress; 64 extern WTFLogChannel LogFileAPI; 65 extern WTFLogChannel LogWebAudio; 66 extern WTFLogChannel LogCompositing; 67 extern WTFLogChannel LogGamepad; 40 #define WEBCORE_LOG_CHANNELS(M) \ 41 M(Animations) \ 42 M(Archives) \ 43 M(BackForward) \ 44 M(Compositing) \ 45 M(Editing) \ 46 M(Events) \ 47 M(FTP) \ 48 M(FileAPI) \ 49 M(Frames) \ 50 M(Gamepad) \ 51 M(History) \ 52 M(IconDatabase) \ 53 M(LiveConnect) \ 54 M(Loading) \ 55 M(Media) \ 56 M(Network) \ 57 M(NotYetImplemented) \ 58 M(PageCache) \ 59 M(PlatformLeaks) \ 60 M(Plugins) \ 61 M(PopupBlocking) \ 62 M(Progress) \ 63 M(ResourceLoading) \ 64 M(SQLDatabase) \ 65 M(SpellingAndGrammar) \ 66 M(StorageAPI) \ 67 M(Threading) \ 68 M(WebAudio) \ 68 69 69 WTFLogChannel* getChannelFromName(const String& channelName); 70 #define DECLARE_LOG_CHANNEL(name) \ 71 extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name); 72 73 WEBCORE_LOG_CHANNELS(DECLARE_LOG_CHANNEL) 74 75 #undef DECLARE_LOG_CHANNEL 76 77 extern WTFLogChannel* logChannels[]; 78 extern size_t logChannelCount; 79 80 String logLevelString(); 81 WTFLogChannel* logChannelByName(const String&); 82 void initializeLoggingChannelsIfNecessary(); 70 83 } 71 84 -
trunk/Source/WebCore/platform/blackberry/LoggingBlackBerry.cpp
r149822 r153736 1 1 /* 2 2 * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All Rights Reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 #include "Logging.h" 21 22 22 #include "InitializeLogging.h"23 24 23 #if !LOG_DISABLED 25 24 … … 28 27 namespace WebCore { 29 28 30 static inline void initializeWithUserDefault(WTFLogChannel& channel, bool enabled)29 String logLevelString() 31 30 { 32 if (enabled) 33 channel.state = WTFLogChannelOn; 34 else 35 channel.state = WTFLogChannelOff; 36 } 37 38 void initializeLoggingChannelsIfNecessary() 39 { 40 static bool haveInitializedLoggingChannels = false; 41 if (haveInitializedLoggingChannels) 42 return; 43 haveInitializedLoggingChannels = true; 44 45 String logEnv = getenv("WEBKIT_DEBUG"); 46 if (logEnv.isEmpty()) 47 return; 48 49 Vector<String> logv; 50 logEnv.split(" ", logv); 51 52 Vector<String>::const_iterator it = logv.begin(); 53 for (; it != logv.end(); ++it) { 54 if (WTFLogChannel* channel = getChannelFromName(*it)) 55 channel->state = WTFLogChannelOn; 56 } 31 return getenv("WEBKIT_DEBUG"); 57 32 } 58 33 -
trunk/Source/WebCore/platform/efl/LoggingEfl.cpp
r137486 r153736 4 4 * Copyright (C) 2009-2010 ProFUSION embedded systems 5 5 * Copyright (C) 2009-2010 Samsung Electronics 6 * Copyright (C) 2013 Apple Inc. All rights reserved. 6 7 * 7 8 * This library is free software; you can redistribute it and/or … … 22 23 23 24 #include "config.h" 24 #include "InitializeLogging.h"25 25 #include "Logging.h" 26 26 27 27 #if !LOG_DISABLED 28 28 29 #include <Eina.h>30 29 #include <wtf/text/WTFString.h> 31 30 32 31 namespace WebCore { 33 32 34 void initializeLoggingChannelsIfNecessary()33 String logLevelString() 35 34 { 36 static bool didInitializeLoggingChannels = false;37 if (didInitializeLoggingChannels)38 return;39 40 didInitializeLoggingChannels = true;41 42 35 char* logEnv = getenv("WEBKIT_DEBUG"); 43 36 if (!logEnv) 44 return ;37 return emptyString(); 45 38 46 39 #if defined(NDEBUG) … … 48 41 #endif 49 42 50 char** logv = eina_str_split(logEnv, ",", -1); 51 52 EINA_SAFETY_ON_NULL_RETURN(logv); 53 54 for (int i = 0; logv[i]; i++) { 55 if (WTFLogChannel* channel = getChannelFromName(logv[i])) 56 channel->state = WTFLogChannelOn; 57 } 58 59 free(*logv); 60 free(logv); 61 62 // To disable logging notImplemented set the DISABLE_NI_WARNING 63 // environment variable to 1. 64 LogNotYetImplemented.state = WTFLogChannelOn; 43 // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1. 44 String logLevel = "NotYetImplemented,"; 45 logLevel.append(logEnv); 46 return logLevel; 65 47 } 66 48 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r152711 r153736 573 573 g_object_set(m_fpsSink, "text-overlay", FALSE , NULL); 574 574 #else 575 WTFLogChannel* channel = getChannelFromName("Media");575 WTFLogChannel* channel = logChannelByName("Media"); 576 576 if (channel->state != WTFLogChannelOn) 577 577 g_object_set(m_fpsSink, "text-overlay", FALSE , NULL); -
trunk/Source/WebCore/platform/gtk/LoggingGtk.cpp
r137486 r153736 2 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 3 * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org> 4 * Copyright (C) 2013 Apple Inc. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 20 21 21 22 #include "config.h" 22 #include "InitializeLogging.h"23 23 #include "Logging.h" 24 24 … … 31 31 namespace WebCore { 32 32 33 // Inspired by the code used by the Qt port 34 35 void initializeLoggingChannelsIfNecessary() 33 String logLevelString() 36 34 { 37 static bool didInitializeLoggingChannels = false;38 if (didInitializeLoggingChannels)39 return;40 41 didInitializeLoggingChannels = true;42 43 35 char* logEnv = getenv("WEBKIT_DEBUG"); 44 36 if (!logEnv) 45 return ;37 return emptyString(); 46 38 47 // we set up the logs anyway because some of our logging, such as 48 // soup's is available in release builds 39 // We set up the logs anyway because some of our logging, such as Soup's is available in release builds. 49 40 #if defined(NDEBUG) 50 41 g_warning("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build."); 51 42 #endif 52 43 53 char** logv = g_strsplit(logEnv, " ", -1); 54 55 for (int i = 0; logv[i]; i++) { 56 if (WTFLogChannel* channel = getChannelFromName(logv[i])) 57 channel->state = WTFLogChannelOn; 58 } 59 60 g_strfreev(logv); 61 62 // to disable logging notImplemented set the DISABLE_NI_WARNING 63 // environment variable to 1 64 LogNotYetImplemented.state = WTFLogChannelOn; 44 // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1. 45 String logLevel = "NotYetImplemented,"; 46 logLevel.append(logEnv); 47 return logLevel; 65 48 } 66 49 -
trunk/Source/WebCore/platform/mac/LoggingMac.mm
r148071 r153736 1 1 /* 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2013 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "InitializeLogging.h"28 27 #include "Logging.h" 28 29 #include <wtf/text/WTFString.h> 29 30 30 31 #if !LOG_DISABLED … … 32 33 namespace WebCore { 33 34 34 static inline void initializeWithUserDefault(WTFLogChannel& channel) 35 static NSString * const defaultsDomain = @"WebCoreLogging"; 36 37 String logLevelString() 35 38 { 36 NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel.defaultName]]; 37 if (logLevelString) { 38 unsigned logLevel; 39 if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel]) 40 NSLog(@"unable to parse hex value for %s (%@), logging is off", channel.defaultName, logLevelString); 41 if ((logLevel & channel.mask) == channel.mask) 42 channel.state = WTFLogChannelOn; 43 else 44 channel.state = WTFLogChannelOff; 45 } 46 } 47 48 void initializeLoggingChannelsIfNecessary() 49 { 50 static bool haveInitializedLoggingChannels = false; 51 if (haveInitializedLoggingChannels) 52 return; 53 haveInitializedLoggingChannels = true; 54 55 initializeWithUserDefault(LogNotYetImplemented); 56 initializeWithUserDefault(LogFrames); 57 initializeWithUserDefault(LogLoading); 58 initializeWithUserDefault(LogPopupBlocking); 59 initializeWithUserDefault(LogEvents); 60 initializeWithUserDefault(LogEditing); 61 initializeWithUserDefault(LogLiveConnect); 62 initializeWithUserDefault(LogIconDatabase); 63 initializeWithUserDefault(LogSQLDatabase); 64 initializeWithUserDefault(LogSpellingAndGrammar); 65 initializeWithUserDefault(LogBackForward); 66 initializeWithUserDefault(LogHistory); 67 initializeWithUserDefault(LogPageCache); 68 initializeWithUserDefault(LogPlatformLeaks); 69 initializeWithUserDefault(LogResourceLoading); 70 initializeWithUserDefault(LogAnimations); 71 initializeWithUserDefault(LogNetwork); 72 initializeWithUserDefault(LogFTP); 73 initializeWithUserDefault(LogThreading); 74 initializeWithUserDefault(LogStorageAPI); 75 initializeWithUserDefault(LogMedia); 76 initializeWithUserDefault(LogPlugins); 77 initializeWithUserDefault(LogArchives); 78 initializeWithUserDefault(LogWebAudio); 79 initializeWithUserDefault(LogCompositing); 39 return [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain]; 80 40 } 81 41 -
trunk/Source/WebCore/platform/qt/LoggingQt.cpp
r137486 r153736 1 1 /* 2 2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 4 5 This library is free software; you can redistribute it and/or … … 19 20 20 21 #include "config.h" 21 #include "InitializeLogging.h"22 22 #include "Logging.h" 23 23 … … 25 25 26 26 #include <QDebug> 27 #include <QStringList>28 27 #include <wtf/text/WTFString.h> 29 28 30 29 namespace WebCore { 31 30 32 void initializeLoggingChannelsIfNecessary()31 String logLevelString() 33 32 { 34 static bool haveInitializedLoggingChannels = false;35 if (haveInitializedLoggingChannels)36 return;37 38 haveInitializedLoggingChannels = true;39 40 33 QByteArray loggingEnv = qgetenv("QT_WEBKIT_LOG"); 41 34 if (loggingEnv.isEmpty()) 42 return ;35 return emptyString(); 43 36 44 37 #if defined(NDEBUG) 45 38 qWarning("This is a release build. Setting QT_WEBKIT_LOG will have no effect."); 46 39 #else 47 QStringList channels = QString::fromLocal8Bit(loggingEnv).split(QLatin1String(","));48 for (int i = 0; i < channels.count(); i++) {49 if (WTFLogChannel* channel = getChannelFromName(channels.at(i)))50 channel->state = WTFLogChannelOn;51 }52 40 53 // By default we log calls to notImplemented(). This can be turned 54 // off by setting the environment variable DISABLE_NI_WARNING to 1 55 LogNotYetImplemented.state = WTFLogChannelOn; 41 // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1. 42 String logLevel = "NotYetImplemented,"; 43 logLevel.append(QString::fromLocal8Bit(loggingEnv)); 44 return logLevel; 56 45 #endif 57 46 } -
trunk/Source/WebCore/platform/win/LoggingWin.cpp
r148071 r153736 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.2 * Copyright (C) 2008, 2013 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "InitializeLogging.h"28 27 #include "Logging.h" 29 28 … … 36 35 namespace WebCore { 37 36 38 static inline void initializeWithUserDefault(WTFLogChannel& channel) 37 static char * const loggingEnvironmentVariable = "WebCoreLogging"; 38 39 String logLevelString() 39 40 { 40 DWORD length = GetEnvironmentVariableA( channel.defaultName, 0, 0);41 DWORD length = GetEnvironmentVariableA(loggingEnvironmentVariable, 0, 0); 41 42 if (!length) 42 return ;43 return emptyString(); 43 44 44 45 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]); 45 46 46 if (!GetEnvironmentVariableA( channel.defaultName, buffer.get(), length))47 return ;47 if (!GetEnvironmentVariableA(loggingEnvironmentVariable, buffer.get(), length)) 48 return emptyString(); 48 49 49 String variableValue(buffer.get()); 50 51 static const String& hexadecimalPrefix = *new String("0x"); 52 if (variableValue.length() < 3 || !variableValue.startsWith(hexadecimalPrefix, false)) { 53 LOG_ERROR("Unable to parse hex value for %s (%s), logging is off", channel.defaultName, buffer.get()); 54 return; 55 } 56 57 String unprefixedValue = variableValue.substring(2); 58 59 // Now parse the unprefixed string as a hexadecimal number. 60 bool parsedSuccessfully = false; 61 unsigned logLevel = unprefixedValue.toUIntStrict(&parsedSuccessfully, 16); 62 63 if (!parsedSuccessfully) { 64 LOG_ERROR("Unable to parse hex value for %s (%s), logging is off", channel.defaultName, buffer.get()); 65 return; 66 } 67 68 if ((logLevel & channel.mask) == channel.mask) 69 channel.state = WTFLogChannelOn; 70 else 71 channel.state = WTFLogChannelOff; 72 } 73 74 void initializeLoggingChannelsIfNecessary() 75 { 76 static bool haveInitializedLoggingChannels = false; 77 if (haveInitializedLoggingChannels) 78 return; 79 haveInitializedLoggingChannels = true; 80 81 initializeWithUserDefault(LogNotYetImplemented); 82 initializeWithUserDefault(LogFrames); 83 initializeWithUserDefault(LogLoading); 84 initializeWithUserDefault(LogPopupBlocking); 85 initializeWithUserDefault(LogEvents); 86 initializeWithUserDefault(LogEditing); 87 initializeWithUserDefault(LogLiveConnect); 88 initializeWithUserDefault(LogIconDatabase); 89 initializeWithUserDefault(LogSQLDatabase); 90 initializeWithUserDefault(LogSpellingAndGrammar); 91 initializeWithUserDefault(LogBackForward); 92 initializeWithUserDefault(LogHistory); 93 initializeWithUserDefault(LogPageCache); 94 initializeWithUserDefault(LogPlatformLeaks); 95 initializeWithUserDefault(LogResourceLoading); 96 initializeWithUserDefault(LogAnimations); 97 initializeWithUserDefault(LogNetwork); 98 initializeWithUserDefault(LogFTP); 99 initializeWithUserDefault(LogThreading); 100 initializeWithUserDefault(LogStorageAPI); 101 initializeWithUserDefault(LogMedia); 102 initializeWithUserDefault(LogPlugins); 103 initializeWithUserDefault(LogArchives); 104 initializeWithUserDefault(LogProgress); 105 initializeWithUserDefault(LogFileAPI); 50 return String(buffer.get()); 106 51 } 107 52 -
trunk/Source/WebKit/blackberry/Api/BlackBerryGlobal.cpp
r150062 r153736 26 26 #include "FontCache.h" 27 27 #include "ImageSource.h" 28 #include "InitializeLogging.h"29 28 #include "InitializeThreading.h" 30 29 #include "JSDOMWindow.h" 31 #include " VM.h"30 #include "Logging.h" 32 31 #include "MemoryCache.h" 33 32 #include "NetworkStateNotifier.h" … … 37 36 #include "Settings.h" 38 37 #include "TextureCacheCompositingThread.h" 38 #include "VM.h" 39 39 #include "bindings/js/GCController.h" 40 40 #include "runtime/JSLock.h" -
trunk/Source/WebKit/blackberry/ChangeLog
r153562 r153736 1 2013-07-27 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * Api/BlackBerryGlobal.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 28 1 29 2013-07-31 Jacky Jiang <zhajiang@blackberry.com> 2 30 -
trunk/Source/WebKit/efl/ChangeLog
r153408 r153736 1 2013-07-27 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * ewk/ewk_main.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 28 1 29 2013-07-27 Jacky Jiang <zhajiang@blackberry.com> 2 30 -
trunk/Source/WebKit/efl/ewk/ewk_main.cpp
r139541 r153736 23 23 24 24 #include "FileSystem.h" 25 #include " InitializeLogging.h"25 #include "Logging.h" 26 26 #include "PageCache.h" 27 27 #include "PageGroup.h" -
trunk/Source/WebKit/gtk/ChangeLog
r153652 r153736 1 2013-07-27 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * webkit/webkitglobals.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 28 1 29 2013-08-02 Mario Sanchez Prada <mario.prada@samsung.com> 2 30 -
trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp
r152483 r153736 27 27 #include "FrameNetworkingContextGtk.h" 28 28 #include "IconDatabase.h" 29 #include " InitializeLogging.h"29 #include "Logging.h" 30 30 #include "MemoryCache.h" 31 31 #include "Page.h" 32 32 #include "PageCache.h" 33 33 #include "PageGroup.h" 34 #include "PlatformStrategiesGtk.h"35 #include "TextEncodingRegistry.h"36 34 #include "Pasteboard.h" 37 35 #include "PasteboardHelperGtk.h" 36 #include "PlatformStrategiesGtk.h" 38 37 #include "ResourceHandle.h" 39 38 #include "ResourceHandleClient.h" … … 41 40 #include "ResourceResponse.h" 42 41 #include "SchemeRegistry.h" 42 #include "TextEncodingRegistry.h" 43 43 #include "webkitapplicationcache.h" 44 44 #include "webkitfavicondatabase.h" -
trunk/Source/WebKit/mac/ChangeLog
r153633 r153736 1 2013-07-26 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * Misc/WebKitLogging.h: Declare a WEBKIT_LOG_CHANNELS macro that can be used to apply a preprocessor macro 28 across the set of all logging channels. Use this macro to declare the logging channels. 29 * Misc/WebKitLogging.m: Use WEBKIT_LOG_CHANNELS to define all of the channels. Pass the channels and the 30 preference value to the new WTF function that handles the initialization. 31 * WebView/WebPreferenceKeysPrivate.h: Remove a key that does not need to be here. 32 * WebView/WebView.mm: Switch from WebCore's InitializeLogging.h to Logging.h. 33 1 34 2013-08-01 Ruth Fong <ruth_fong@apple.com> 2 35 -
trunk/Source/WebKit/mac/Misc/WebKitLogging.h
r121707 r153736 1 1 /* 2 * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2007, 2008, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 38 38 39 39 #if !LOG_DISABLED 40 extern WTFLogChannel WebKitLogTiming; 41 extern WTFLogChannel WebKitLogLoading; 42 extern WTFLogChannel WebKitLogFontCache; 43 extern WTFLogChannel WebKitLogFontSubstitution; 44 extern WTFLogChannel WebKitLogFontSelection; 45 extern WTFLogChannel WebKitLogDownload; 46 extern WTFLogChannel WebKitLogDocumentLoad; 47 extern WTFLogChannel WebKitLogPlugins; 48 extern WTFLogChannel WebKitLogEvents; 49 extern WTFLogChannel WebKitLogView; 50 extern WTFLogChannel WebKitLogRedirect; 51 extern WTFLogChannel WebKitLogPageCache; 52 extern WTFLogChannel WebKitLogCacheSizes; 53 extern WTFLogChannel WebKitLogFormDelegate; 54 extern WTFLogChannel WebKitLogFileDatabaseActivity; 55 extern WTFLogChannel WebKitLogHistory; 56 extern WTFLogChannel WebKitLogBindings; 57 extern WTFLogChannel WebKitLogEncoding; 58 extern WTFLogChannel WebKitLogLiveConnect; 59 extern WTFLogChannel WebKitLogBackForward; 60 extern WTFLogChannel WebKitLogProgress; 61 extern WTFLogChannel WebKitLogPluginEvents; 62 extern WTFLogChannel WebKitLogIconDatabase; 63 extern WTFLogChannel WebKitLogTextInput; 40 41 #define WEBKIT_LOG_CHANNELS(M) \ 42 M(BackForward) \ 43 M(Bindings) \ 44 M(CacheSizes) \ 45 M(DocumentLoad) \ 46 M(Download) \ 47 M(Encoding) \ 48 M(Events) \ 49 M(FileDatabaseActivity) \ 50 M(FontCache) \ 51 M(FontSelection) \ 52 M(FontSubstitution) \ 53 M(FormDelegate) \ 54 M(History) \ 55 M(IconDatabase) \ 56 M(LiveConnect) \ 57 M(Loading) \ 58 M(PageCache) \ 59 M(PluginEvents) \ 60 M(Plugins) \ 61 M(Progress) \ 62 M(Redirect) \ 63 M(TextInput) \ 64 M(Timing) \ 65 M(View) \ 66 67 #define DECLARE_LOG_CHANNEL(name) \ 68 extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name); 69 70 WEBKIT_LOG_CHANNELS(DECLARE_LOG_CHANNEL) 71 72 #undef DECLARE_LOG_CHANNEL 64 73 65 74 void WebKitInitializeLoggingChannelsIfNecessary(void); -
trunk/Source/WebKit/mac/Misc/WebKitLogging.m
r141447 r153736 1 1 /* 2 * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #if !LOG_DISABLED 32 32 33 WTFLogChannel WebKitLogTextInput = { 0x00000010, "WebKitLogLevel", WTFLogChannelOff }; 34 WTFLogChannel WebKitLogTiming = { 0x00000020, "WebKitLogLevel", WTFLogChannelOff }; 35 WTFLogChannel WebKitLogLoading = { 0x00000040, "WebKitLogLevel", WTFLogChannelOff }; 36 WTFLogChannel WebKitLogFontCache = { 0x00000100, "WebKitLogLevel", WTFLogChannelOff }; 37 WTFLogChannel WebKitLogFontSubstitution = { 0x00000200, "WebKitLogLevel", WTFLogChannelOff }; 38 WTFLogChannel WebKitLogDownload = { 0x00000800, "WebKitLogLevel", WTFLogChannelOff }; 39 WTFLogChannel WebKitLogDocumentLoad = { 0x00001000, "WebKitLogLevel", WTFLogChannelOff }; 40 WTFLogChannel WebKitLogPlugins = { 0x00002000, "WebKitLogLevel", WTFLogChannelOff }; 41 WTFLogChannel WebKitLogEvents = { 0x00010000, "WebKitLogLevel", WTFLogChannelOff }; 42 WTFLogChannel WebKitLogView = { 0x00020000, "WebKitLogLevel", WTFLogChannelOff }; 43 WTFLogChannel WebKitLogRedirect = { 0x00040000, "WebKitLogLevel", WTFLogChannelOff }; 44 WTFLogChannel WebKitLogPageCache = { 0x00080000, "WebKitLogLevel", WTFLogChannelOff }; 45 WTFLogChannel WebKitLogCacheSizes = { 0x00100000, "WebKitLogLevel", WTFLogChannelOff }; 46 WTFLogChannel WebKitLogFormDelegate = { 0x00200000, "WebKitLogLevel", WTFLogChannelOff }; 47 WTFLogChannel WebKitLogFileDatabaseActivity = { 0x00400000, "WebKitLogLevel", WTFLogChannelOff }; 48 WTFLogChannel WebKitLogHistory = { 0x00800000, "WebKitLogLevel", WTFLogChannelOff }; 49 WTFLogChannel WebKitLogBindings = { 0x01000000, "WebKitLogLevel", WTFLogChannelOff }; 50 WTFLogChannel WebKitLogFontSelection = { 0x02000000, "WebKitLogLevel", WTFLogChannelOff }; 51 WTFLogChannel WebKitLogEncoding = { 0x04000000, "WebKitLogLevel", WTFLogChannelOff }; 52 WTFLogChannel WebKitLogLiveConnect = { 0x08000000, "WebKitLogLevel", WTFLogChannelOff }; 53 WTFLogChannel WebKitLogBackForward = { 0x10000000, "WebKitLogLevel", WTFLogChannelOff }; 54 WTFLogChannel WebKitLogProgress = { 0x20000000, "WebKitLogLevel", WTFLogChannelOff }; 55 WTFLogChannel WebKitLogPluginEvents = { 0x40000000, "WebKitLogLevel", WTFLogChannelOff }; 56 WTFLogChannel WebKitLogIconDatabase = { 0x80000000, "WebKitLogLevel", WTFLogChannelOff }; 33 #define DEFINE_LOG_CHANNEL(name) \ 34 WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name }; 35 WEBKIT_LOG_CHANNELS(DEFINE_LOG_CHANNEL) 57 36 58 static void initializeLogChannel(WTFLogChannel *channel) 59 { 60 NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]]; 37 #define LOG_CHANNEL_ADDRESS(name) &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name), 38 static WTFLogChannel* logChannels[] = { 39 WEBKIT_LOG_CHANNELS(LOG_CHANNEL_ADDRESS) 40 }; 61 41 62 // If there's no log level string from the user defaults, don't obliterate the compiled in values. 63 if (logLevelString) { 64 channel->state = WTFLogChannelOff; 65 unsigned logLevel; 66 if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel]) 67 NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString); 68 if ((logLevel & channel->mask) == channel->mask) 69 channel->state = WTFLogChannelOn; 70 } 71 } 42 static const size_t logChannelCount = sizeof(logChannels) / sizeof(logChannels[0]); 43 44 45 static NSString * const defaultsDomain = @"WebKitLogging"; 72 46 73 47 void WebKitInitializeLoggingChannelsIfNecessary() … … 77 51 return; 78 52 haveInitializedLoggingChannels = true; 53 54 NSString *logLevel = [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain]; 55 if (!logLevel) 56 return; 79 57 80 initializeLogChannel(&WebKitLogTiming); 81 initializeLogChannel(&WebKitLogLoading); 82 initializeLogChannel(&WebKitLogFontCache); 83 initializeLogChannel(&WebKitLogFontSubstitution); 84 initializeLogChannel(&WebKitLogDownload); 85 initializeLogChannel(&WebKitLogDocumentLoad); 86 initializeLogChannel(&WebKitLogPlugins); 87 initializeLogChannel(&WebKitLogEvents); 88 initializeLogChannel(&WebKitLogView); 89 initializeLogChannel(&WebKitLogRedirect); 90 initializeLogChannel(&WebKitLogPageCache); 91 initializeLogChannel(&WebKitLogCacheSizes); 92 initializeLogChannel(&WebKitLogFormDelegate); 93 initializeLogChannel(&WebKitLogFileDatabaseActivity); 94 initializeLogChannel(&WebKitLogHistory); 95 initializeLogChannel(&WebKitLogBindings); 96 initializeLogChannel(&WebKitLogFontSelection); 97 initializeLogChannel(&WebKitLogEncoding); 98 initializeLogChannel(&WebKitLogLiveConnect); 99 initializeLogChannel(&WebKitLogBackForward); 100 initializeLogChannel(&WebKitLogProgress); 101 initializeLogChannel(&WebKitLogPluginEvents); 102 initializeLogChannel(&WebKitLogIconDatabase); 103 initializeLogChannel(&WebKitLogTextInput); 58 WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, [logLevel UTF8String]); 104 59 } 60 105 61 #endif // !LOG_DISABLED 106 62 -
trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
r152234 r153736 30 30 // a Private (as opposed to Internal) header file because Safari uses some of them 31 31 // for managed preferences. 32 #define WebKitLogLevelPreferenceKey @"WebKitLogLevel"33 32 #define WebKitStandardFontPreferenceKey @"WebKitStandardFont" 34 33 #define WebKitFixedFontPreferenceKey @"WebKitFixedFont" -
trunk/Source/WebKit/mac/WebView/WebView.mm
r153549 r153736 143 143 #import <WebCore/HistoryItem.h> 144 144 #import <WebCore/IconDatabase.h> 145 #import <WebCore/InitializeLogging.h>146 145 #import <WebCore/JSCSSStyleDeclaration.h> 147 146 #import <WebCore/JSDocument.h> … … 149 148 #import <WebCore/JSNodeList.h> 150 149 #import <WebCore/JSNotification.h> 150 #import <WebCore/Logging.h> 151 #import <WebCore/MIMETypeRegistry.h> 151 152 #import <WebCore/MemoryPressureHandler.h> 152 #import <WebCore/MIMETypeRegistry.h>153 153 #import <WebCore/NodeList.h> 154 154 #import <WebCore/Notification.h> -
trunk/Source/WebKit/qt/ChangeLog
r153546 r153736 1 2013-07-27 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * WebCoreSupport/InitWebCoreQt.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 28 1 29 2013-07-31 Kwang Yul Seo <skyul@company100.net> 2 30 -
trunk/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp
r151642 r153736 35 35 #include "Font.h" 36 36 #include "Image.h" 37 #include " InitializeLogging.h"37 #include "Logging.h" 38 38 #include "MemoryCache.h" 39 39 #include "NotImplemented.h" -
trunk/Source/WebKit/win/ChangeLog
r153628 r153736 1 2013-07-26 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * WebKitLogging.cpp: Declare a WEBKIT_LOG_CHANNELS macro that can be used to apply a preprocessor macro across 28 the set of all logging channels. Use this macro to declare the logging channels. 29 * WebKitLogging.h: Use WEBKIT_LOG_CHANNELS to define all of the channels. Pass the channels to the new WTF 30 function that handles the initialization. As per the previous implementation a developer needs to hard-code 31 their desired log level here. 32 * WebView.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 33 1 34 2013-08-01 Brent Fulgham <bfulgham@apple.com> 2 35 -
trunk/Source/WebKit/win/WebKitLogging.cpp
r52754 r153736 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 30 29 #include "WebKitLogging.h" 31 30 32 WTFLogChannel WebKitLogTextInput = { 0x00000010, "WebKitLogLevel", WTFLogChannelOff }; 33 WTFLogChannel WebKitLogTiming = { 0x00000020, "WebKitLogLevel", WTFLogChannelOff }; 34 WTFLogChannel WebKitLogLoading = { 0x00000040, "WebKitLogLevel", WTFLogChannelOff }; 35 WTFLogChannel WebKitLogFontCache = { 0x00000100, "WebKitLogLevel", WTFLogChannelOff }; 36 WTFLogChannel WebKitLogFontSubstitution = { 0x00000200, "WebKitLogLevel", WTFLogChannelOff }; 37 WTFLogChannel WebKitLogDownload = { 0x00000800, "WebKitLogLevel", WTFLogChannelOff }; 38 WTFLogChannel WebKitLogDocumentLoad = { 0x00001000, "WebKitLogLevel", WTFLogChannelOff }; 39 WTFLogChannel WebKitLogPlugins = { 0x00002000, "WebKitLogLevel", WTFLogChannelOff }; 40 WTFLogChannel WebKitLogEvents = { 0x00010000, "WebKitLogLevel", WTFLogChannelOff }; 41 WTFLogChannel WebKitLogView = { 0x00020000, "WebKitLogLevel", WTFLogChannelOff }; 42 WTFLogChannel WebKitLogRedirect = { 0x00040000, "WebKitLogLevel", WTFLogChannelOff }; 43 WTFLogChannel WebKitLogPageCache = { 0x00080000, "WebKitLogLevel", WTFLogChannelOff }; 44 WTFLogChannel WebKitLogCacheSizes = { 0x00100000, "WebKitLogLevel", WTFLogChannelOff }; 45 WTFLogChannel WebKitLogFormDelegate = { 0x00200000, "WebKitLogLevel", WTFLogChannelOff }; 46 WTFLogChannel WebKitLogFileDatabaseActivity = { 0x00400000, "WebKitLogLevel", WTFLogChannelOff }; 47 WTFLogChannel WebKitLogHistory = { 0x00800000, "WebKitLogLevel", WTFLogChannelOff }; 48 WTFLogChannel WebKitLogBindings = { 0x01000000, "WebKitLogLevel", WTFLogChannelOff }; 49 WTFLogChannel WebKitLogFontSelection = { 0x02000000, "WebKitLogLevel", WTFLogChannelOff }; 50 WTFLogChannel WebKitLogEncoding = { 0x04000000, "WebKitLogLevel", WTFLogChannelOff }; 51 WTFLogChannel WebKitLogLiveConnect = { 0x08000000, "WebKitLogLevel", WTFLogChannelOff }; 52 WTFLogChannel WebKitLogBackForward = { 0x10000000, "WebKitLogLevel", WTFLogChannelOff }; 53 WTFLogChannel WebKitLogProgress = { 0x20000000, "WebKitLogLevel", WTFLogChannelOff }; 54 WTFLogChannel WebKitLogPluginEvents = { 0x40000000, "WebKitLogLevel", WTFLogChannelOff }; 55 WTFLogChannel WebKitLogIconDatabase = { 0x80000000, "WebKitLogLevel", WTFLogChannelOff }; 31 #define DEFINE_LOG_CHANNEL(name) \ 32 WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name }; 33 WEBKIT_LOG_CHANNELS(DEFINE_LOG_CHANNEL) 56 34 57 static void initializeLogChannel(WTFLogChannel *) 58 { 59 // FIXME: Get the LogChannel preferences from somewhere, otherwise people will have to hard code 60 // the logging channels they want to WTFLogChannelOn 61 /* 62 channel->state = WTFLogChannelOff; 63 NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]]; 64 if (logLevelString) { 65 unsigned logLevel; 66 if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel]) 67 NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString); 68 if ((logLevel & channel->mask) == channel->mask) 69 channel->state = WTFLogChannelOn; 70 } 71 */ 72 } 35 #define LOG_CHANNEL_ADDRESS(name) &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name), 36 static WTFLogChannel* logChannels[] = { 37 WEBKIT_LOG_CHANNELS(LOG_CHANNEL_ADDRESS) 38 }; 39 40 static const size_t logChannelCount = sizeof(logChannels) / sizeof(logChannels[0]); 73 41 74 42 void WebKitInitializeLoggingChannelsIfNecessary() … … 78 46 return; 79 47 haveInitializedLoggingChannels = true; 80 81 initializeLogChannel(&WebKitLogTextInput); 82 initializeLogChannel(&WebKitLogTiming); 83 initializeLogChannel(&WebKitLogLoading); 84 initializeLogChannel(&WebKitLogFontCache); 85 initializeLogChannel(&WebKitLogFontSubstitution); 86 initializeLogChannel(&WebKitLogDownload); 87 initializeLogChannel(&WebKitLogDocumentLoad); 88 initializeLogChannel(&WebKitLogPlugins); 89 initializeLogChannel(&WebKitLogEvents); 90 initializeLogChannel(&WebKitLogView); 91 initializeLogChannel(&WebKitLogRedirect); 92 initializeLogChannel(&WebKitLogPageCache); 93 initializeLogChannel(&WebKitLogCacheSizes); 94 initializeLogChannel(&WebKitLogFormDelegate); 95 initializeLogChannel(&WebKitLogFileDatabaseActivity); 96 initializeLogChannel(&WebKitLogHistory); 97 initializeLogChannel(&WebKitLogBindings); 98 initializeLogChannel(&WebKitLogFontSelection); 99 initializeLogChannel(&WebKitLogEncoding); 100 initializeLogChannel(&WebKitLogLiveConnect); 101 initializeLogChannel(&WebKitLogBackForward); 102 initializeLogChannel(&WebKitLogProgress); 103 initializeLogChannel(&WebKitLogPluginEvents); 104 initializeLogChannel(&WebKitLogIconDatabase); 48 49 // FIXME: Get the log channel string from somewhere so people don't have to hardcode it here. 50 WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, ""); 105 51 } 106 -
trunk/Source/WebKit/win/WebKitLogging.h
r52754 r153736 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 36 35 #endif 37 36 37 #define WEBKIT_LOG_CHANNELS(M) \ 38 M(BackForward) \ 39 M(Bindings) \ 40 M(CacheSizes) \ 41 M(DocumentLoad) \ 42 M(Download) \ 43 M(Encoding) \ 44 M(Events) \ 45 M(FileDatabaseActivity) \ 46 M(FontCache) \ 47 M(FontSelection) \ 48 M(FontSubstitution) \ 49 M(FormDelegate) \ 50 M(History) \ 51 M(IconDatabase) \ 52 M(LiveConnect) \ 53 M(Loading) \ 54 M(PageCache) \ 55 M(PluginEvents) \ 56 M(Plugins) \ 57 M(Progress) \ 58 M(Redirect) \ 59 M(TextInput) \ 60 M(Timing) \ 61 M(View) \ 38 62 39 extern WTFLogChannel WebKitLogTextInput; 40 extern WTFLogChannel WebKitLogTiming; 41 extern WTFLogChannel WebKitLogLoading; 42 extern WTFLogChannel WebKitLogFontCache; 43 extern WTFLogChannel WebKitLogFontSubstitution; 44 extern WTFLogChannel WebKitLogFontSelection; 45 extern WTFLogChannel WebKitLogDownload; 46 extern WTFLogChannel WebKitLogDocumentLoad; 47 extern WTFLogChannel WebKitLogPlugins; 48 extern WTFLogChannel WebKitLogEvents; 49 extern WTFLogChannel WebKitLogView; 50 extern WTFLogChannel WebKitLogRedirect; 51 extern WTFLogChannel WebKitLogPageCache; 52 extern WTFLogChannel WebKitLogCacheSizes; 53 extern WTFLogChannel WebKitLogFormDelegate; 54 extern WTFLogChannel WebKitLogFileDatabaseActivity; 55 extern WTFLogChannel WebKitLogHistory; 56 extern WTFLogChannel WebKitLogBindings; 57 extern WTFLogChannel WebKitLogEncoding; 58 extern WTFLogChannel WebKitLogLiveConnect; 59 extern WTFLogChannel WebKitLogBackForward; 60 extern WTFLogChannel WebKitLogProgress; 61 extern WTFLogChannel WebKitLogPluginEvents; 62 extern WTFLogChannel WebKitLogIconDatabase; 63 #define DECLARE_LOG_CHANNEL(name) \ 64 extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name); 65 66 WEBKIT_LOG_CHANNELS(DECLARE_LOG_CHANNEL) 67 68 #undef DECLARE_LOG_CHANNEL 63 69 64 70 void WebKitInitializeLoggingChannelsIfNecessary(void); -
trunk/Source/WebKit/win/WebView.cpp
r153628 r153736 105 105 #include <WebCore/HitTestRequest.h> 106 106 #include <WebCore/HitTestResult.h> 107 #include <WebCore/InitializeLogging.h>108 107 #include <WebCore/IntRect.h> 109 108 #include <WebCore/JSElement.h> 110 109 #include <WebCore/KeyboardEvent.h> 110 #include <WebCore/Logging.h> 111 111 #include <WebCore/MIMETypeRegistry.h> 112 112 #include <WebCore/MemoryCache.h> -
trunk/Source/WebKit2/ChangeLog
r153724 r153736 1 2013-07-26 Mark Rowe <mrowe@apple.com> 2 3 Logging should be configurable using human-readable channel names rather than crazy bitmasks 4 <http://webkit.org/b/119031> 5 6 Implement shared logic for initializing logging channels based on human-readable channel names in WTF, 7 and rework the WebCore, WebKit and WebKit2 logging initialization on top of it. 8 9 Logging channels may now be enabled by providing a comma-separated list of channel names, with the special 10 "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel 11 being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except 12 for history and loading being enabled. 13 14 For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow 15 the old user defaults to remain set for those people that need to switch between version of WebKit before and 16 after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel, 17 the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging. 18 19 For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for 20 consistency with the other platforms and to enable more code sharing. 21 22 While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when 23 adding a new logging channel. Now only the header in the relevant project needs to be updated. 24 25 Reviewed by Sam Weinig. 26 27 * NetworkProcess/NetworkProcess.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 28 * Platform/Logging.cpp: Use WEBKIT2_LOG_CHANNELS to define all of the channels. 29 (WebKit::initializeLogChannelsIfNecessary): Pass the channels and the log level string to the new WTF function 30 that handles the initialization. 31 (WebKit::logChannelByName): Renamed to match our naming conventions. Calls through to the new WTF function 32 to find a log channel rather than repeating the names of the log channels a further two times each. 33 (WebKit::logLevelString): Provide a no-op implementation. 34 * Platform/Logging.h: Declare a WEBKIT2_LOG_CHANNELS macro that can be used to apply a preprocessor macro 35 across the set of all logging channels. Use this macro to declare the logging channels. 36 * Platform/efl/LoggingEfl.cpp: 37 (WebKit::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable. 38 * Platform/gtk/LoggingGtk.cpp: 39 (WebKit::logLevelString): Ditto. 40 * Platform/mac/Logging.mac.mm: 41 (WebKit::logLevelString): Pull the value out of the WebKit2Logging user default key. 42 * Platform/qt/LoggingQt.cpp: 43 (WebKit::logLevelString): Pull the value out of the QT_WEBKIT_LOG environment variable. 44 * Shared/WebKit2Initialize.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 45 * UIProcess/WebContext.cpp: Switch from WebCore's InitializeLogging.h to Logging.h. 46 1 47 2013-08-05 Anders Carlsson <andersca@apple.com> 2 48 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r149413 r153736 43 43 #include "WebContextMessages.h" 44 44 #include "WebCookieManager.h" 45 #include <WebCore/ InitializeLogging.h>45 #include <WebCore/Logging.h> 46 46 #include <WebCore/ResourceRequest.h> 47 47 #include <WebCore/RunLoop.h> -
trunk/Source/WebKit2/Platform/Logging.cpp
r137486 r153736 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2011 Samsung Electronics 4 4 * … … 28 28 #include "Logging.h" 29 29 30 #include <wtf/text/CString.h> 31 30 32 #if !LOG_DISABLED 31 33 32 34 namespace WebKit { 33 35 34 WTFLogChannel LogSessionState = { 0x00000001, "WebKit2LogLevel", WTFLogChannelOff }; 35 WTFLogChannel LogContextMenu = { 0x00000002, "WebKit2LogLevel", WTFLogChannelOff }; 36 WTFLogChannel LogTextInput = { 0x00000004, "WebKit2LogLevel", WTFLogChannelOff }; 37 WTFLogChannel LogView = { 0x00000008, "WebKit2LogLevel", WTFLogChannelOff }; 38 WTFLogChannel LogIconDatabase = { 0x00000010, "WebKit2LogLevel", WTFLogChannelOff }; 39 WTFLogChannel LogKeyHandling = { 0x00000020, "WebKit2LogLevel", WTFLogChannelOff }; 40 WTFLogChannel LogPlugins = { 0x00000040, "WebKit2LogLevel", WTFLogChannelOff }; 41 WTFLogChannel LogNetwork = { 0x00000080, "WebKit2LogLevel", WTFLogChannelOff }; 42 WTFLogChannel LogNetworkScheduling = { 0x00000100, "WebKit2LogLevel", WTFLogChannelOff }; 43 WTFLogChannel LogInspectorServer = { 0x00000200, "WebKit2LogLevel", WTFLogChannelOff }; 36 #define DEFINE_LOG_CHANNEL(name) \ 37 WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name }; 38 WEBKIT2_LOG_CHANNELS(DEFINE_LOG_CHANNEL) 44 39 45 #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) 46 void initializeLogChannel(WTFLogChannel* channel) 47 { 48 // FIXME: Each platform will need to define their own initializeLogChannel(). 49 } 50 #endif 40 #define LOG_CHANNEL_ADDRESS(name) &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name), 41 static WTFLogChannel* logChannels[] = { 42 WEBKIT2_LOG_CHANNELS(LOG_CHANNEL_ADDRESS) 43 }; 51 44 52 #if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) 53 WTFLogChannel* getChannelFromName(const String& channelName) 54 { 55 if (!(channelName.length() >= 2)) 56 return 0; 57 58 if (equalIgnoringCase(channelName, String("SessionState"))) 59 return &LogSessionState; 60 61 if (equalIgnoringCase(channelName, String("ContextMenu"))) 62 return &LogContextMenu; 63 64 if (equalIgnoringCase(channelName, String("TextInput"))) 65 return &LogTextInput; 66 67 if (equalIgnoringCase(channelName, String("View"))) 68 return &LogView; 69 70 if (equalIgnoringCase(channelName, String("IconDatabase"))) 71 return &LogIconDatabase; 72 73 if (equalIgnoringCase(channelName, String("KeyHandling"))) 74 return &LogKeyHandling; 75 76 if (equalIgnoringCase(channelName, String("Plugins"))) 77 return &LogPlugins; 78 79 if (equalIgnoringCase(channelName, String("Network"))) 80 return &LogNetwork; 81 82 if (equalIgnoringCase(channelName, String("InspectorServer"))) 83 return &LogInspectorServer; 84 85 return 0; 86 } 87 #endif 45 const size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels); 88 46 89 47 void initializeLogChannelsIfNecessary() … … 94 52 haveInitializedLogChannels = true; 95 53 96 initializeLogChannel(&LogSessionState); 97 initializeLogChannel(&LogContextMenu); 98 initializeLogChannel(&LogTextInput); 99 initializeLogChannel(&LogView); 100 initializeLogChannel(&LogIconDatabase); 101 initializeLogChannel(&LogKeyHandling); 102 initializeLogChannel(&LogPlugins); 103 initializeLogChannel(&LogNetwork); 104 initializeLogChannel(&LogNetworkScheduling); 105 initializeLogChannel(&LogInspectorServer); 54 static bool haveInitializedLoggingChannels = false; 55 if (haveInitializedLoggingChannels) 56 return; 57 haveInitializedLoggingChannels = true; 58 59 WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, logLevelString().utf8().data()); 106 60 } 61 62 #if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) 63 WTFLogChannel* logChannelByName(const String& name) 64 { 65 return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data()); 66 } 67 #endif 68 69 #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) 70 String logLevelString() 71 { 72 // FIXME: Each platform will need to define their own logLevelString(); 73 return emptyString(); 74 } 75 #endif 107 76 108 77 } // namespace WebKit -
trunk/Source/WebKit2/Platform/Logging.h
r134600 r153736 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 34 34 #ifndef LOG_CHANNEL_PREFIX 35 #define LOG_CHANNEL_PREFIX Log35 #define LOG_CHANNEL_PREFIX WebKit2Log 36 36 #endif 37 37 38 38 namespace WebKit { 39 39 40 extern WTFLogChannel LogContextMenu; 41 extern WTFLogChannel LogIconDatabase; 42 extern WTFLogChannel LogInspectorServer; 43 extern WTFLogChannel LogKeyHandling; 44 extern WTFLogChannel LogPlugins; 45 extern WTFLogChannel LogSessionState; 46 extern WTFLogChannel LogTextInput; 47 extern WTFLogChannel LogView; 48 extern WTFLogChannel LogNetwork; 49 extern WTFLogChannel LogNetworkScheduling; 40 #define WEBKIT2_LOG_CHANNELS(M) \ 41 M(ContextMenu) \ 42 M(IconDatabase) \ 43 M(InspectorServer) \ 44 M(KeyHandling) \ 45 M(Network) \ 46 M(NetworkScheduling) \ 47 M(Plugins) \ 48 M(SessionState) \ 49 M(TextInput) \ 50 M(View) \ 50 51 51 void initializeLogChannel(WTFLogChannel*); 52 #define DECLARE_LOG_CHANNEL(name) \ 53 extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name); 54 55 WEBKIT2_LOG_CHANNELS(DECLARE_LOG_CHANNEL) 56 57 #undef DECLARE_LOG_CHANNEL 58 52 59 void initializeLogChannelsIfNecessary(void); 60 String logLevelString(); 61 53 62 #if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) 54 WTFLogChannel* getChannelFromName(const String& channelName);63 WTFLogChannel* logChannelByName(const String&); 55 64 #endif 56 65 -
trunk/Source/WebKit2/Platform/efl/LoggingEfl.cpp
r128537 r153736 1 1 /* 2 2 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 31 32 namespace WebKit { 32 33 33 void initializeLogChannel(WTFLogChannel* channel)34 String logLevelString() 34 35 { 35 DEFINE_STATIC_LOCAL(Vector<WTFLogChannel*>, activatedChannels, ()); 36 37 // Fill activatedChannels vector only once based on names set in logValue. 38 if (activatedChannels.isEmpty()) { 39 const String logValue = getenv("WEBKIT_DEBUG"); 40 if (logValue.isEmpty()) 41 return; 42 43 Vector<String> activatedNames; 44 logValue.split(',', activatedNames); 45 for (size_t i = 0; i < activatedNames.size(); i++) { 46 WTFLogChannel* activeChannel = getChannelFromName(activatedNames[i]); 47 if (activeChannel) 48 activatedChannels.append(activeChannel); 49 } 50 } 51 52 if (activatedChannels.contains(channel)) 53 channel->state = WTFLogChannelOn; 36 return getenv("WEBKIT_DEBUG"); 54 37 } 55 38 -
trunk/Source/WebKit2/Platform/gtk/LoggingGtk.cpp
r95901 r153736 1 1 /* 2 2 * Copyright (C) 2011 Samsung Electronics 3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 33 34 #if !LOG_DISABLED 34 35 35 void initializeLogChannel(WTFLogChannel* channel)36 String logLevelString() 36 37 { 37 static Vector<WTFLogChannel*> activatedChannels; 38 const static String logValue(g_getenv("WEBKIT_DEBUG")); 39 40 if (logValue.isEmpty()) 41 return; 42 43 // Fill activatedChannels vector only once based on names set in logValue. 44 if (activatedChannels.isEmpty()) { 45 static Vector<String> activatedNames; 46 logValue.split(" ", activatedNames); 47 for (unsigned int i = 0; i < activatedNames.size(); i++) { 48 WTFLogChannel* activeChannel = getChannelFromName(activatedNames[i]); 49 if (activeChannel) 50 activatedChannels.append(activeChannel); 51 } 52 } 53 54 if (activatedChannels.contains(channel)) 55 channel->state = WTFLogChannelOn; 38 return g_getenv("WEBKIT_DEBUG"); 56 39 } 57 40 -
trunk/Source/WebKit2/Platform/mac/Logging.mac.mm
r148509 r153736 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 #if !LOG_DISABLED 32 32 33 void initializeLogChannel(WTFLogChannel* channel) 33 static NSString * const defaultsDomain = @"WebKit2Logging"; 34 35 String logLevelString() 34 36 { 35 // If there is no log level string from the user defaults then don't change the logging channel at all. 36 NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]]; 37 if (!logLevelString) 38 return; 39 40 channel->state = WTFLogChannelOff; 41 42 unsigned logLevel; 43 if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel]) 44 NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString); 45 if ((logLevel & channel->mask) == channel->mask) 46 channel->state = WTFLogChannelOn; 37 return [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain]; 47 38 } 48 39 -
trunk/Source/WebKit2/Platform/qt/LoggingQt.cpp
r119517 r153736 2 2 * Copyright (C) 2011 Samsung Electronics 3 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2013 Apple Inc. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 29 30 30 31 #include <QDebug> 31 #include <QStringList>32 32 33 33 namespace WebKit { … … 35 35 #if !LOG_DISABLED 36 36 37 void initializeLogChannel(WTFLogChannel* channel)37 String logLevelString() 38 38 { 39 static Vector<WTFLogChannel*> activatedChannels; 40 41 QByteArray loggingEnv = qgetenv("QT_WEBKIT_LOG"); 42 if (loggingEnv.isEmpty()) 43 return; 44 45 // Fill activatedChannels vector only once based on names set in logValue. 46 if (activatedChannels.isEmpty()) { 47 QStringList channels = QString::fromLocal8Bit(loggingEnv).split(QLatin1String(",")); 48 for (int i = 0; i < channels.count(); i++) { 49 if (WTFLogChannel* activeChannel = getChannelFromName(channels.at(i))) 50 activatedChannels.append(activeChannel); 51 } 52 } 53 54 if (activatedChannels.contains(channel)) 55 channel->state = WTFLogChannelOn; 39 return QString::fromLocal8Bit(qgetenv("QT_WEBKIT_LOG")); 56 40 } 57 41 -
trunk/Source/WebKit2/Shared/WebKit2Initialize.cpp
r138881 r153736 28 28 29 29 #include "Logging.h" 30 #include <WebCore/ InitializeLogging.h>30 #include <WebCore/Logging.h> 31 31 #include <WebCore/RunLoop.h> 32 32 #include <runtime/InitializeThreading.h> -
trunk/Source/WebKit2/UIProcess/WebContext.cpp
r153616 r153736 57 57 #include "WebProcessProxy.h" 58 58 #include "WebResourceCacheManagerProxy.h" 59 #include <WebCore/InitializeLogging.h>60 59 #include <WebCore/Language.h> 61 60 #include <WebCore/LinkHash.h> 61 #include <WebCore/Logging.h> 62 62 #include <WebCore/ResourceRequest.h> 63 63 #include <WebCore/RunLoop.h>
Note:
See TracChangeset
for help on using the changeset viewer.