Title: [219384] trunk
Revision
219384
Author
[email protected]
Date
2017-07-11 23:59:15 -0700 (Tue, 11 Jul 2017)

Log Message

[GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
https://bugs.webkit.org/show_bug.cgi?id=174357

Reviewed by Michael Catanzaro.

.:

* Source/cmake/OptionsGTK.cmake: Use gio-unix unconditionally.

Source/WebCore:

Implement lockFile and unlockFile using flock().

* PlatformWPE.cmake:
* platform/glib/FileSystemGlib.cpp:
(WebCore::lockFile):
(WebCore::unlockFile):

Source/WTF:

* wtf/Platform.h: Enable FILE_LOCK in GTK and WPE ports.

Modified Paths

Diff

Modified: trunk/ChangeLog (219383 => 219384)


--- trunk/ChangeLog	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/ChangeLog	2017-07-12 06:59:15 UTC (rev 219384)
@@ -1,3 +1,12 @@
+2017-07-11  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
+        https://bugs.webkit.org/show_bug.cgi?id=174357
+
+        Reviewed by Michael Catanzaro.
+
+        * Source/cmake/OptionsGTK.cmake: Use gio-unix unconditionally.
+
 2017-07-11  Dean Jackson  <[email protected]>
 
         Remove NAVIGATOR_HWCONCURRENCY

Modified: trunk/Source/WTF/ChangeLog (219383 => 219384)


--- trunk/Source/WTF/ChangeLog	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/Source/WTF/ChangeLog	2017-07-12 06:59:15 UTC (rev 219384)
@@ -1,3 +1,12 @@
+2017-07-11  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
+        https://bugs.webkit.org/show_bug.cgi?id=174357
+
+        Reviewed by Michael Catanzaro.
+
+        * wtf/Platform.h: Enable FILE_LOCK in GTK and WPE ports.
+
 2017-07-11  Dean Jackson  <[email protected]>
 
         Remove NAVIGATOR_HWCONCURRENCY

Modified: trunk/Source/WTF/wtf/Platform.h (219383 => 219384)


--- trunk/Source/WTF/wtf/Platform.h	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/Source/WTF/wtf/Platform.h	2017-07-12 06:59:15 UTC (rev 219384)
@@ -518,6 +518,7 @@
 #define USE_HARFBUZZ 1
 #define USE_SOUP 1
 #define USE_WEBP 1
+#define USE_FILE_LOCK 1
 #endif
 
 #if PLATFORM(GTK)

Modified: trunk/Source/WebCore/ChangeLog (219383 => 219384)


--- trunk/Source/WebCore/ChangeLog	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/Source/WebCore/ChangeLog	2017-07-12 06:59:15 UTC (rev 219384)
@@ -1,3 +1,17 @@
+2017-07-11  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
+        https://bugs.webkit.org/show_bug.cgi?id=174357
+
+        Reviewed by Michael Catanzaro.
+
+        Implement lockFile and unlockFile using flock().
+
+        * PlatformWPE.cmake:
+        * platform/glib/FileSystemGlib.cpp:
+        (WebCore::lockFile):
+        (WebCore::unlockFile):
+
 2017-07-11  Yusuke Suzuki  <[email protected]>
 
         Use FastAllocator in STL containers

Modified: trunk/Source/WebCore/PlatformWPE.cmake (219383 => 219384)


--- trunk/Source/WebCore/PlatformWPE.cmake	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/Source/WebCore/PlatformWPE.cmake	2017-07-12 06:59:15 UTC (rev 219384)
@@ -180,6 +180,7 @@
 list(APPEND WebCore_INCLUDE_DIRECTORIES
     ${CAIRO_INCLUDE_DIRS}
     ${EGL_INCLUDE_DIRS}
+    ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GNUTLS_INCLUDE_DIRS}
     ${ICU_INCLUDE_DIRS}

Modified: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (219383 => 219384)


--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp	2017-07-12 06:59:15 UTC (rev 219384)
@@ -25,9 +25,11 @@
 
 #include "FileMetadata.h"
 #include "NotImplemented.h"
+#include <gio/gfiledescriptorbased.h>
 #include <gio/gio.h>
 #include <glib.h>
 #include <glib/gstdio.h>
+#include <sys/file.h>
 #include <wtf/UUID.h>
 #include <wtf/glib/GLibUtilities.h>
 #include <wtf/glib/GRefPtr.h>
@@ -417,4 +419,23 @@
     return g_file_info_get_attribute_uint32(fileInfo.get(), G_FILE_ATTRIBUTE_UNIX_DEVICE);
 }
 
+#if USE(FILE_LOCK)
+bool lockFile(PlatformFileHandle handle, FileLockMode lockMode)
+{
+    COMPILE_ASSERT(LOCK_SH == LockShared, LockSharedEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_EX == LockExclusive, LockExclusiveEncodingIsAsExpected);
+    COMPILE_ASSERT(LOCK_NB == LockNonBlocking, LockNonBlockingEncodingIsAsExpected);
+    auto* inputStream = g_io_stream_get_input_stream(G_IO_STREAM(handle));
+    int result = flock(g_file_descriptor_based_get_fd(G_FILE_DESCRIPTOR_BASED(inputStream)), lockMode);
+    return result != -1;
 }
+
+bool unlockFile(PlatformFileHandle handle)
+{
+    auto* inputStream = g_io_stream_get_input_stream(G_IO_STREAM(handle));
+    int result = flock(g_file_descriptor_based_get_fd(G_FILE_DESCRIPTOR_BASED(inputStream)), LOCK_UN);
+    return result != -1;
+}
+#endif // USE(FILE_LOCK)
+
+}

Modified: trunk/Source/cmake/OptionsGTK.cmake (219383 => 219384)


--- trunk/Source/cmake/OptionsGTK.cmake	2017-07-12 05:42:33 UTC (rev 219383)
+++ trunk/Source/cmake/OptionsGTK.cmake	2017-07-12 06:59:15 UTC (rev 219384)
@@ -199,10 +199,7 @@
 SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_GESTURES ${GTK3_SUPPORTS_GESTURES})
 SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTK_UNIX_PRINT_FOUND})
 
-set(glib_components gio gobject gthread gmodule)
-if (ENABLE_GAMEPAD_DEPRECATED OR ENABLE_GEOLOCATION)
-    list(APPEND glib_components gio-unix)
-endif ()
+set(glib_components gio gio-unix gobject gthread gmodule)
 find_package(GLIB 2.36 REQUIRED COMPONENTS ${glib_components})
 
 if (ENABLE_XSLT)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to