Changeset 199815 in webkit


Ignore:
Timestamp:
Apr 21, 2016 8:12:11 AM (8 years ago)
Author:
Claudio Saavedra
Message:

[GTK][EFL] Move non-glib/gtk platform implementations out of platform/gtk
https://bugs.webkit.org/show_bug.cgi?id=156847

Reviewed by Carlos Garcia Campos.

The Language and Logging implementation don't really need glib, so
rework them and move them to a new platform/unix directory so that
they can be shared among Unix ports.

  • PlatformEfl.cmake: Use the unix version.
  • PlatformGTK.cmake: Same.
  • platform/efl/LanguageEfl.cpp: Removed.
  • platform/efl/LoggingEfl.cpp: Removed.
  • platform/unix/LanguageUnix.cpp: Renamed from Source/WebCore/platform/gtk/LanguageGtk.cpp.

(WebCore::platformLanguage):
(WebCore::platformUserPreferredLanguages):

  • platform/unix/LoggingUnix.cpp: Renamed from Source/WebCore/platform/gtk/LoggingGtk.cpp.

(WebCore::logLevelString):

Location:
trunk/Source/WebCore
Files:
1 added
2 deleted
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199809 r199815  
     12016-04-21  Claudio Saavedra  <csaavedra@igalia.com>
     2
     3        [GTK][EFL] Move non-glib/gtk platform implementations out of platform/gtk
     4        https://bugs.webkit.org/show_bug.cgi?id=156847
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        The Language and Logging implementation don't really need glib, so
     9        rework them and move them to a new platform/unix directory so that
     10        they can be shared among Unix ports.
     11
     12        * PlatformEfl.cmake: Use the unix version.
     13        * PlatformGTK.cmake: Same.
     14        * platform/efl/LanguageEfl.cpp: Removed.
     15        * platform/efl/LoggingEfl.cpp: Removed.
     16        * platform/unix/LanguageUnix.cpp: Renamed from Source/WebCore/platform/gtk/LanguageGtk.cpp.
     17        (WebCore::platformLanguage):
     18        (WebCore::platformUserPreferredLanguages):
     19        * platform/unix/LoggingUnix.cpp: Renamed from Source/WebCore/platform/gtk/LoggingGtk.cpp.
     20        (WebCore::logLevelString):
     21
    1222016-04-21  Nan Wang  <n_wang@apple.com>
    223
  • trunk/Source/WebCore/PlatformEfl.cmake

    r199562 r199815  
    100100    platform/efl/FileSystemEfl.cpp
    101101    platform/efl/GamepadsEfl.cpp
    102     platform/efl/LanguageEfl.cpp
    103102    platform/efl/LocalizedStringsEfl.cpp
    104     platform/efl/LoggingEfl.cpp
    105103    platform/efl/MIMETypeRegistryEfl.cpp
    106104    platform/efl/MainThreadSharedTimerEfl.cpp
     
    220218
    221219    platform/text/hyphen/HyphenationLibHyphen.cpp
     220
     221    platform/unix/LanguageUnix.cpp
     222    platform/unix/LoggingUnix.cpp
    222223
    223224    rendering/RenderThemeEfl.cpp
  • trunk/Source/WebCore/PlatformGTK.cmake

    r199772 r199815  
    142142
    143143    platform/gtk/ErrorsGtk.cpp
    144     platform/gtk/LanguageGtk.cpp
    145     platform/gtk/LoggingGtk.cpp
    146144    platform/gtk/MIMETypeRegistryGtk.cpp
    147145    platform/gtk/ScrollAnimatorGtk.cpp
     
    185183
    186184    platform/text/hyphen/HyphenationLibHyphen.cpp
     185
     186    platform/unix/LanguageUnix.cpp
     187    platform/unix/LoggingUnix.cpp
    187188)
    188189
  • trunk/Source/WebCore/platform/unix/LanguageUnix.cpp

    r199814 r199815  
    2121#include "Language.h"
    2222
     23#include <locale.h>
    2324#include <wtf/Vector.h>
    24 #include <wtf/glib/GUniquePtr.h>
    25 #include <wtf/text/CString.h>
    2625#include <wtf/text/WTFString.h>
    27 
    28 #include <glib.h>
    29 #include <locale.h>
    3026
    3127namespace WebCore {
     
    3632static String platformLanguage()
    3733{
    38     char* localeDefault = setlocale(LC_CTYPE, NULL);
    39 
    40     if (!localeDefault)
     34    String localeDefault(setlocale(LC_CTYPE, nullptr));
     35    if (localeDefault.isEmpty())
    4136        return String("c");
    4237
    43     GUniquePtr<gchar> normalizedDefault(g_ascii_strdown(localeDefault, -1));
    44     char* ptr = strchr(normalizedDefault.get(), '_');
    45 
    46     if (ptr)
    47         *ptr = '-';
    48 
    49     ptr = strchr(normalizedDefault.get(), '.');
    50 
    51     if (ptr)
    52         *ptr = '\0';
    53 
    54     return String(normalizedDefault.get());
     38    String normalizedDefault = localeDefault.convertToASCIILowercase();
     39    normalizedDefault.replace('_', '-');
     40    normalizedDefault.truncate(normalizedDefault.find('.'));
     41    return normalizedDefault;
    5542}
    5643
    5744Vector<String> platformUserPreferredLanguages()
    5845{
    59     Vector<String> userPreferredLanguages;
    60     userPreferredLanguages.append(platformLanguage());
    61     return userPreferredLanguages;
     46    return { platformLanguage() };
    6247}
    63    
     48
    6449}
  • trunk/Source/WebCore/platform/unix/LoggingUnix.cpp

    r199814 r199815  
    2525#if !LOG_DISABLED
    2626
    27 #include <glib.h>
    2827#include <string.h>
    2928#include <wtf/text/WTFString.h>
     
    3938    // We set up the logs anyway because some of our logging, such as Soup's is available in release builds.
    4039#if defined(NDEBUG)
    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.");
     40    WTFLogAlways("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build.");
    4241#endif
    4342
    4443    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
    45     String logLevel = "NotYetImplemented,";
    46     logLevel.append(logEnv);
    47     return logLevel;
     44    return String("NotYetImplemented,") + logEnv;
    4845}
    4946
Note: See TracChangeset for help on using the changeset viewer.