Changeset 91307 in webkit


Ignore:
Timestamp:
Jul 19, 2011 3:07:11 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] [WK2] Implement missing initializeLogChannel function.
https://bugs.webkit.org/show_bug.cgi?id=63381

Patch by Lukasz Slachciak <lukasz.slachciak@gmail.com> on 2011-07-19
Reviewed by Martin Robinson.

Implemented logging for GTK platform in WebKit2 - function initializeLogChannel is called for all ports,
so added missing implementation. Aslo helper function added for getting channels from names.

  • GNUmakefile.am: Added reference to new file LoggingGtk.cpp.
  • Platform/Logging.cpp: Logging implementation for GTK port enabled.

(WebKit::getChannelFromName): Helper to connect name with WTFLogChannel.

  • Platform/Logging.h: New helper method added.
  • Platform/gtk/LoggingGtk.cpp: Added. GTK logging implementation.

(WebKit::initializeLogChannel): Channel is initialized if its name is found in WEBKIT_DEBUG.

Location:
trunk/Source/WebKit2
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r91271 r91307  
     12011-07-19  Lukasz Slachciak  <lukasz.slachciak@gmail.com>
     2
     3        [GTK] [WK2] Implement missing initializeLogChannel function.
     4        https://bugs.webkit.org/show_bug.cgi?id=63381
     5
     6        Reviewed by Martin Robinson.
     7
     8        Implemented logging for GTK platform in WebKit2 - function initializeLogChannel is called for all ports,
     9        so added missing implementation. Aslo helper function added for getting channels from names.
     10
     11        * GNUmakefile.am: Added reference to new file LoggingGtk.cpp.
     12        * Platform/Logging.cpp: Logging implementation for GTK port enabled.
     13        (WebKit::getChannelFromName): Helper to connect name with WTFLogChannel.
     14        * Platform/Logging.h: New helper method added.
     15        * Platform/gtk/LoggingGtk.cpp: Added. GTK logging implementation.
     16        (WebKit::initializeLogChannel): Channel is initialized if its name is found in WEBKIT_DEBUG.
     17
    1182011-07-19  Brian Weinstein  <bweinstein@apple.com>
    219
  • trunk/Source/WebKit2/GNUmakefile.am

    r91078 r91307  
    169169        Source/WebKit2/Platform/CoreIPC/unix/AttachmentUnix.cpp \
    170170        Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp \
     171        Source/WebKit2/Platform/gtk/LoggingGtk.cpp \
    171172        Source/WebKit2/Platform/gtk/ModuleGtk.cpp \
    172173        Source/WebKit2/Platform/gtk/RunLoopGtk.cpp \
  • trunk/Source/WebKit2/Platform/Logging.cpp

    r87509 r91307  
    11/*
    22 * Copyright (C) 2010 Apple Inc. All rights reserved.
     3 * Copyright (C) 2011 Samsung Electronics
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3839WTFLogChannel LogKeyHandling  = { 0x00000020, "WebKit2LogLevel", WTFLogChannelOff };
    3940
    40 #if !PLATFORM(MAC)
     41#if !PLATFORM(MAC) && !PLATFORM(GTK)
    4142void initializeLogChannel(WTFLogChannel* channel)
    4243{
    4344    // FIXME: Each platform will need to define their own initializeLogChannel().
     45}
     46#endif
     47
     48#if PLATFORM(GTK)
     49WTFLogChannel* getChannelFromName(const String& channelName)
     50{
     51    if (!(channelName.length() >= 2))
     52        return 0;
     53
     54    if (equalIgnoringCase(channelName, String("SessionState")))
     55        return &LogSessionState;
     56
     57    if (equalIgnoringCase(channelName, String("ContextMenu")))
     58        return &LogContextMenu;
     59
     60    if (equalIgnoringCase(channelName, String("TextInput")))
     61        return &LogTextInput;
     62
     63    if (equalIgnoringCase(channelName, String("View")))
     64        return &LogView;
     65
     66    if (equalIgnoringCase(channelName, String("IconDatabase")))
     67        return &LogIconDatabase;
     68
     69    if (equalIgnoringCase(channelName, String("KeyHandling")))
     70        return &LogKeyHandling;
     71
     72    return 0;
    4473}
    4574#endif
  • trunk/Source/WebKit2/Platform/Logging.h

    r87509 r91307  
    2727#define WebKitLogging_h
    2828
     29#include "PlatformString.h"
    2930#include <wtf/Assertions.h>
    3031
     
    4647void initializeLogChannel(WTFLogChannel*);
    4748void initializeLogChannelsIfNecessary(void);
     49#if PLATFORM(GTK)
     50WTFLogChannel* getChannelFromName(const String& channelName);
     51#endif
    4852
    4953} // namespace WebKit
  • trunk/Source/WebKit2/Platform/gtk/LoggingGtk.cpp

    r91306 r91307  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011 Samsung Electronics
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef WebKitLogging_h
    27 #define WebKitLogging_h
     26#include "config.h"
     27#include "Logging.h"
    2828
    29 #include <wtf/Assertions.h>
     29#include <glib.h>
     30
     31namespace WebKit {
    3032
    3133#if !LOG_DISABLED
    3234
    33 #ifndef LOG_CHANNEL_PREFIX
    34 #define LOG_CHANNEL_PREFIX Log
    35 #endif
     35void initializeLogChannel(WTFLogChannel* channel)
     36{
     37    static Vector<WTFLogChannel*> activatedChannels;
     38    const static String logValue(g_getenv("WEBKIT_DEBUG"));
    3639
    37 namespace WebKit {
     40    if (logValue.isEmpty())
     41        return;
    3842
    39 extern WTFLogChannel LogContextMenu;
    40 extern WTFLogChannel LogIconDatabase;
    41 extern WTFLogChannel LogKeyHandling;
    42 extern WTFLogChannel LogSessionState;
    43 extern WTFLogChannel LogTextInput;
    44 extern WTFLogChannel LogView;
     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    }
    4553
    46 void initializeLogChannel(WTFLogChannel*);
    47 void initializeLogChannelsIfNecessary(void);
     54    if (activatedChannels.contains(channel))
     55        channel->state = WTFLogChannelOn;
     56}
    4857
    49 } // namespace WebKit
     58#endif // !LOG_DISABLED
    5059
    51 #endif // LOG_DISABLED
    52 
    53 #endif // Logging_h
     60}
Note: See TracChangeset for help on using the changeset viewer.