<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199772] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199772">199772</a></dd>
<dt>Author</dt> <dd>csaavedra@igalia.com</dd>
<dt>Date</dt> <dd>2016-04-20 08:03:05 -0700 (Wed, 20 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Move GTK+-independent platform code to platform/glib
https://bugs.webkit.org/show_bug.cgi?id=156787

Reviewed by Carlos Garcia Campos.

There is plenty of code in platform/gtk that is independent from the GTK+ library.
Move those files to platform/glib so that they can be reused by other GLib-based ports.

Also clean some style warnings in those files.

* PlatformGTK.cmake: Move the files.
* platform/glib/EventLoopGlib.cpp: Renamed from Source/WebCore/platform/gtk/EventLoopGtk.cpp.
(WebCore::EventLoop::cycle):
* platform/glib/FileSystemGlib.cpp: Renamed from Source/WebCore/platform/gtk/FileSystemGtk.cpp.
(WebCore::filenameToString):
(WebCore::unescapedFilename):
(WebCore::fileSystemRepresentation):
(WebCore::filenameForDisplay):
(WebCore::fileExists):
(WebCore::deleteFile):
(WebCore::deleteEmptyDirectory):
(WebCore::getFileStat):
(WebCore::getFileSize):
(WebCore::getFileCreationTime):
(WebCore::getFileModificationTime):
(WebCore::getFileMetadata):
(WebCore::pathByAppendingComponent):
(WebCore::makeAllDirectories):
(WebCore::homeDirectoryPath):
(WebCore::pathGetFileName):
(WebCore::applicationDirectoryPath):
(WebCore::sharedResourcesPath):
(WebCore::getVolumeFreeSizeForPath):
(WebCore::directoryName):
(WebCore::listDirectory):
(WebCore::openTemporaryFile):
(WebCore::openFile):
(WebCore::closeFile):
(WebCore::seekFile):
(WebCore::writeToFile):
(WebCore::readFromFile):
(WebCore::unloadModule):
(WebCore::hardLinkOrCopyFile):
* platform/glib/GamepadsGlib.cpp: Renamed from Source/WebCore/platform/gtk/GamepadsGtk.cpp.
(WebCore::GamepadDeviceGlib::GamepadDeviceGlib):
(WebCore::GamepadDeviceGlib::~GamepadDeviceGlib):
(WebCore::GamepadDeviceGlib::readCallback):
(WebCore::GamepadsGlib::GamepadsGlib):
(WebCore::GamepadsGlib::~GamepadsGlib):
(WebCore::GamepadsGlib::registerDevice):
(WebCore::GamepadsGlib::unregisterDevice):
(WebCore::GamepadsGlib::updateGamepadList):
(WebCore::GamepadsGlib::onUEventCallback):
(WebCore::GamepadsGlib::isGamepadDevice):
(WebCore::sampleGamepads):
* platform/glib/SharedBufferGlib.cpp: Renamed from Source/WebCore/platform/gtk/SharedBufferGtk.cpp.
(WebCore::SharedBuffer::createFromReadingFile):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformglibEventLoopGlibcpp">trunk/Source/WebCore/platform/glib/EventLoopGlib.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformglibFileSystemGlibcpp">trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformglibGamepadsGlibcpp">trunk/Source/WebCore/platform/glib/GamepadsGlib.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformglibSharedBufferGlibcpp">trunk/Source/WebCore/platform/glib/SharedBufferGlib.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgtkEventLoopGtkcpp">trunk/Source/WebCore/platform/gtk/EventLoopGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkFileSystemGtkcpp">trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGamepadsGtkcpp">trunk/Source/WebCore/platform/gtk/GamepadsGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkSharedBufferGtkcpp">trunk/Source/WebCore/platform/gtk/SharedBufferGtk.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199771 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-20 13:25:39 UTC (rev 199771)
+++ trunk/Source/WebCore/ChangeLog        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2016-04-20  Claudio Saavedra  &lt;csaavedra@igalia.com&gt;
+
+        [GTK] Move GTK+-independent platform code to platform/glib
+        https://bugs.webkit.org/show_bug.cgi?id=156787
+
+        Reviewed by Carlos Garcia Campos.
+
+        There is plenty of code in platform/gtk that is independent from the GTK+ library.
+        Move those files to platform/glib so that they can be reused by other GLib-based ports.
+
+        Also clean some style warnings in those files.
+
+        * PlatformGTK.cmake: Move the files.
+        * platform/glib/EventLoopGlib.cpp: Renamed from Source/WebCore/platform/gtk/EventLoopGtk.cpp.
+        (WebCore::EventLoop::cycle):
+        * platform/glib/FileSystemGlib.cpp: Renamed from Source/WebCore/platform/gtk/FileSystemGtk.cpp.
+        (WebCore::filenameToString):
+        (WebCore::unescapedFilename):
+        (WebCore::fileSystemRepresentation):
+        (WebCore::filenameForDisplay):
+        (WebCore::fileExists):
+        (WebCore::deleteFile):
+        (WebCore::deleteEmptyDirectory):
+        (WebCore::getFileStat):
+        (WebCore::getFileSize):
+        (WebCore::getFileCreationTime):
+        (WebCore::getFileModificationTime):
+        (WebCore::getFileMetadata):
+        (WebCore::pathByAppendingComponent):
+        (WebCore::makeAllDirectories):
+        (WebCore::homeDirectoryPath):
+        (WebCore::pathGetFileName):
+        (WebCore::applicationDirectoryPath):
+        (WebCore::sharedResourcesPath):
+        (WebCore::getVolumeFreeSizeForPath):
+        (WebCore::directoryName):
+        (WebCore::listDirectory):
+        (WebCore::openTemporaryFile):
+        (WebCore::openFile):
+        (WebCore::closeFile):
+        (WebCore::seekFile):
+        (WebCore::writeToFile):
+        (WebCore::readFromFile):
+        (WebCore::unloadModule):
+        (WebCore::hardLinkOrCopyFile):
+        * platform/glib/GamepadsGlib.cpp: Renamed from Source/WebCore/platform/gtk/GamepadsGtk.cpp.
+        (WebCore::GamepadDeviceGlib::GamepadDeviceGlib):
+        (WebCore::GamepadDeviceGlib::~GamepadDeviceGlib):
+        (WebCore::GamepadDeviceGlib::readCallback):
+        (WebCore::GamepadsGlib::GamepadsGlib):
+        (WebCore::GamepadsGlib::~GamepadsGlib):
+        (WebCore::GamepadsGlib::registerDevice):
+        (WebCore::GamepadsGlib::unregisterDevice):
+        (WebCore::GamepadsGlib::updateGamepadList):
+        (WebCore::GamepadsGlib::onUEventCallback):
+        (WebCore::GamepadsGlib::isGamepadDevice):
+        (WebCore::sampleGamepads):
+        * platform/glib/SharedBufferGlib.cpp: Renamed from Source/WebCore/platform/gtk/SharedBufferGtk.cpp.
+        (WebCore::SharedBuffer::createFromReadingFile):
+
</ins><span class="cx"> 2016-04-20  Frederic Wang  &lt;fwang@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor RenderMathMLSpace to avoid using flexbox
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (199771 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2016-04-20 13:25:39 UTC (rev 199771)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -85,9 +85,13 @@
</span><span class="cx">     platform/geoclue/GeolocationProviderGeoclue1.cpp
</span><span class="cx">     platform/geoclue/GeolocationProviderGeoclue2.cpp
</span><span class="cx"> 
</span><ins>+    platform/glib/EventLoopGlib.cpp
+    platform/glib/FileSystemGlib.cpp
+    platform/glib/GamepadsGlib.cpp
</ins><span class="cx">     platform/glib/KeyedDecoderGlib.cpp
</span><span class="cx">     platform/glib/KeyedEncoderGlib.cpp
</span><span class="cx">     platform/glib/MainThreadSharedTimerGLib.cpp
</span><ins>+    platform/glib/SharedBufferGlib.cpp
</ins><span class="cx"> 
</span><span class="cx">     platform/graphics/GLContext.cpp
</span><span class="cx">     platform/graphics/GraphicsContext3DPrivate.cpp
</span><span class="lines">@@ -137,14 +141,10 @@
</span><span class="cx">     platform/graphics/x11/XUniqueResource.cpp
</span><span class="cx"> 
</span><span class="cx">     platform/gtk/ErrorsGtk.cpp
</span><del>-    platform/gtk/EventLoopGtk.cpp
-    platform/gtk/FileSystemGtk.cpp
-    platform/gtk/GamepadsGtk.cpp
</del><span class="cx">     platform/gtk/LanguageGtk.cpp
</span><span class="cx">     platform/gtk/LoggingGtk.cpp
</span><span class="cx">     platform/gtk/MIMETypeRegistryGtk.cpp
</span><span class="cx">     platform/gtk/ScrollAnimatorGtk.cpp
</span><del>-    platform/gtk/SharedBufferGtk.cpp
</del><span class="cx">     platform/gtk/TemporaryLinkStubs.cpp
</span><span class="cx">     platform/gtk/UserAgentGtk.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformglibEventLoopGlibcppfromrev199771trunkSourceWebCoreplatformgtkEventLoopGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/glib/EventLoopGlib.cpp (from rev 199771, trunk/Source/WebCore/platform/gtk/EventLoopGtk.cpp) (0 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/glib/EventLoopGlib.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/glib/EventLoopGlib.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+/*
+ * Copyright (C) 2008 Nuanti Ltd.
+ *
+ * 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 &quot;config.h&quot;
+#include &quot;EventLoop.h&quot;
+
+#include &lt;glib.h&gt;
+
+namespace WebCore {
+
+void EventLoop::cycle()
+{
+    g_main_context_iteration(NULL, FALSE);
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformglibFileSystemGlibcppfromrev199771trunkSourceWebCoreplatformgtkFileSystemGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (from rev 199771, trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp) (0 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -0,0 +1,376 @@
</span><ins>+/*
+ * Copyright (C) 2007, 2009 Holger Hans Peter Freyther
+ * Copyright (C) 2008 Collabora, Ltd.
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Portions Copyright (c) 2010 Motorola Mobility, 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 &quot;config.h&quot;
+#include &quot;FileSystem.h&quot;
+
+#include &quot;FileMetadata.h&quot;
+#include &quot;NotImplemented.h&quot;
+#include &quot;UUID.h&quot;
+#include &lt;gio/gio.h&gt;
+#include &lt;glib.h&gt;
+#include &lt;glib/gstdio.h&gt;
+#include &lt;wtf/glib/GLibUtilities.h&gt;
+#include &lt;wtf/glib/GRefPtr.h&gt;
+#include &lt;wtf/glib/GUniquePtr.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
+namespace WebCore {
+
+/* On linux file names are just raw bytes, so also strings that cannot be encoded in any way
+ * are valid file names. This mean that we cannot just store a file name as-is in a String
+ * but we have to escape it.
+ * On Windows the GLib file name encoding is always UTF-8 so we can optimize this case. */
+String filenameToString(const char* filename)
+{
+    if (!filename)
+        return String();
+
+#if OS(WINDOWS)
+    return String::fromUTF8(filename);
+#else
+    GUniquePtr&lt;gchar&gt; escapedString(g_uri_escape_string(filename, &quot;/:&quot;, false));
+    return escapedString.get();
+#endif
+}
+
+static GUniquePtr&lt;char&gt; unescapedFilename(const String&amp; path)
+{
+    if (path.isEmpty())
+        return nullptr;
+#if OS(WINDOWS)
+    return GUniquePtr&lt;char&gt;(g_strdup(path.utf8().data()));
+#else
+    return GUniquePtr&lt;char&gt;(g_uri_unescape_string(path.utf8().data(), nullptr));
+#endif
+}
+
+CString fileSystemRepresentation(const String&amp; path)
+{
+#if OS(WINDOWS)
+    return path.utf8();
+#else
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    return filename.get();
+#endif
+}
+
+// Converts a string to something suitable to be displayed to the user.
+String filenameForDisplay(const String&amp; string)
+{
+#if OS(WINDOWS)
+    return string;
+#else
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(string);
+    if (!filename)
+        return string;
+
+    GUniquePtr&lt;gchar&gt; display(g_filename_to_utf8(filename.get(), -1, nullptr, nullptr, nullptr));
+    if (!display)
+        return string;
+
+    return String::fromUTF8(display.get());
+#endif
+}
+
+bool fileExists(const String&amp; path)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    return filename ? g_file_test(filename.get(), G_FILE_TEST_EXISTS) : false;
+}
+
+bool deleteFile(const String&amp; path)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    return filename ? g_remove(filename.get()) != -1 : false;
+}
+
+bool deleteEmptyDirectory(const String&amp; path)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    return filename ? g_rmdir(filename.get()) != -1 : false;
+}
+
+static bool getFileStat(const String&amp; path, GStatBuf* statBuffer)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    if (!filename)
+        return false;
+
+    return g_stat(filename.get(), statBuffer) != -1;
+}
+
+bool getFileSize(const String&amp; path, long long&amp; resultSize)
+{
+    GStatBuf statResult;
+    if (!getFileStat(path, &amp;statResult))
+        return false;
+
+    resultSize = statResult.st_size;
+    return true;
+}
+
+bool getFileSize(PlatformFileHandle, long long&amp;)
+{
+    notImplemented();
+    return false;
+}
+
+bool getFileCreationTime(const String&amp;, time_t&amp;)
+{
+    // FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it?
+    return false;
+}
+
+bool getFileModificationTime(const String&amp; path, time_t&amp; modifiedTime)
+{
+    GStatBuf statResult;
+    if (!getFileStat(path, &amp;statResult))
+        return false;
+
+    modifiedTime = statResult.st_mtime;
+    return true;
+}
+
+bool getFileMetadata(const String&amp; path, FileMetadata&amp; metadata)
+{
+    GStatBuf statResult;
+    if (!getFileStat(path, &amp;statResult))
+        return false;
+
+    metadata.modificationTime = statResult.st_mtime;
+    metadata.length = statResult.st_size;
+    metadata.type = S_ISDIR(statResult.st_mode) ? FileMetadata::TypeDirectory : FileMetadata::TypeFile;
+    return true;
+}
+
+String pathByAppendingComponent(const String&amp; path, const String&amp; component)
+{
+    if (path.endsWith(G_DIR_SEPARATOR_S))
+        return path + component;
+    return path + G_DIR_SEPARATOR_S + component;
+}
+
+bool makeAllDirectories(const String&amp; path)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    return filename ? g_mkdir_with_parents(filename.get(), S_IRWXU) != -1 : false;
+}
+
+String homeDirectoryPath()
+{
+    return filenameToString(g_get_home_dir());
+}
+
+String pathGetFileName(const String&amp; pathName)
+{
+    GUniquePtr&lt;gchar&gt; tmpFilename = unescapedFilename(pathName);
+    if (!tmpFilename)
+        return pathName;
+
+    GUniquePtr&lt;gchar&gt; baseName(g_path_get_basename(tmpFilename.get()));
+    return String::fromUTF8(baseName.get());
+}
+
+CString applicationDirectoryPath()
+{
+    CString path = getCurrentExecutablePath();
+    if (!path.isNull())
+        return path;
+
+    // If the above fails, check the PATH env variable.
+    GUniquePtr&lt;char&gt; currentExePath(g_find_program_in_path(g_get_prgname()));
+    if (!currentExePath.get())
+        return CString();
+
+    GUniquePtr&lt;char&gt; dirname(g_path_get_dirname(currentExePath.get()));
+    return dirname.get();
+}
+
+CString sharedResourcesPath()
+{
+    static CString cachedPath;
+    if (!cachedPath.isNull())
+        return cachedPath;
+
+#if OS(WINDOWS)
+    HMODULE hmodule = 0;
+    GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast&lt;char*&gt;(sharedResourcesPath), &amp;hmodule);
+
+    GUniquePtr&lt;gchar&gt; runtimeDir(g_win32_get_package_installation_directory_of_module(hmodule));
+    GUniquePtr&lt;gchar&gt; dataPath(g_build_filename(runtimeDir.get(), &quot;share&quot;, &quot;webkitgtk-&quot; WEBKITGTK_API_VERSION_STRING, NULL));
+#else
+    GUniquePtr&lt;gchar&gt; dataPath(g_build_filename(DATA_DIR, &quot;webkitgtk-&quot; WEBKITGTK_API_VERSION_STRING, NULL));
+#endif
+
+    cachedPath = dataPath.get();
+    return cachedPath;
+}
+
+uint64_t getVolumeFreeSizeForPath(const char* path)
+{
+    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(path));
+    GRefPtr&lt;GFileInfo&gt; fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE, 0, 0));
+    if (!fileInfo)
+        return 0;
+
+    return g_file_info_get_attribute_uint64(fileInfo.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+}
+
+String directoryName(const String&amp; path)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    if (!filename)
+        return String();
+
+    GUniquePtr&lt;char&gt; dirname(g_path_get_dirname(filename.get()));
+    return String::fromUTF8(dirname.get());
+}
+
+Vector&lt;String&gt; listDirectory(const String&amp; path, const String&amp; filter)
+{
+    Vector&lt;String&gt; entries;
+
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    if (!filename)
+        return entries;
+
+    GUniquePtr&lt;GDir&gt; dir(g_dir_open(filename.get(), 0, nullptr));
+    if (!dir)
+        return entries;
+
+    GUniquePtr&lt;GPatternSpec&gt; pspec(g_pattern_spec_new((filter.utf8()).data()));
+    while (const char* name = g_dir_read_name(dir.get())) {
+        if (!g_pattern_match_string(pspec.get(), name))
+            continue;
+
+        GUniquePtr&lt;gchar&gt; entry(g_build_filename(filename.get(), name, nullptr));
+        entries.append(filenameToString(entry.get()));
+    }
+
+    return entries;
+}
+
+String openTemporaryFile(const String&amp; prefix, PlatformFileHandle&amp; handle)
+{
+    GUniquePtr&lt;gchar&gt; filename(g_strdup_printf(&quot;%s%s&quot;, prefix.utf8().data(), createCanonicalUUIDString().utf8().data()));
+    GUniquePtr&lt;gchar&gt; tempPath(g_build_filename(g_get_tmp_dir(), filename.get(), NULL));
+    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(tempPath.get()));
+
+    handle = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0);
+    if (!isHandleValid(handle))
+        return String();
+    return String::fromUTF8(tempPath.get());
+}
+
+PlatformFileHandle openFile(const String&amp; path, FileOpenMode mode)
+{
+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    if (!filename)
+        return invalidPlatformFileHandle;
+
+    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(filename.get()));
+    GFileIOStream* ioStream = 0;
+    if (mode == OpenForRead)
+        ioStream = g_file_open_readwrite(file.get(), 0, 0);
+    else if (mode == OpenForWrite) {
+        if (g_file_test(filename.get(), static_cast&lt;GFileTest&gt;(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
+            ioStream = g_file_open_readwrite(file.get(), 0, 0);
+        else
+            ioStream = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0);
+    }
+
+    return ioStream;
+}
+
+void closeFile(PlatformFileHandle&amp; handle)
+{
+    if (!isHandleValid(handle))
+        return;
+
+    g_io_stream_close(G_IO_STREAM(handle), 0, 0);
+    g_object_unref(handle);
+    handle = invalidPlatformFileHandle;
+}
+
+long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin)
+{
+    GSeekType seekType = G_SEEK_SET;
+    switch (origin) {
+    case SeekFromBeginning:
+        seekType = G_SEEK_SET;
+        break;
+    case SeekFromCurrent:
+        seekType = G_SEEK_CUR;
+        break;
+    case SeekFromEnd:
+        seekType = G_SEEK_END;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    if (!g_seekable_seek(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))),
+        offset, seekType, 0, 0))
+    {
+        return -1;
+    }
+    return g_seekable_tell(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))));
+}
+
+int writeToFile(PlatformFileHandle handle, const char* data, int length)
+{
+    gsize bytesWritten;
+    g_output_stream_write_all(g_io_stream_get_output_stream(G_IO_STREAM(handle)),
+        data, length, &amp;bytesWritten, 0, 0);
+    return bytesWritten;
+}
+
+int readFromFile(PlatformFileHandle handle, char* data, int length)
+{
+    GUniqueOutPtr&lt;GError&gt; error;
+    do {
+        gssize bytesRead = g_input_stream_read(g_io_stream_get_input_stream(G_IO_STREAM(handle)),
+            data, length, 0, &amp;error.outPtr());
+        if (bytesRead &gt;= 0)
+            return bytesRead;
+    } while (error &amp;&amp; error-&gt;code == G_FILE_ERROR_INTR);
+    return -1;
+}
+
+bool unloadModule(PlatformModule module)
+{
+#if OS(WINDOWS)
+    return ::FreeLibrary(module);
+#else
+    return g_module_close(module);
+#endif
+}
+
+bool hardLinkOrCopyFile(const String&amp;, const String&amp;)
+{
+    // FIXME: Implement
+    return false;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformglibGamepadsGlibcppfromrev199771trunkSourceWebCoreplatformgtkGamepadsGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/glib/GamepadsGlib.cpp (from rev 199771, trunk/Source/WebCore/platform/gtk/GamepadsGtk.cpp) (0 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/glib/GamepadsGlib.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/glib/GamepadsGlib.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -0,0 +1,219 @@
</span><ins>+/*
+ * Copyright (C) 2012 Zan Dobersek &lt;zandobersek@gmail.com&gt;
+ *
+ * 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 &quot;config.h&quot;
+#include &quot;Gamepads.h&quot;
+
+#if ENABLE(GAMEPAD_DEPRECATED)
+
+#include &quot;GamepadDeviceLinux.h&quot;
+#include &quot;GamepadList.h&quot;
+#include &quot;Logging.h&quot;
+#include &lt;gio/gunixinputstream.h&gt;
+#include &lt;gudev/gudev.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/glib/GRefPtr.h&gt;
+#include &lt;wtf/glib/GUniquePtr.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+#include &lt;wtf/text/StringHash.h&gt;
+
+namespace WebCore {
+
+class GamepadDeviceGlib : public GamepadDeviceLinux {
+public:
+    explicit GamepadDeviceGlib(String deviceFile);
+    ~GamepadDeviceGlib();
+
+private:
+    static gboolean readCallback(GObject* pollableStream, gpointer data);
+    GRefPtr&lt;GInputStream&gt; m_inputStream;
+    GRefPtr&lt;GSource&gt; m_source;
+};
+
+GamepadDeviceGlib::GamepadDeviceGlib(String deviceFile)
+    : GamepadDeviceLinux(deviceFile)
+{
+    if (m_fileDescriptor == -1)
+        return;
+
+    m_inputStream = adoptGRef(g_unix_input_stream_new(m_fileDescriptor, FALSE));
+    m_source = adoptGRef(g_pollable_input_stream_create_source(G_POLLABLE_INPUT_STREAM(m_inputStream.get()), 0));
+    g_source_set_callback(m_source.get(), reinterpret_cast&lt;GSourceFunc&gt;(readCallback), this, 0);
+    g_source_attach(m_source.get(), 0);
+}
+
+GamepadDeviceGlib::~GamepadDeviceGlib()
+{
+    if (m_source)
+        g_source_destroy(m_source.get());
+}
+
+gboolean GamepadDeviceGlib::readCallback(GObject* pollableStream, gpointer data)
+{
+    GamepadDeviceGlib* gamepadDevice = reinterpret_cast&lt;GamepadDeviceGlib*&gt;(data);
+    GUniqueOutPtr&lt;GError&gt; error;
+    struct js_event event;
+
+    gssize len = g_pollable_input_stream_read_nonblocking(G_POLLABLE_INPUT_STREAM(pollableStream),
+        &amp;event, sizeof(event), 0, &amp;error.outPtr());
+
+    // FIXME: Properly log the error.
+    // In the case of G_IO_ERROR_WOULD_BLOCK error return TRUE to wait until
+    // the source becomes readable again and FALSE otherwise.
+    if (error)
+        return g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
+
+    ASSERT_UNUSED(len, len == sizeof(event));
+    gamepadDevice-&gt;updateForEvent(event);
+    return TRUE;
+}
+
+class GamepadsGlib {
+public:
+    explicit GamepadsGlib(unsigned length);
+
+    void registerDevice(String deviceFile);
+    void unregisterDevice(String deviceFile);
+
+    void updateGamepadList(GamepadList*);
+
+private:
+    ~GamepadsGlib();
+    static void onUEventCallback(GUdevClient*, gchar* action, GUdevDevice*, gpointer data);
+    static gboolean isGamepadDevice(GUdevDevice*);
+
+    Vector&lt;std::unique_ptr&lt;GamepadDeviceGlib&gt; &gt; m_slots;
+    HashMap&lt;String, GamepadDeviceGlib*&gt; m_deviceMap;
+
+    GRefPtr&lt;GUdevClient&gt; m_gudevClient;
+};
+
+GamepadsGlib::GamepadsGlib(unsigned length)
+    : m_slots(length)
+{
+    static const char* subsystems[] = { &quot;input&quot;, 0 };
+    m_gudevClient = adoptGRef(g_udev_client_new(subsystems));
+    g_signal_connect(m_gudevClient.get(), &quot;uevent&quot;, G_CALLBACK(onUEventCallback), this);
+
+    GUniquePtr&lt;GList&gt; devicesList(g_udev_client_query_by_subsystem(m_gudevClient.get(), subsystems[0]));
+    for (GList* listItem = devicesList.get(); listItem; listItem = g_list_next(listItem)) {
+        GUdevDevice* device = G_UDEV_DEVICE(listItem-&gt;data);
+        String deviceFile = String::fromUTF8(g_udev_device_get_device_file(device));
+        if (isGamepadDevice(device))
+            registerDevice(deviceFile);
+        g_object_unref(device);
+    }
+}
+
+GamepadsGlib::~GamepadsGlib()
+{
+    g_signal_handlers_disconnect_matched(m_gudevClient.get(), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+}
+
+void GamepadsGlib::registerDevice(String deviceFile)
+{
+    LOG(Gamepad, &quot;GamepadsGlib::registerDevice %s&quot;, deviceFile.ascii().data());
+    ASSERT(!m_deviceMap.contains(deviceFile));
+
+    for (unsigned index = 0; index &lt; m_slots.size(); index++) {
+        if (!m_slots[index]) {
+            m_slots[index] = std::make_unique&lt;GamepadDeviceGlib&gt;(deviceFile);
+            m_deviceMap.add(deviceFile, m_slots[index].get());
+            break;
+        }
+    }
+}
+
+void GamepadsGlib::unregisterDevice(String deviceFile)
+{
+    LOG(Gamepad, &quot;GamepadsGlib::unregisterDevice %s&quot;, deviceFile.ascii().data());
+    ASSERT(m_deviceMap.contains(deviceFile));
+
+    GamepadDeviceGlib* gamepadDevice = m_deviceMap.take(deviceFile);
+    size_t index = m_slots.find(gamepadDevice);
+    ASSERT(index != notFound);
+
+    m_slots[index] = nullptr;
+}
+
+void GamepadsGlib::updateGamepadList(GamepadList* into)
+{
+    ASSERT(m_slots.size() == into-&gt;length());
+
+    for (unsigned i = 0; i &lt; m_slots.size(); i++) {
+        if (m_slots[i].get() &amp;&amp; m_slots[i]-&gt;connected()) {
+            GamepadDeviceGlib* gamepadDevice = m_slots[i].get();
+            RefPtr&lt;Gamepad&gt; gamepad = into-&gt;item(i);
+            if (!gamepad)
+                gamepad = Gamepad::create();
+
+            gamepad-&gt;index(i);
+            gamepad-&gt;id(gamepadDevice-&gt;id());
+            gamepad-&gt;timestamp(gamepadDevice-&gt;timestamp());
+            gamepad-&gt;axes(gamepadDevice-&gt;axesCount(), gamepadDevice-&gt;axesData());
+            gamepad-&gt;buttons(gamepadDevice-&gt;buttonsCount(), gamepadDevice-&gt;buttonsData());
+
+            into-&gt;set(i, gamepad);
+        } else
+            into-&gt;set(i, 0);
+    }
+}
+
+void GamepadsGlib::onUEventCallback(GUdevClient*, gchar* action, GUdevDevice* device, gpointer data)
+{
+    if (!isGamepadDevice(device))
+        return;
+
+    GamepadsGlib* gamepadsGlib = reinterpret_cast&lt;GamepadsGlib*&gt;(data);
+    String deviceFile = String::fromUTF8(g_udev_device_get_device_file(device));
+
+    if (!g_strcmp0(action, &quot;add&quot;))
+        gamepadsGlib-&gt;registerDevice(deviceFile);
+    else if (!g_strcmp0(action, &quot;remove&quot;))
+        gamepadsGlib-&gt;unregisterDevice(deviceFile);
+}
+
+gboolean GamepadsGlib::isGamepadDevice(GUdevDevice* device)
+{
+    const gchar* deviceFile = g_udev_device_get_device_file(device);
+    const gchar* sysfsPath = g_udev_device_get_sysfs_path(device);
+    if (!deviceFile || !sysfsPath)
+        return FALSE;
+
+    if (!g_udev_device_has_property(device, &quot;ID_INPUT&quot;) || !g_udev_device_has_property(device, &quot;ID_INPUT_JOYSTICK&quot;))
+        return FALSE;
+
+    return g_str_has_prefix(deviceFile, &quot;/dev/input/js&quot;);
+}
+
+void sampleGamepads(GamepadList* into)
+{
+    DEPRECATED_DEFINE_STATIC_LOCAL(GamepadsGlib, gamepadsGlib, (into-&gt;length()));
+    gamepadsGlib.updateGamepadList(into);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD_DEPRECATED)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformglibSharedBufferGlibcppfromrev199771trunkSourceWebCoreplatformgtkSharedBufferGtkcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/glib/SharedBufferGlib.cpp (from rev 199771, trunk/Source/WebCore/platform/gtk/SharedBufferGtk.cpp) (0 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/glib/SharedBufferGlib.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/glib/SharedBufferGlib.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+/*
+ * Copyright (C) 2008 Collabora Ltd.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include &quot;config.h&quot;
+#include &quot;SharedBuffer.h&quot;
+
+#include &quot;FileSystem.h&quot;
+#include &lt;wtf/glib/GUniquePtr.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+#include &lt;glib.h&gt;
+
+
+namespace WebCore {
+
+RefPtr&lt;SharedBuffer&gt; SharedBuffer::createFromReadingFile(const String&amp; filePath)
+{
+    if (filePath.isEmpty())
+        return 0;
+
+    CString filename = fileSystemRepresentation(filePath);
+    GUniqueOutPtr&lt;gchar&gt; contents;
+    gsize size;
+    GUniqueOutPtr&lt;GError&gt; error;
+    if (!g_file_get_contents(filename.data(), &amp;contents.outPtr(), &amp;size, &amp;error.outPtr())) {
+        LOG_ERROR(&quot;Failed to fully read contents of file %s - %s&quot;, filenameForDisplay(filePath).utf8().data(), error-&gt;message);
+        return 0;
+    }
+
+    RefPtr&lt;SharedBuffer&gt; result = SharedBuffer::create(contents.get(), size);
+
+    return result.release();
+}
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkEventLoopGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/EventLoopGtk.cpp (199771 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/EventLoopGtk.cpp        2016-04-20 13:25:39 UTC (rev 199771)
+++ trunk/Source/WebCore/platform/gtk/EventLoopGtk.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -1,32 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Nuanti Ltd.
- *
- * 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 &quot;config.h&quot;
-#include &quot;EventLoop.h&quot;
-
-#include &lt;glib.h&gt;
-
-namespace WebCore {
-
-void EventLoop::cycle()
-{
-    g_main_context_iteration(NULL, FALSE);
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkFileSystemGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp (199771 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp        2016-04-20 13:25:39 UTC (rev 199771)
+++ trunk/Source/WebCore/platform/gtk/FileSystemGtk.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -1,374 +0,0 @@
</span><del>-/*
- * Copyright (C) 2007, 2009 Holger Hans Peter Freyther
- * Copyright (C) 2008 Collabora, Ltd.
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- * Portions Copyright (c) 2010 Motorola Mobility, 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 &quot;config.h&quot;
-#include &quot;FileSystem.h&quot;
-
-#include &quot;FileMetadata.h&quot;
-#include &quot;NotImplemented.h&quot;
-#include &quot;UUID.h&quot;
-#include &lt;gio/gio.h&gt;
-#include &lt;glib.h&gt;
-#include &lt;glib/gstdio.h&gt;
-#include &lt;wtf/glib/GLibUtilities.h&gt;
-#include &lt;wtf/glib/GRefPtr.h&gt;
-#include &lt;wtf/glib/GUniquePtr.h&gt;
-#include &lt;wtf/text/CString.h&gt;
-#include &lt;wtf/text/WTFString.h&gt;
-
-namespace WebCore {
-
-/* On linux file names are just raw bytes, so also strings that cannot be encoded in any way
- * are valid file names. This mean that we cannot just store a file name as-is in a String
- * but we have to escape it.
- * On Windows the GLib file name encoding is always UTF-8 so we can optimize this case. */
-String filenameToString(const char* filename)
-{
-    if (!filename)
-        return String();
-
-#if OS(WINDOWS)
-    return String::fromUTF8(filename);
-#else
-    GUniquePtr&lt;gchar&gt; escapedString(g_uri_escape_string(filename, &quot;/:&quot;, false));
-    return escapedString.get();
-#endif
-}
-
-static GUniquePtr&lt;char&gt; unescapedFilename(const String&amp; path)
-{
-    if (path.isEmpty())
-        return nullptr;
-#if OS(WINDOWS)
-    return GUniquePtr&lt;char&gt;(g_strdup(path.utf8().data()));
-#else
-    return GUniquePtr&lt;char&gt;(g_uri_unescape_string(path.utf8().data(), nullptr));
-#endif
-}
-
-CString fileSystemRepresentation(const String&amp; path)
-{
-#if OS(WINDOWS)
-    return path.utf8();
-#else
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    return filename.get();
-#endif
-}
-
-// Converts a string to something suitable to be displayed to the user.
-String filenameForDisplay(const String&amp; string)
-{
-#if OS(WINDOWS)
-    return string;
-#else
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(string);
-    if (!filename)
-        return string;
-
-    GUniquePtr&lt;gchar&gt; display(g_filename_to_utf8(filename.get(), -1, nullptr, nullptr, nullptr));
-    if (!display)
-        return string;
-
-    return String::fromUTF8(display.get());
-#endif
-}
-
-bool fileExists(const String&amp; path)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    return filename ? g_file_test(filename.get(), G_FILE_TEST_EXISTS) : false;
-}
-
-bool deleteFile(const String&amp; path)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    return filename ? g_remove(filename.get()) != -1 : false;
-}
-
-bool deleteEmptyDirectory(const String&amp; path)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    return filename ? g_rmdir(filename.get()) != -1 : false;
-}
-
-static bool getFileStat(const String&amp; path, GStatBuf* statBuffer)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    if (!filename)
-        return false;
-
-    return g_stat(filename.get(), statBuffer) != -1;
-}
-
-bool getFileSize(const String&amp; path, long long&amp; resultSize)
-{
-    GStatBuf statResult;
-    if (!getFileStat(path, &amp;statResult))
-        return false;
-
-    resultSize = statResult.st_size;
-    return true;
-}
-
-bool getFileSize(PlatformFileHandle, long long&amp;)
-{
-    notImplemented();
-    return false;
-}
-
-bool getFileCreationTime(const String&amp;, time_t&amp;)
-{
-    // FIXME: Is there a way to retrieve file creation time with Gtk on platforms that support it?
-    return false;
-}
-
-bool getFileModificationTime(const String&amp; path, time_t&amp; modifiedTime)
-{
-    GStatBuf statResult;
-    if (!getFileStat(path, &amp;statResult))
-        return false;
-
-    modifiedTime = statResult.st_mtime;
-    return true;
-}
-
-bool getFileMetadata(const String&amp; path, FileMetadata&amp; metadata)
-{
-    GStatBuf statResult;
-    if (!getFileStat(path, &amp;statResult))
-        return false;
-
-    metadata.modificationTime = statResult.st_mtime;
-    metadata.length = statResult.st_size;
-    metadata.type = S_ISDIR(statResult.st_mode) ? FileMetadata::TypeDirectory : FileMetadata::TypeFile;
-    return true;
-}
-
-String pathByAppendingComponent(const String&amp; path, const String&amp; component)
-{
-    if (path.endsWith(G_DIR_SEPARATOR_S))
-        return path + component;
-    return path + G_DIR_SEPARATOR_S + component;
-}
-
-bool makeAllDirectories(const String&amp; path)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    return filename ? g_mkdir_with_parents(filename.get(), S_IRWXU) != -1 : false;
-}
-
-String homeDirectoryPath()
-{
-    return filenameToString(g_get_home_dir());
-}
-
-String pathGetFileName(const String&amp; pathName)
-{
-    GUniquePtr&lt;gchar&gt; tmpFilename = unescapedFilename(pathName);
-    if (!tmpFilename)
-        return pathName;
-
-    GUniquePtr&lt;gchar&gt; baseName(g_path_get_basename(tmpFilename.get()));
-    return String::fromUTF8(baseName.get());
-}
-
-CString applicationDirectoryPath()
-{
-    CString path = getCurrentExecutablePath();
-    if (!path.isNull())
-        return path;
-
-    // If the above fails, check the PATH env variable.
-    GUniquePtr&lt;char&gt; currentExePath(g_find_program_in_path(g_get_prgname()));
-    if (!currentExePath.get())
-        return CString();
-
-    GUniquePtr&lt;char&gt; dirname(g_path_get_dirname(currentExePath.get()));
-    return dirname.get();
-}
-
-CString sharedResourcesPath()
-{
-    static CString cachedPath;
-    if (!cachedPath.isNull())
-        return cachedPath;
-
-#if OS(WINDOWS)
-    HMODULE hmodule = 0;
-    GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast&lt;char*&gt;(sharedResourcesPath), &amp;hmodule);
-
-    GUniquePtr&lt;gchar&gt; runtimeDir(g_win32_get_package_installation_directory_of_module(hmodule));
-    GUniquePtr&lt;gchar&gt; dataPath(g_build_filename(runtimeDir.get(), &quot;share&quot;, &quot;webkitgtk-&quot; WEBKITGTK_API_VERSION_STRING, NULL));
-#else
-    GUniquePtr&lt;gchar&gt; dataPath(g_build_filename(DATA_DIR, &quot;webkitgtk-&quot; WEBKITGTK_API_VERSION_STRING, NULL));
-#endif
-
-    cachedPath = dataPath.get();
-    return cachedPath;
-}
-
-uint64_t getVolumeFreeSizeForPath(const char* path)
-{
-    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(path));
-    GRefPtr&lt;GFileInfo&gt; fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE, 0, 0));
-    if (!fileInfo)
-        return 0;
-
-    return g_file_info_get_attribute_uint64(fileInfo.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
-}
-
-String directoryName(const String&amp; path)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    if (!filename)
-        return String();
-
-    GUniquePtr&lt;char&gt; dirname(g_path_get_dirname(filename.get()));
-    return String::fromUTF8(dirname.get());
-}
-
-Vector&lt;String&gt; listDirectory(const String&amp; path, const String&amp; filter)
-{
-    Vector&lt;String&gt; entries;
-
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    if (!filename)
-        return entries;
-
-    GUniquePtr&lt;GDir&gt; dir(g_dir_open(filename.get(), 0, nullptr));
-    if (!dir)
-        return entries;
-
-    GUniquePtr&lt;GPatternSpec&gt; pspec(g_pattern_spec_new((filter.utf8()).data()));
-    while (const char* name = g_dir_read_name(dir.get())) {
-        if (!g_pattern_match_string(pspec.get(), name))
-            continue;
-
-        GUniquePtr&lt;gchar&gt; entry(g_build_filename(filename.get(), name, nullptr));
-        entries.append(filenameToString(entry.get()));
-    }
-
-    return entries;
-}
-
-String openTemporaryFile(const String&amp; prefix, PlatformFileHandle&amp; handle)
-{
-    GUniquePtr&lt;gchar&gt; filename(g_strdup_printf(&quot;%s%s&quot;, prefix.utf8().data(), createCanonicalUUIDString().utf8().data()));
-    GUniquePtr&lt;gchar&gt; tempPath(g_build_filename(g_get_tmp_dir(), filename.get(), NULL));
-    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(tempPath.get()));
-
-    handle = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0);
-    if (!isHandleValid(handle))
-        return String();
-    return String::fromUTF8(tempPath.get());
-}
-
-PlatformFileHandle openFile(const String&amp; path, FileOpenMode mode)
-{
-    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
-    if (!filename)
-        return invalidPlatformFileHandle;
-
-    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(filename.get()));
-    GFileIOStream* ioStream = 0;
-    if (mode == OpenForRead)
-        ioStream = g_file_open_readwrite(file.get(), 0, 0);
-    else if (mode == OpenForWrite) {
-        if (g_file_test(filename.get(), static_cast&lt;GFileTest&gt;(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)))
-            ioStream = g_file_open_readwrite(file.get(), 0, 0);
-        else
-            ioStream = g_file_create_readwrite(file.get(), G_FILE_CREATE_NONE, 0, 0);
-    }
-
-    return ioStream;
-}
-
-void closeFile(PlatformFileHandle&amp; handle)
-{
-    if (!isHandleValid(handle))
-        return;
-
-    g_io_stream_close(G_IO_STREAM(handle), 0, 0);
-    g_object_unref(handle);
-    handle = invalidPlatformFileHandle;
-}
-
-long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin)
-{
-    GSeekType seekType = G_SEEK_SET;
-    switch (origin) {
-    case SeekFromBeginning:
-        seekType = G_SEEK_SET;
-        break;
-    case SeekFromCurrent:
-        seekType = G_SEEK_CUR;
-        break;
-    case SeekFromEnd:
-        seekType = G_SEEK_END;
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-
-    if (!g_seekable_seek(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))),
-                         offset, seekType, 0, 0))
-        return -1;
-    return g_seekable_tell(G_SEEKABLE(g_io_stream_get_input_stream(G_IO_STREAM(handle))));
-}
-
-int writeToFile(PlatformFileHandle handle, const char* data, int length)
-{
-    gsize bytesWritten;
-    g_output_stream_write_all(g_io_stream_get_output_stream(G_IO_STREAM(handle)),
-                              data, length, &amp;bytesWritten, 0, 0);
-    return bytesWritten;
-}
-
-int readFromFile(PlatformFileHandle handle, char* data, int length)
-{
-    GUniqueOutPtr&lt;GError&gt; error;
-    do {
-        gssize bytesRead = g_input_stream_read(g_io_stream_get_input_stream(G_IO_STREAM(handle)),
-                                               data, length, 0, &amp;error.outPtr());
-        if (bytesRead &gt;= 0)
-            return bytesRead;
-    } while (error &amp;&amp; error-&gt;code == G_FILE_ERROR_INTR);
-    return -1;
-}
-
-bool unloadModule(PlatformModule module)
-{
-#if OS(WINDOWS)
-    return ::FreeLibrary(module);
-#else
-    return g_module_close(module);
-#endif
-}
-
-bool hardLinkOrCopyFile(const String&amp;, const String&amp;)
-{
-    // FIXME: Implement
-    return false;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGamepadsGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/GamepadsGtk.cpp (199771 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GamepadsGtk.cpp        2016-04-20 13:25:39 UTC (rev 199771)
+++ trunk/Source/WebCore/platform/gtk/GamepadsGtk.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -1,219 +0,0 @@
</span><del>-/*
- * Copyright (C) 2012 Zan Dobersek &lt;zandobersek@gmail.com&gt;
- *
- * 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 &quot;config.h&quot;
-#include &quot;Gamepads.h&quot;
-
-#if ENABLE(GAMEPAD_DEPRECATED)
-
-#include &quot;GamepadDeviceLinux.h&quot;
-#include &quot;GamepadList.h&quot;
-#include &quot;Logging.h&quot;
-#include &lt;gio/gunixinputstream.h&gt;
-#include &lt;gudev/gudev.h&gt;
-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/glib/GRefPtr.h&gt;
-#include &lt;wtf/glib/GUniquePtr.h&gt;
-#include &lt;wtf/text/CString.h&gt;
-#include &lt;wtf/text/StringHash.h&gt;
-
-namespace WebCore {
-
-class GamepadDeviceGtk : public GamepadDeviceLinux {
-public:
-    explicit GamepadDeviceGtk(String deviceFile);
-    ~GamepadDeviceGtk();
-
-private:
-    static gboolean readCallback(GObject* pollableStream, gpointer data);
-    GRefPtr&lt;GInputStream&gt; m_inputStream;
-    GRefPtr&lt;GSource&gt; m_source;
-};
-
-GamepadDeviceGtk::GamepadDeviceGtk(String deviceFile)
-    : GamepadDeviceLinux(deviceFile)
-{
-    if (m_fileDescriptor == -1)
-        return;
-
-    m_inputStream = adoptGRef(g_unix_input_stream_new(m_fileDescriptor, FALSE));
-    m_source = adoptGRef(g_pollable_input_stream_create_source(G_POLLABLE_INPUT_STREAM(m_inputStream.get()), 0));
-    g_source_set_callback(m_source.get(), reinterpret_cast&lt;GSourceFunc&gt;(readCallback), this, 0);
-    g_source_attach(m_source.get(), 0);
-}
-
-GamepadDeviceGtk::~GamepadDeviceGtk()
-{
-    if (m_source)
-        g_source_destroy(m_source.get());
-}
-
-gboolean GamepadDeviceGtk::readCallback(GObject* pollableStream, gpointer data)
-{
-    GamepadDeviceGtk* gamepadDevice = reinterpret_cast&lt;GamepadDeviceGtk*&gt;(data);
-    GUniqueOutPtr&lt;GError&gt; error;
-    struct js_event event;
-
-    gssize len = g_pollable_input_stream_read_nonblocking(G_POLLABLE_INPUT_STREAM(pollableStream),
-                                                          &amp;event, sizeof(event), 0, &amp;error.outPtr());
-
-    // FIXME: Properly log the error.
-    // In the case of G_IO_ERROR_WOULD_BLOCK error return TRUE to wait until
-    // the source becomes readable again and FALSE otherwise.
-    if (error)
-        return g_error_matches(error.get(), G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK);
-
-    ASSERT_UNUSED(len, len == sizeof(event));
-    gamepadDevice-&gt;updateForEvent(event);
-    return TRUE;
-}
-
-class GamepadsGtk {
-public:
-    explicit GamepadsGtk(unsigned length);
-
-    void registerDevice(String deviceFile);
-    void unregisterDevice(String deviceFile);
-
-    void updateGamepadList(GamepadList*);
-
-private:
-    ~GamepadsGtk();
-    static void onUEventCallback(GUdevClient*, gchar* action, GUdevDevice*, gpointer data);
-    static gboolean isGamepadDevice(GUdevDevice*);
-
-    Vector&lt;std::unique_ptr&lt;GamepadDeviceGtk&gt; &gt; m_slots;
-    HashMap&lt;String, GamepadDeviceGtk*&gt; m_deviceMap;
-
-    GRefPtr&lt;GUdevClient&gt; m_gudevClient;
-};
-
-GamepadsGtk::GamepadsGtk(unsigned length)
-    : m_slots(length)
-{
-    static const char* subsystems[] = { &quot;input&quot;, 0 };
-    m_gudevClient = adoptGRef(g_udev_client_new(subsystems));
-    g_signal_connect(m_gudevClient.get(), &quot;uevent&quot;, G_CALLBACK(onUEventCallback), this);
-
-    GUniquePtr&lt;GList&gt; devicesList(g_udev_client_query_by_subsystem(m_gudevClient.get(), subsystems[0]));
-    for (GList* listItem = devicesList.get(); listItem; listItem = g_list_next(listItem)) {
-        GUdevDevice* device = G_UDEV_DEVICE(listItem-&gt;data);
-        String deviceFile = String::fromUTF8(g_udev_device_get_device_file(device));
-        if (isGamepadDevice(device))
-            registerDevice(deviceFile);
-        g_object_unref(device);
-    }
-}
-
-GamepadsGtk::~GamepadsGtk()
-{
-    g_signal_handlers_disconnect_matched(m_gudevClient.get(), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
-}
-
-void GamepadsGtk::registerDevice(String deviceFile)
-{
-    LOG(Gamepad, &quot;GamepadsGtk::registerDevice %s&quot;, deviceFile.ascii().data());
-    ASSERT(!m_deviceMap.contains(deviceFile));
-
-    for (unsigned index = 0; index &lt; m_slots.size(); index++) {
-        if (!m_slots[index]) {
-            m_slots[index] = std::make_unique&lt;GamepadDeviceGtk&gt;(deviceFile);
-            m_deviceMap.add(deviceFile, m_slots[index].get());
-            break;
-        }
-    }
-}
-
-void GamepadsGtk::unregisterDevice(String deviceFile)
-{
-    LOG(Gamepad, &quot;GamepadsGtk::unregisterDevice %s&quot;, deviceFile.ascii().data());
-    ASSERT(m_deviceMap.contains(deviceFile));
-
-    GamepadDeviceGtk* gamepadDevice = m_deviceMap.take(deviceFile);
-    size_t index = m_slots.find(gamepadDevice);
-    ASSERT(index != notFound);
-
-    m_slots[index] = nullptr;
-}
-
-void GamepadsGtk::updateGamepadList(GamepadList* into)
-{
-    ASSERT(m_slots.size() == into-&gt;length());
-
-    for (unsigned i = 0; i &lt; m_slots.size(); i++) {
-        if (m_slots[i].get() &amp;&amp; m_slots[i]-&gt;connected()) {
-            GamepadDeviceGtk* gamepadDevice = m_slots[i].get();
-            RefPtr&lt;Gamepad&gt; gamepad = into-&gt;item(i);
-            if (!gamepad)
-                gamepad = Gamepad::create();
-
-            gamepad-&gt;index(i);
-            gamepad-&gt;id(gamepadDevice-&gt;id());
-            gamepad-&gt;timestamp(gamepadDevice-&gt;timestamp());
-            gamepad-&gt;axes(gamepadDevice-&gt;axesCount(), gamepadDevice-&gt;axesData());
-            gamepad-&gt;buttons(gamepadDevice-&gt;buttonsCount(), gamepadDevice-&gt;buttonsData());
-
-            into-&gt;set(i, gamepad);
-        } else
-            into-&gt;set(i, 0);
-    }
-}
-
-void GamepadsGtk::onUEventCallback(GUdevClient*, gchar* action, GUdevDevice* device, gpointer data)
-{
-    if (!isGamepadDevice(device))
-        return;
-
-    GamepadsGtk* gamepadsGtk = reinterpret_cast&lt;GamepadsGtk*&gt;(data);
-    String deviceFile = String::fromUTF8(g_udev_device_get_device_file(device));
-
-    if (!g_strcmp0(action, &quot;add&quot;))
-        gamepadsGtk-&gt;registerDevice(deviceFile);
-    else if (!g_strcmp0(action, &quot;remove&quot;))
-        gamepadsGtk-&gt;unregisterDevice(deviceFile);
-}
-
-gboolean GamepadsGtk::isGamepadDevice(GUdevDevice* device)
-{
-    const gchar* deviceFile = g_udev_device_get_device_file(device);
-    const gchar* sysfsPath = g_udev_device_get_sysfs_path(device);
-    if (!deviceFile || !sysfsPath)
-        return FALSE;
-
-    if (!g_udev_device_has_property(device, &quot;ID_INPUT&quot;) || !g_udev_device_has_property(device, &quot;ID_INPUT_JOYSTICK&quot;))
-        return FALSE;
-
-    return g_str_has_prefix(deviceFile, &quot;/dev/input/js&quot;);
-}
-
-void sampleGamepads(GamepadList* into)
-{
-    DEPRECATED_DEFINE_STATIC_LOCAL(GamepadsGtk, gamepadsGtk, (into-&gt;length()));
-    gamepadsGtk.updateGamepadList(into);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(GAMEPAD_DEPRECATED)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkSharedBufferGtkcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/SharedBufferGtk.cpp (199771 => 199772)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/SharedBufferGtk.cpp        2016-04-20 13:25:39 UTC (rev 199771)
+++ trunk/Source/WebCore/platform/gtk/SharedBufferGtk.cpp        2016-04-20 15:03:05 UTC (rev 199772)
</span><span class="lines">@@ -1,50 +0,0 @@
</span><del>-/*
- * Copyright (C) 2008 Collabora Ltd.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser 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
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#include &quot;config.h&quot;
-#include &quot;SharedBuffer.h&quot;
-
-#include &quot;FileSystem.h&quot;
-#include &lt;wtf/glib/GUniquePtr.h&gt;
-#include &lt;wtf/text/CString.h&gt;
-
-#include &lt;glib.h&gt;
-
-
-namespace WebCore {
-
-RefPtr&lt;SharedBuffer&gt; SharedBuffer::createFromReadingFile(const String&amp; filePath)
-{
-    if (filePath.isEmpty())
-        return 0;
-
-    CString filename = fileSystemRepresentation(filePath);
-    GUniqueOutPtr&lt;gchar&gt; contents;
-    gsize size;
-    GUniqueOutPtr&lt;GError&gt; error;
-    if (!g_file_get_contents(filename.data(), &amp;contents.outPtr(), &amp;size, &amp;error.outPtr())) {
-        LOG_ERROR(&quot;Failed to fully read contents of file %s - %s&quot;, filenameForDisplay(filePath).utf8().data(), error-&gt;message);
-        return 0;
-    }
-
-    RefPtr&lt;SharedBuffer&gt; result = SharedBuffer::create(contents.get(), size);
-
-    return result.release();
-}
-
-} // namespace WebCore
</del></span></pre>
</div>
</div>

</body>
</html>