Commit 05895654 authored by beidson@apple.com's avatar beidson@apple.com

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

Actually hook up WebKit2 logging on Mac.

Reviewed by Brian Weinstein.

* Platform/Logging.cpp:
(WebKit::initializeLogChannel):
* Platform/Logging.h:
* Platform/mac/Logging.mac.mm: Added.
(WebKit::initializeLogChannel):
 
       * UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext): Initialize logging if necessary.

* WebKit2.xcodeproj/project.pbxproj:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0740d9e9
2011-03-21 Brady Eidson <beidson@apple.com>
Reviewed by Brian Weinstein.
https://bugs.webkit.org/show_bug.cgi?id=56783
Actually hook up WebKit2 logging on Mac.
* Platform/Logging.cpp:
(WebKit::initializeLogChannel):
* Platform/Logging.h:
* Platform/mac/Logging.mac.mm: Added.
(WebKit::initializeLogChannel):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext): Initialize logging if necessary.
* WebKit2.xcodeproj/project.pbxproj:
2011-03-21 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
......
......@@ -28,15 +28,19 @@
#if !LOG_DISABLED
namespace WebKit {
WTFLogChannel LogSessionState = { 0x00000001, "WebKit2LogLevel", WTFLogChannelOff };
WTFLogChannel LogContextMenu = { 0x00000002, "WebKit2LogLevel", WTFLogChannelOff };
WTFLogChannel LogTextInput = { 0x00000004, "WebKit2LogLevel", WTFLogChannelOff };
WTFLogChannel LogView = { 0x00000008, "WebKit2LogLevel", WTFLogChannelOff };
static inline void initializeLogChannel(WTFLogChannel* channel)
#if !PLATFORM(MAC)
void initializeLogChannel(WTFLogChannel* channel)
{
// FIXME: This is a build fix. Each platform will need to define their own initializeLogChannel().
// FIXME: Each platform will need to define their own initializeLogChannel().
}
#endif
void initializeLogChannelsIfNecessary()
{
......@@ -51,4 +55,6 @@ void initializeLogChannelsIfNecessary()
initializeLogChannel(&LogView);
}
} // namespace WebKit
#endif // LOG_DISABLED
......@@ -23,8 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Logging_h
#define Logging_h
#ifndef WebKitLogging_h
#define WebKitLogging_h
#include <wtf/Assertions.h>
......@@ -34,16 +34,17 @@
#define LOG_CHANNEL_PREFIX Log
#endif
EXTERN_C_BEGIN
namespace WebKit {
extern WTFLogChannel LogContextMenu;
extern WTFLogChannel LogSessionState;
extern WTFLogChannel LogTextInput;
extern WTFLogChannel LogView;
void initializeLogChannel(WTFLogChannel*);
void initializeLogChannelsIfNecessary(void);
EXTERN_C_END
} // namespace WebKit
#endif // LOG_DISABLED
......
/*
* Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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"
namespace WebKit {
void initializeLogChannel(WTFLogChannel* channel)
{
channel->state = WTFLogChannelOff;
NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]];
if (!logLevelString)
return;
unsigned logLevel;
if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel])
NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString);
if ((logLevel & channel->mask) == channel->mask)
channel->state = WTFLogChannelOn;
}
} // namespace WebKit
......@@ -29,6 +29,7 @@
#include "DownloadProxy.h"
#include "ImmutableArray.h"
#include "InjectedBundleMessageKinds.h"
#include "Logging.h"
#include "RunLoop.h"
#include "SandboxExtension.h"
#include "TextChecker.h"
......@@ -125,6 +126,10 @@ WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePa
, m_shouldPaintNativeControls(true)
#endif
{
#ifndef NDEBUG
WebKit::initializeLogChannelsIfNecessary();
#endif
contexts().append(this);
addLanguageChangeObserver(this, languageChanged);
......
......@@ -309,6 +309,7 @@
5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */; };
5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */; };
51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
5160BFE113381DF900918999 /* Logging.mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160BFE013381DF900918999 /* Logging.mac.mm */; };
516A4A5D120A2CCD00C05B7F /* WebError.h in Headers */ = {isa = PBXBuildFile; fileRef = 516A4A5B120A2CCD00C05B7F /* WebError.h */; };
51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; };
51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 51871B5A127CB89D00F76232 /* WebContextMenu.h */; };
......@@ -1164,6 +1165,7 @@
5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageContextMenuClient.cpp; sourceTree = "<group>"; };
5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageContextMenuClient.h; sourceTree = "<group>"; };
51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
5160BFE013381DF900918999 /* Logging.mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Logging.mac.mm; sourceTree = "<group>"; };
516A4A5B120A2CCD00C05B7F /* WebError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebError.h; sourceTree = "<group>"; };
517A33B3130B308C00F80CB5 /* WKApplicationCacheManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKApplicationCacheManager.cpp; sourceTree = "<group>"; };
517A33B4130B308C00F80CB5 /* WKApplicationCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKApplicationCacheManager.h; sourceTree = "<group>"; };
......@@ -1955,6 +1957,7 @@
1A7E814E1152D2240003695B /* mac */ = {
isa = PBXGroup;
children = (
5160BFE013381DF900918999 /* Logging.mac.mm */,
1A24B5F011F531E800C38269 /* MachUtilities.cpp */,
1A24B5F111F531E800C38269 /* MachUtilities.h */,
C0E3AA481209E45000A49D01 /* ModuleMac.mm */,
......@@ -4146,6 +4149,7 @@
511B24AA132E097200065A0C /* WebIconDatabase.cpp in Sources */,
51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */,
51D02F6B132EC73700BEAA96 /* WebIconDatabaseProxyMessageReceiver.cpp in Sources */,
5160BFE113381DF900918999 /* Logging.mac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment