Title: [199815] trunk/Source/WebCore
Revision
199815
Author
csaave...@igalia.com
Date
2016-04-21 08:12:11 -0700 (Thu, 21 Apr 2016)

Log 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):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199814 => 199815)


--- trunk/Source/WebCore/ChangeLog	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/ChangeLog	2016-04-21 15:12:11 UTC (rev 199815)
@@ -1,3 +1,24 @@
+2016-04-21  Claudio Saavedra  <csaave...@igalia.com>
+
+        [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):
+
 2016-04-21  Nan Wang  <n_w...@apple.com>
 
         AX: stringForTextMarkerRange returning empty string for document range

Modified: trunk/Source/WebCore/PlatformEfl.cmake (199814 => 199815)


--- trunk/Source/WebCore/PlatformEfl.cmake	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/PlatformEfl.cmake	2016-04-21 15:12:11 UTC (rev 199815)
@@ -99,9 +99,7 @@
     platform/efl/EventLoopEfl.cpp
     platform/efl/FileSystemEfl.cpp
     platform/efl/GamepadsEfl.cpp
-    platform/efl/LanguageEfl.cpp
     platform/efl/LocalizedStringsEfl.cpp
-    platform/efl/LoggingEfl.cpp
     platform/efl/MIMETypeRegistryEfl.cpp
     platform/efl/MainThreadSharedTimerEfl.cpp
     platform/efl/PasteboardEfl.cpp
@@ -220,6 +218,9 @@
 
     platform/text/hyphen/HyphenationLibHyphen.cpp
 
+    platform/unix/LanguageUnix.cpp
+    platform/unix/LoggingUnix.cpp
+
     rendering/RenderThemeEfl.cpp
 )
 

Modified: trunk/Source/WebCore/PlatformGTK.cmake (199814 => 199815)


--- trunk/Source/WebCore/PlatformGTK.cmake	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2016-04-21 15:12:11 UTC (rev 199815)
@@ -141,8 +141,6 @@
     platform/graphics/x11/XUniqueResource.cpp
 
     platform/gtk/ErrorsGtk.cpp
-    platform/gtk/LanguageGtk.cpp
-    platform/gtk/LoggingGtk.cpp
     platform/gtk/MIMETypeRegistryGtk.cpp
     platform/gtk/ScrollAnimatorGtk.cpp
     platform/gtk/TemporaryLinkStubs.cpp
@@ -184,6 +182,9 @@
     platform/text/gtk/TextBreakIteratorInternalICUGtk.cpp
 
     platform/text/hyphen/HyphenationLibHyphen.cpp
+
+    platform/unix/LanguageUnix.cpp
+    platform/unix/LoggingUnix.cpp
 )
 
 list(APPEND WebCorePlatformGTK_SOURCES

Deleted: trunk/Source/WebCore/platform/efl/LanguageEfl.cpp (199814 => 199815)


--- trunk/Source/WebCore/platform/efl/LanguageEfl.cpp	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/platform/efl/LanguageEfl.cpp	2016-04-21 15:12:11 UTC (rev 199815)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2003, 2006 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
- * Copyright (C) 2009-2010 ProFUSION embedded systems
- * Copyright (C) 2009-2010 Samsung Electronics
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Language.h"
-
-#include <locale.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-static String platformLanguage()
-{
-    char* localeDefault = setlocale(LC_CTYPE, 0);
-
-    if (!localeDefault)
-        return String("c");
-
-    String locale = String(localeDefault);
-    locale.replace('_', '-');
-    size_t position = locale.find('.');
-    if (position != notFound)
-        locale = locale.left(position);
-
-    return locale;
-}
-
-Vector<String> platformUserPreferredLanguages()
-{
-    Vector<String> userPreferredLanguages;
-    userPreferredLanguages.append(platformLanguage());
-    return userPreferredLanguages;
-}
-
-}

Deleted: trunk/Source/WebCore/platform/efl/LoggingEfl.cpp (199814 => 199815)


--- trunk/Source/WebCore/platform/efl/LoggingEfl.cpp	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/platform/efl/LoggingEfl.cpp	2016-04-21 15:12:11 UTC (rev 199815)
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007 Alp Toker <a...@atoker.com>
- * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
- * Copyright (C) 2009-2010 ProFUSION embedded systems
- * Copyright (C) 2009-2010 Samsung Electronics
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "Logging.h"
-
-#if !LOG_DISABLED
-
-#include <Eina.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String logLevelString()
-{
-    char* logEnv = getenv("WEBKIT_DEBUG");
-    if (!logEnv)
-        return emptyString();
-
-#if defined(NDEBUG)
-    EINA_LOG_WARN("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build.");
-#endif
-
-    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
-    String logLevel = "NotYetImplemented,";
-    logLevel.append(logEnv);
-    return logLevel;
-}
-
-}
-
-#endif // !LOG_DISABLED

Deleted: trunk/Source/WebCore/platform/gtk/LanguageGtk.cpp (199814 => 199815)


--- trunk/Source/WebCore/platform/gtk/LanguageGtk.cpp	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/platform/gtk/LanguageGtk.cpp	2016-04-21 15:12:11 UTC (rev 199815)
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2007 Alp Toker <a...@atoker.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "Language.h"
-
-#include <wtf/Vector.h>
-#include <wtf/glib/GUniquePtr.h>
-#include <wtf/text/CString.h>
-#include <wtf/text/WTFString.h>
-
-#include <glib.h>
-#include <locale.h>
-
-namespace WebCore {
-
-// Using pango_language_get_default() here is not an option, because
-// it doesn't support changing the locale in runtime, so it returns
-// always the same value.
-static String platformLanguage()
-{
-    char* localeDefault = setlocale(LC_CTYPE, NULL);
-
-    if (!localeDefault)
-        return String("c");
-
-    GUniquePtr<gchar> normalizedDefault(g_ascii_strdown(localeDefault, -1));
-    char* ptr = strchr(normalizedDefault.get(), '_');
-
-    if (ptr)
-        *ptr = '-';
-
-    ptr = strchr(normalizedDefault.get(), '.');
-
-    if (ptr)
-        *ptr = '\0';
-
-    return String(normalizedDefault.get());
-}
-
-Vector<String> platformUserPreferredLanguages()
-{
-    Vector<String> userPreferredLanguages;
-    userPreferredLanguages.append(platformLanguage());
-    return userPreferredLanguages;
-}
-    
-}

Deleted: trunk/Source/WebCore/platform/gtk/LoggingGtk.cpp (199814 => 199815)


--- trunk/Source/WebCore/platform/gtk/LoggingGtk.cpp	2016-04-21 12:33:13 UTC (rev 199814)
+++ trunk/Source/WebCore/platform/gtk/LoggingGtk.cpp	2016-04-21 15:12:11 UTC (rev 199815)
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2007 Alp Toker <a...@atoker.com>
- * Copyright (C) 2009 Gustavo Noronha Silva <g...@gnome.org>
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "Logging.h"
-
-#if !LOG_DISABLED
-
-#include <glib.h>
-#include <string.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-String logLevelString()
-{
-    char* logEnv = getenv("WEBKIT_DEBUG");
-    if (!logEnv)
-        return emptyString();
-
-    // We set up the logs anyway because some of our logging, such as Soup's is available in release builds.
-#if defined(NDEBUG)
-    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.");
-#endif
-
-    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
-    String logLevel = "NotYetImplemented,";
-    logLevel.append(logEnv);
-    return logLevel;
-}
-
-} // namespace WebCore
-
-#endif // !LOG_DISABLED

Copied: trunk/Source/WebCore/platform/unix/LanguageUnix.cpp (from rev 199814, trunk/Source/WebCore/platform/gtk/LanguageGtk.cpp) (0 => 199815)


--- trunk/Source/WebCore/platform/unix/LanguageUnix.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/unix/LanguageUnix.cpp	2016-04-21 15:12:11 UTC (rev 199815)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 Alp Toker <a...@atoker.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "Language.h"
+
+#include <locale.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+// Using pango_language_get_default() here is not an option, because
+// it doesn't support changing the locale in runtime, so it returns
+// always the same value.
+static String platformLanguage()
+{
+    String localeDefault(setlocale(LC_CTYPE, nullptr));
+    if (localeDefault.isEmpty())
+        return String("c");
+
+    String normalizedDefault = localeDefault.convertToASCIILowercase();
+    normalizedDefault.replace('_', '-');
+    normalizedDefault.truncate(normalizedDefault.find('.'));
+    return normalizedDefault;
+}
+
+Vector<String> platformUserPreferredLanguages()
+{
+    return { platformLanguage() };
+}
+
+}

Copied: trunk/Source/WebCore/platform/unix/LoggingUnix.cpp (from rev 199814, trunk/Source/WebCore/platform/gtk/LoggingGtk.cpp) (0 => 199815)


--- trunk/Source/WebCore/platform/unix/LoggingUnix.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/unix/LoggingUnix.cpp	2016-04-21 15:12:11 UTC (rev 199815)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 Alp Toker <a...@atoker.com>
+ * Copyright (C) 2009 Gustavo Noronha Silva <g...@gnome.org>
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "Logging.h"
+
+#if !LOG_DISABLED
+
+#include <string.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+String logLevelString()
+{
+    char* logEnv = getenv("WEBKIT_DEBUG");
+    if (!logEnv)
+        return emptyString();
+
+    // We set up the logs anyway because some of our logging, such as Soup's is available in release builds.
+#if defined(NDEBUG)
+    WTFLogAlways("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build.");
+#endif
+
+    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
+    return String("NotYetImplemented,") + logEnv;
+}
+
+} // namespace WebCore
+
+#endif // !LOG_DISABLED
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to