2011-02-06 Benjamin Poulain <ikipou@gmail.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Feb 2011 13:23:53 +0000 (13:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Feb 2011 13:23:53 +0000 (13:23 +0000)
        Reviewed by Andreas Kling.

        [Qt] WebKit does not build on Mac with WebKit 2
        https://bugs.webkit.org/show_bug.cgi?id=53380

        * Platform/CoreIPC/qt/ConnectionQt.cpp: Use fcntl() to set close on exec so
        we do not rely on recent kernel.
        (CoreIPC::Connection::readyReadHandler):
        * Platform/qt/SharedMemoryQt.cpp: ditto
        (WebKit::SharedMemory::create):
        (WebKit::SharedMemory::createHandle):
        * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: Guard prctl() since it is
        a Linux specific function.
        (WebKit::QtWebProcess::setupChildProcess):
        * UIProcess/DrawingAreaProxy.h: Differentiate between building on Mac
        and the Mac port.
        * UIProcess/DrawingAreaProxyImpl.cpp: ditto
        * UIProcess/WebPageProxy.cpp: ditto
        (WebKit::WebPageProxy::didReceiveMessage):
        * WebProcess/WebPage/DrawingArea.cpp: ditto
        (WebKit::DrawingArea::create):
        * WebProcess/WebPage/DrawingArea.h:
        * WebProcess/WebPage/DrawingAreaImpl.cpp: ditto
        * WebProcess/WebPage/WebPage.cpp: ditto
        (WebKit::WebPage::didReceiveMessage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77765 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp
Source/WebKit2/Platform/qt/SharedMemoryQt.cpp
Source/WebKit2/UIProcess/DrawingAreaProxy.h
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit2/UIProcess/Launcher/qt/ProcessLauncherQt.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index eb38f75a24670e28b86f25c89656ac626d7f5c16..996211923394ba3268af1972960e5a91ed06de46 100644 (file)
@@ -1,3 +1,31 @@
+2011-02-06  Benjamin Poulain  <ikipou@gmail.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] WebKit does not build on Mac with WebKit 2
+        https://bugs.webkit.org/show_bug.cgi?id=53380
+
+        * Platform/CoreIPC/qt/ConnectionQt.cpp: Use fcntl() to set close on exec so
+        we do not rely on recent kernel.
+        (CoreIPC::Connection::readyReadHandler):
+        * Platform/qt/SharedMemoryQt.cpp: ditto
+        (WebKit::SharedMemory::create):
+        (WebKit::SharedMemory::createHandle):
+        * UIProcess/Launcher/qt/ProcessLauncherQt.cpp: Guard prctl() since it is
+        a Linux specific function.
+        (WebKit::QtWebProcess::setupChildProcess):
+        * UIProcess/DrawingAreaProxy.h: Differentiate between building on Mac
+        and the Mac port.
+        * UIProcess/DrawingAreaProxyImpl.cpp: ditto
+        * UIProcess/WebPageProxy.cpp: ditto
+        (WebKit::WebPageProxy::didReceiveMessage):
+        * WebProcess/WebPage/DrawingArea.cpp: ditto
+        (WebKit::DrawingArea::create):
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/DrawingAreaImpl.cpp: ditto
+        * WebProcess/WebPage/WebPage.cpp: ditto
+        (WebKit::WebPage::didReceiveMessage):
+
 2011-02-05  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Dan Bernstein.
index e8f2c957c60be0b6ea835e346d71e3f8b4a0e081..225d7dc77291387ad1af2aff11deabd7720d60e2 100644 (file)
@@ -165,7 +165,7 @@ void Connection::readyReadHandler()
 
 
     int messageLength = 0;
-    while ((messageLength = recvmsg(m_socketDescriptor, &message, MSG_CMSG_CLOEXEC)) == -1) {
+    while ((messageLength = recvmsg(m_socketDescriptor, &message, 0)) == -1) {
         if (errno != EINTR)
             return;
     }
@@ -197,6 +197,15 @@ void Connection::readyReadHandler()
             if (messageInfo.isMessageBodyOOL())
                 attachmentCount--;
 
+            for (int i = 0; i < attachmentCount; ++i) {
+                while (fcntl(fileDescriptors[i], F_SETFL, FD_CLOEXEC) == -1) {
+                    if (errno != EINTR) {
+                        ASSERT_NOT_REACHED();
+                        return;
+                    }
+                }
+            }
+
             for (int i = 0; i < attachmentCount; ++i)
                 attachments.append(Attachment(fileDescriptors[i], attachmentSizes[i]));
 
index c1484a3e3b08f5a475106039b8525089c39b8192..91af533872debd43298e1c9fdbec258d590ccf75 100644 (file)
@@ -106,10 +106,17 @@ PassRefPtr<SharedMemory> SharedMemory::create(size_t size)
     char* tempNameC = tempNameCSTR.data();
 
     int fileDescriptor;
-    while ((fileDescriptor = mkostemp(tempNameC, O_CREAT | O_CLOEXEC | O_RDWR)) == -1) {
+    while ((fileDescriptor = mkstemp(tempNameC)) == -1) {
         if (errno != EINTR)
             return 0;
     }
+    while (fcntl(fileDescriptor, F_SETFD, FD_CLOEXEC) == -1) {
+        if (errno != EINTR) {
+            while (close(fileDescriptor) == -1 && errno == EINTR) { }
+            unlink(tempNameC);
+            return 0;
+        }
+    }
 
     while (ftruncate(fileDescriptor, size) == -1) {
         if (errno != EINTR) {
@@ -196,7 +203,7 @@ bool SharedMemory::createHandle(Handle& handle, Protection protection)
         }
     }
 
-    while ((fcntl(duplicatedHandle, F_SETFD,  O_CLOEXEC | accessModeFile(protection)) == -1)) {
+    while ((fcntl(duplicatedHandle, F_SETFD, FD_CLOEXEC | accessModeFile(protection)) == -1)) {
         if (errno != EINTR) {
             ASSERT_NOT_REACHED();
             while (close(duplicatedHandle) == -1 && errno == EINTR) { }
index bd6f90cde0a687629a08c0ef129d770a5bbc0ca6..5a3c392cae3b8561a712bdecbc172a62674cb852 100644 (file)
@@ -58,7 +58,7 @@ public:
 
     virtual ~DrawingAreaProxy();
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
     void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 #endif
 
index dc8a087b5811c2b7d3a190cea638a73c988041e6..6b8aeb3e70127c40732b4223c25d9ae6588da784 100644 (file)
@@ -34,7 +34,7 @@
 #include "WebPageProxy.h"
 #include "WebProcessProxy.h"
 
-#ifndef __APPLE__
+#if !PLATFORM(MAC)
 #error "This drawing area is not ready for use by other ports yet."
 #endif
 
index 8def8abbc4ab17a61b06bc91f7c9c8ba11561c21..85c36515067556620968d7e0c7ee47cc99d2c479 100644 (file)
@@ -50,7 +50,7 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/Threading.h>
 #include <wtf/text/WTFString.h>
-#if defined Q_OS_UNIX
+#if defined Q_OS_LINUX
 #include <sys/prctl.h>
 #include <signal.h>
 #endif
@@ -74,7 +74,7 @@ protected:
 
 void QtWebProcess::setupChildProcess()
 {
-#if defined Q_OS_UNIX
+#if defined Q_OS_LINUX
     prctl(PR_SET_PDEATHSIG, SIGKILL);
 #endif
 }
index dbf7e22c11cad47b517c6d96f2e8125c4b18abb2..b87b4bfe264dbd74fed5cbf5afb62b1ce9c4533b 100644 (file)
@@ -1090,7 +1090,7 @@ void WebPageProxy::setResizesToContentsUsingLayoutSize(const WebCore::IntSize& t
 
 void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
-#ifdef __APPLE__
+#if PLATFORM(MAC)
     if (messageID.is<CoreIPC::MessageClassDrawingAreaProxy>()) {
         m_drawingArea->didReceiveDrawingAreaProxyMessage(connection, messageID, arguments);
         return;
index 7a0bb8a3d802e014ec761860ec96b0fde91387e3..66622ae4c464abeda43917229daf85b7a7a2776a 100644 (file)
@@ -29,7 +29,7 @@
 // Subclasses
 #include "ChunkedUpdateDrawingArea.h"
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
 #include "DrawingAreaImpl.h"
 #endif
 
@@ -53,7 +53,7 @@ PassRefPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreat
             break;
 
         case DrawingAreaInfo::Impl:
-#ifdef __APPLE__
+#if PLATFORM(MAC)
             return DrawingAreaImpl::create(webPage, parameters);
 #else
             return 0;
index 247c156c4389cc29b988f64e2dfad7683d306b36..a10adcc922a589a10898c316196b2360536aa010 100644 (file)
@@ -48,7 +48,7 @@ public:
     static PassRefPtr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
     virtual ~DrawingArea();
     
-#ifdef __APPLE__
+#if PLATFORM(MAC)
     void didReceiveDrawingAreaMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 #endif
 
index 2fe89499f3d7c5e9b9e34ee5645dcc226e0b6a28..05d7bdac428d71474dcc227249692f4714d7833b 100644 (file)
@@ -35,7 +35,7 @@
 #include "WebProcess.h"
 #include <WebCore/GraphicsContext.h>
 
-#ifndef __APPLE__
+#if !PLATFORM(MAC)
 #error "This drawing area is not ready for use by other ports yet."
 #endif
 
index 9e843336ae1b6caa2a07f0cc9193e159fce7b155..f886693ad8cacdc4cfb50b8d3d14f5b460cafb8f 100644 (file)
@@ -1677,7 +1677,7 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
         return;
     }
 
-#ifdef __APPLE__
+#if PLATFORM(MAC)
     if (messageID.is<CoreIPC::MessageClassDrawingArea>()) {
         if (m_drawingArea)
             m_drawingArea->didReceiveDrawingAreaMessage(connection, messageID, arguments);