[Qt][WK2] Another attempt to fix build after recent WebKit2 changes
authorrafael.lobo@openbossa.org <rafael.lobo@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 03:52:13 +0000 (03:52 +0000)
committerrafael.lobo@openbossa.org <rafael.lobo@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 03:52:13 +0000 (03:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108548

Reviewed by Anders Carlsson.

* Platform/CoreIPC/unix/ConnectionUnix.cpp:
(CoreIPC::Connection::platformInvalidate):
(CoreIPC::Connection::processMessage): Change Deque to Vector and do similar
logic as on patch for https://bugs.webkit.org/show_bug.cgi?id=108517
(CoreIPC::Connection::open):
(CoreIPC::Connection::setShouldCloseConnectionOnProcessTermination):
* Platform/qt/WorkQueueQt.cpp: Reflect changes on Qt WorkQueue to increase ref
count when the execution is started and decrease it when the work item is deleted,
following the logic on https://bugs.webkit.org/show_bug.cgi?id=108544
(WorkQueue::WorkItemQt::~WorkItemQt):
(WorkQueue::WorkItemQt::execute):
(WorkQueue::dispatch):
(WorkQueue::dispatchAfterDelay):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::getPluginPath): This function was moved from WebProcessProxy but
mac specific code was not protected properly: https://bugs.webkit.org/show_bug.cgi?id=108407

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

Source/WebKit2/ChangeLog
Source/WebKit2/Platform/CoreIPC/unix/ConnectionUnix.cpp
Source/WebKit2/Platform/qt/WorkQueueQt.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp

index 62940bc..4537df8 100644 (file)
@@ -1,3 +1,27 @@
+2013-01-31  Rafael Brandao  <rafael.lobo@openbossa.org>
+
+        [Qt][WK2] Another attempt to fix build after recent WebKit2 changes
+        https://bugs.webkit.org/show_bug.cgi?id=108548
+
+        Reviewed by Anders Carlsson.
+
+        * Platform/CoreIPC/unix/ConnectionUnix.cpp:
+        (CoreIPC::Connection::platformInvalidate):
+        (CoreIPC::Connection::processMessage): Change Deque to Vector and do similar
+        logic as on patch for https://bugs.webkit.org/show_bug.cgi?id=108517
+        (CoreIPC::Connection::open):
+        (CoreIPC::Connection::setShouldCloseConnectionOnProcessTermination):
+        * Platform/qt/WorkQueueQt.cpp: Reflect changes on Qt WorkQueue to increase ref
+        count when the execution is started and decrease it when the work item is deleted,
+        following the logic on https://bugs.webkit.org/show_bug.cgi?id=108544
+        (WorkQueue::WorkItemQt::~WorkItemQt):
+        (WorkQueue::WorkItemQt::execute):
+        (WorkQueue::dispatch):
+        (WorkQueue::dispatchAfterDelay):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::getPluginPath): This function was moved from WebProcessProxy but
+        mac specific code was not protected properly: https://bugs.webkit.org/show_bug.cgi?id=108407
+
 2013-01-31  Changhun Kang  <temoochin@company100.net>
 
         Rename from parentOrHost* to parentOrShadowHost* in Node.h.
index 4340237..a4d6fa2 100644 (file)
@@ -140,7 +140,7 @@ void Connection::platformInvalidate()
         return;
 
 #if PLATFORM(GTK)
-    m_connectionQueue.unregisterEventSourceHandler(m_socketDescriptor);
+    m_connectionQueue->unregisterEventSourceHandler(m_socketDescriptor);
 #endif
 
 #if PLATFORM(QT)
@@ -149,7 +149,7 @@ void Connection::platformInvalidate()
 #endif
 
 #if PLATFORM(EFL)
-    m_connectionQueue.unregisterSocketEventHandler(m_socketDescriptor);
+    m_connectionQueue->unregisterSocketEventHandler(m_socketDescriptor);
 #endif
 
     m_socketDescriptor = -1;
@@ -207,14 +207,12 @@ bool Connection::processMessage()
     if (m_readBufferSize < messageLength)
         return false;
 
-    Deque<Attachment> attachments;
-    AttachmentResourceGuard<Deque<Attachment>, Deque<Attachment>::iterator> attachementDisposer(attachments);
-    RefPtr<WebKit::SharedMemory> oolMessageBody;
-
     size_t attachmentFileDescriptorCount = 0;
     size_t attachmentCount = messageInfo.attachmentCount();
+    OwnArrayPtr<AttachmentInfo> attachmentInfo;
+
     if (attachmentCount) {
-        OwnArrayPtr<AttachmentInfo> attachmentInfo = adoptArrayPtr(new AttachmentInfo[attachmentCount]);
+        attachmentInfo = adoptArrayPtr(new AttachmentInfo[attachmentCount]);
         memcpy(attachmentInfo.get(), messageData, sizeof(AttachmentInfo) * attachmentCount);
         messageData += sizeof(AttachmentInfo) * attachmentCount;
 
@@ -226,13 +224,20 @@ bool Connection::processMessage()
                     attachmentFileDescriptorCount++;
             case Attachment::Uninitialized:
             default:
+                ASSERT_NOT_REACHED();
                 break;
             }
         }
 
         if (messageInfo.isMessageBodyIsOutOfLine())
             attachmentCount--;
+    }
 
+    Vector<Attachment> attachments(attachmentCount);
+    AttachmentResourceGuard<Vector<Attachment>, Vector<Attachment>::iterator> attachementDisposer(attachments);
+    RefPtr<WebKit::SharedMemory> oolMessageBody;
+
+    if (attachmentCount) {
         size_t fdIndex = 0;
         for (size_t i = 0; i < attachmentCount; ++i) {
             int fd = -1;
@@ -240,15 +245,15 @@ bool Connection::processMessage()
             case Attachment::MappedMemoryType:
                 if (!attachmentInfo[i].isNull())
                     fd = m_fileDescriptors[fdIndex++];
-                attachments.append(Attachment(fd, attachmentInfo[i].getSize()));
+                attachments[attachmentCount - i - 1] = Attachment(fd, attachmentInfo[i].getSize());
                 break;
             case Attachment::SocketType:
                 if (!attachmentInfo[i].isNull())
                     fd = m_fileDescriptors[fdIndex++];
-                attachments.append(Attachment(fd));
+                attachments[attachmentCount - i - 1] = Attachment(fd);
                 break;
             case Attachment::Uninitialized:
-                attachments.append(Attachment());
+                attachments[attachmentCount - i - 1] = Attachment();
             default:
                 break;
             }
@@ -418,17 +423,17 @@ bool Connection::open()
 
     m_isConnected = true;
 #if PLATFORM(QT)
-    m_socketNotifier = m_connectionQueue.registerSocketEventHandler(m_socketDescriptor, QSocketNotifier::Read, WTF::bind(&Connection::readyReadHandler, this));
+    m_socketNotifier = m_connectionQueue->registerSocketEventHandler(m_socketDescriptor, QSocketNotifier::Read, WTF::bind(&Connection::readyReadHandler, this));
 #elif PLATFORM(GTK)
-    m_connectionQueue.registerEventSourceHandler(m_socketDescriptor, (G_IO_HUP | G_IO_ERR), WTF::bind(&Connection::connectionDidClose, this));
-    m_connectionQueue.registerEventSourceHandler(m_socketDescriptor, G_IO_IN, WTF::bind(&Connection::readyReadHandler, this));
+    m_connectionQueue->registerEventSourceHandler(m_socketDescriptor, (G_IO_HUP | G_IO_ERR), WTF::bind(&Connection::connectionDidClose, this));
+    m_connectionQueue->registerEventSourceHandler(m_socketDescriptor, G_IO_IN, WTF::bind(&Connection::readyReadHandler, this));
 #elif PLATFORM(EFL)
-    m_connectionQueue.registerSocketEventHandler(m_socketDescriptor, WTF::bind(&Connection::readyReadHandler, this));
+    m_connectionQueue->registerSocketEventHandler(m_socketDescriptor, WTF::bind(&Connection::readyReadHandler, this));
 #endif
 
     // Schedule a call to readyReadHandler. Data may have arrived before installation of the signal
     // handler.
-    m_connectionQueue.dispatch(WTF::bind(&Connection::readyReadHandler, this));
+    m_connectionQueue->dispatch(WTF::bind(&Connection::readyReadHandler, this));
 
     return true;
 }
@@ -556,7 +561,7 @@ bool Connection::sendOutgoingMessage(PassOwnPtr<MessageEncoder> encoder)
 #if PLATFORM(QT)
 void Connection::setShouldCloseConnectionOnProcessTermination(WebKit::PlatformProcessIdentifier process)
 {
-    m_connectionQueue.dispatchOnTermination(process, WTF::bind(&Connection::connectionDidClose, this));
+    m_connectionQueue->dispatchOnTermination(process, WTF::bind(&Connection::connectionDidClose, this));
 }
 #endif
 
index 40b1f10..5b1edeb 100644 (file)
@@ -55,12 +55,12 @@ public:
 
     ~WorkItemQt()
     {
+        m_queue->deref();
     }
 
     Q_SLOT void execute() 
     { 
-        if (m_queue->m_isValid)
-            m_function();
+        m_function();
     }
 
     Q_SLOT void executeAndDelete()
@@ -108,6 +108,7 @@ void WorkQueue::platformInvalidate()
 
 void WorkQueue::dispatch(const Function<void()>& function)
 {
+    ref();
     WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, function);
     itemQt->moveToThread(m_workThread);
     QMetaObject::invokeMethod(itemQt, "executeAndDelete", Qt::QueuedConnection);
@@ -115,6 +116,7 @@ void WorkQueue::dispatch(const Function<void()>& function)
 
 void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delayInSecond)
 {
+    ref();
     WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, function);
     itemQt->startTimer(static_cast<int>(delayInSecond * 1000));
     itemQt->moveToThread(m_workThread);
index 4000ca5..32251b0 100644 (file)
@@ -1236,9 +1236,11 @@ void WebPageProxy::getPluginPath(const String& mimeType, const String& urlString
     if (pluginLoadPolicy != PluginModuleLoadNormally)
         return;
 
+#if PLATFORM(MAC)
     pluginLoadPolicy = m_uiClient.shouldInstantiatePlugin(this, plugin.bundleIdentifier, plugin.info.name) ? PluginModuleLoadNormally : PluginModuleBlocked;
     if (pluginLoadPolicy != PluginModuleLoadNormally)
         return;
+#endif
 
     pluginPath = plugin.path;
 }