diff options
Diffstat (limited to 'Source/WebKit2/Platform')
-rw-r--r-- | Source/WebKit2/Platform/CoreIPC/Connection.cpp | 12 | ||||
-rw-r--r-- | Source/WebKit2/Platform/CoreIPC/HandleMessage.h | 6 | ||||
-rw-r--r-- | Source/WebKit2/Platform/CoreIPC/MessageID.h | 8 | ||||
-rw-r--r-- | Source/WebKit2/Platform/SharedMemory.h | 4 | ||||
-rw-r--r-- | Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit2/Platform/mac/SharedMemoryMac.cpp | 48 | ||||
-rw-r--r-- | Source/WebKit2/Platform/qt/ModuleQt.cpp | 1 | ||||
-rw-r--r-- | Source/WebKit2/Platform/qt/WorkQueueQt.cpp | 8 | ||||
-rw-r--r-- | Source/WebKit2/Platform/win/RunLoopWin.cpp | 2 | ||||
-rw-r--r-- | Source/WebKit2/Platform/win/WorkQueueWin.cpp | 2 |
11 files changed, 71 insertions, 24 deletions
diff --git a/Source/WebKit2/Platform/CoreIPC/Connection.cpp b/Source/WebKit2/Platform/CoreIPC/Connection.cpp index 5cbd4bc..281ccb6 100644 --- a/Source/WebKit2/Platform/CoreIPC/Connection.cpp +++ b/Source/WebKit2/Platform/CoreIPC/Connection.cpp @@ -343,10 +343,8 @@ PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uin // We only allow sending sync messages from the client run loop. ASSERT(RunLoop::current() == m_clientRunLoop); - if (!isValid()) { - m_client->didFailToSendSyncMessage(this); + if (!isValid()) return 0; - } // Push the pending sync reply information on our stack. { @@ -358,12 +356,14 @@ PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uin m_pendingSyncReplies.append(PendingSyncReply(syncRequestID)); } - - // First send the message. - sendMessage(messageID, encoder); + // We have to begin waiting for the sync reply before sending the message, in case the other side + // would have sent a request before us, which would lead to a deadlock. m_syncMessageState->beginWaitForSyncReply(); + // First send the message. + sendMessage(messageID, encoder); + // Then wait for a reply. Waiting for a reply could involve dispatching incoming sync messages, so // keep an extra reference to the connection here in case it's invalidated. RefPtr<Connection> protect(this); diff --git a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h index abbe089..a99c76e 100644 --- a/Source/WebKit2/Platform/CoreIPC/HandleMessage.h +++ b/Source/WebKit2/Platform/CoreIPC/HandleMessage.h @@ -235,6 +235,12 @@ void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Argument (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, argumentDecoder, replyArgs.argument1, replyArgs.argument2); } +template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2, typename R3> +void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, ArgumentDecoder* argumentDecoder, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function) +{ + (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, argumentDecoder, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3); +} + // Main dispatch functions template<typename T, typename C, typename MF> diff --git a/Source/WebKit2/Platform/CoreIPC/MessageID.h b/Source/WebKit2/Platform/CoreIPC/MessageID.h index bd8180a..83154ec 100644 --- a/Source/WebKit2/Platform/CoreIPC/MessageID.h +++ b/Source/WebKit2/Platform/CoreIPC/MessageID.h @@ -39,24 +39,32 @@ enum MessageClass { MessageClassDrawingArea, MessageClassDrawingAreaLegacy, MessageClassInjectedBundle, + MessageClassWebApplicationCacheManager, + MessageClassWebCookieManager, MessageClassWebDatabaseManager, MessageClassWebGeolocationManagerProxy, MessageClassWebInspector, + MessageClassWebKeyValueStorageManager, MessageClassWebPage, MessageClassWebProcess, + MessageClassWebResourceCacheManager, // Messages sent by the web process to the UI process. MessageClassDownloadProxy, MessageClassDrawingAreaProxy, MessageClassDrawingAreaProxyLegacy, + MessageClassWebApplicationCacheManagerProxy, MessageClassWebContext, MessageClassWebContextLegacy, + MessageClassWebCookieManagerProxy, MessageClassWebDatabaseManagerProxy, MessageClassWebGeolocationManager, MessageClassWebInspectorProxy, + MessageClassWebKeyValueStorageManagerProxy, MessageClassWebPageProxy, MessageClassWebProcessProxy, MessageClassWebProcessProxyLegacy, + MessageClassWebResourceCacheManagerProxy, // Messages sent by the UI process to the plug-in process. MessageClassPluginProcess, diff --git a/Source/WebKit2/Platform/SharedMemory.h b/Source/WebKit2/Platform/SharedMemory.h index fd1d60c..a4b95bf 100644 --- a/Source/WebKit2/Platform/SharedMemory.h +++ b/Source/WebKit2/Platform/SharedMemory.h @@ -95,7 +95,9 @@ public: private: size_t m_size; void* m_data; -#if PLATFORM(WIN) +#if PLATFORM(MAC) + mach_port_t m_port; +#elif PLATFORM(WIN) HANDLE m_handle; #elif PLATFORM(QT) int m_fileDescriptor; diff --git a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp index 3900e20..faccf10 100644 --- a/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp +++ b/Source/WebKit2/Platform/gtk/SharedMemoryGtk.cpp @@ -27,7 +27,7 @@ #include "config.h" #include "SharedMemory.h" -#include "NotImplemented.h" +#include <WebCore/NotImplemented.h> namespace WebKit { diff --git a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp index 3d59c80..dbe38bd 100644 --- a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp +++ b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "WorkQueue.h" -#include "NotImplemented.h" #include "WKBase.h" +#include <WebCore/NotImplemented.h> #include <glib.h> // WorkQueue::EventSource diff --git a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp index 198ba69..4f55dec 100644 --- a/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp +++ b/Source/WebKit2/Platform/mac/SharedMemoryMac.cpp @@ -98,9 +98,22 @@ PassRefPtr<SharedMemory> SharedMemory::create(size_t size) if (kr != KERN_SUCCESS) return 0; + // Create a Mach port that represents the shared memory. + mach_port_t port; + memory_object_size_t memoryObjectSize = round_page(size); + kr = mach_make_memory_entry_64(mach_task_self(), &memoryObjectSize, address, VM_PROT_DEFAULT, &port, MACH_PORT_NULL); + + if (kr != KERN_SUCCESS) { + mach_vm_deallocate(mach_task_self(), address, round_page(size)); + return 0; + } + + ASSERT(memoryObjectSize >= round_page(size)); + RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory)); sharedMemory->m_size = size; sharedMemory->m_data = toPointer(address); + sharedMemory->m_port = port; return sharedMemory.release(); } @@ -133,17 +146,22 @@ PassRefPtr<SharedMemory> SharedMemory::create(const Handle& handle, Protection p RefPtr<SharedMemory> sharedMemory(adoptRef(new SharedMemory)); sharedMemory->m_size = handle.m_size; sharedMemory->m_data = toPointer(mappedAddress); - + sharedMemory->m_port = MACH_PORT_NULL; + return sharedMemory.release(); } SharedMemory::~SharedMemory() { - if (!m_data) - return; - - kern_return_t kr = mach_vm_deallocate(mach_task_self(), toVMAddress(m_data), round_page(m_size)); - ASSERT_UNUSED(kr, kr == KERN_SUCCESS); + if (m_data) { + kern_return_t kr = mach_vm_deallocate(mach_task_self(), toVMAddress(m_data), round_page(m_size)); + ASSERT_UNUSED(kr, kr == KERN_SUCCESS); + } + + if (m_port) { + kern_return_t kr = mach_port_deallocate(mach_task_self(), m_port); + ASSERT_UNUSED(kr, kr == KERN_SUCCESS); + } } bool SharedMemory::createHandle(Handle& handle, Protection protection) @@ -154,11 +172,21 @@ bool SharedMemory::createHandle(Handle& handle, Protection protection) mach_vm_address_t address = toVMAddress(m_data); memory_object_size_t size = round_page(m_size); - // Create a mach port that represents the shared memory. mach_port_t port; - kern_return_t kr = mach_make_memory_entry_64(mach_task_self(), &size, address, machProtection(protection), &port, MACH_PORT_NULL); - if (kr != KERN_SUCCESS) - return false; + + if (protection == ReadWrite && m_port) { + // Just re-use the port we have. + port = m_port; + if (mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, 1) != KERN_SUCCESS) + return false; + } else { + // Create a mach port that represents the shared memory. + kern_return_t kr = mach_make_memory_entry_64(mach_task_self(), &size, address, machProtection(protection), &port, MACH_PORT_NULL); + if (kr != KERN_SUCCESS) + return false; + + ASSERT(size >= round_page(m_size)); + } handle.m_port = port; handle.m_size = size; diff --git a/Source/WebKit2/Platform/qt/ModuleQt.cpp b/Source/WebKit2/Platform/qt/ModuleQt.cpp index de83691..98815a2 100644 --- a/Source/WebKit2/Platform/qt/ModuleQt.cpp +++ b/Source/WebKit2/Platform/qt/ModuleQt.cpp @@ -32,6 +32,7 @@ namespace WebKit { bool Module::load() { m_lib.setFileName(static_cast<QString>(m_path)); + m_lib.setLoadHints(QLibrary::ResolveAllSymbolsHint); return m_lib.load(); } diff --git a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp index 24af404..7a6ec5e 100644 --- a/Source/WebKit2/Platform/qt/WorkQueueQt.cpp +++ b/Source/WebKit2/Platform/qt/WorkQueueQt.cpp @@ -31,8 +31,8 @@ #include <QObject> #include <QThread> #include <QProcess> +#include <WebCore/NotImplemented.h> #include <wtf/Threading.h> -#include "NotImplemented.h" class WorkQueue::WorkItemQt : public QObject { Q_OBJECT @@ -111,9 +111,11 @@ void WorkQueue::scheduleWork(PassOwnPtr<WorkItem> item) itemQt->moveToThread(m_workThread); } -void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem>, double) +void WorkQueue::scheduleWorkAfterDelay(PassOwnPtr<WorkItem> item, double delayInSecond) { - notImplemented(); + WorkQueue::WorkItemQt* itemQt = new WorkQueue::WorkItemQt(this, item.leakPtr()); + itemQt->startTimer(static_cast<int>(delayInSecond * 1000)); + itemQt->moveToThread(m_workThread); } void WorkQueue::scheduleWorkOnTermination(WebKit::PlatformProcessIdentifier process, PassOwnPtr<WorkItem> workItem) diff --git a/Source/WebKit2/Platform/win/RunLoopWin.cpp b/Source/WebKit2/Platform/win/RunLoopWin.cpp index 7980e36..0ca7d9b 100644 --- a/Source/WebKit2/Platform/win/RunLoopWin.cpp +++ b/Source/WebKit2/Platform/win/RunLoopWin.cpp @@ -156,7 +156,7 @@ void RunLoop::TimerBase::start(double nextFireInterval, bool repeat) { m_isRepeating = repeat; m_runLoop->m_activeTimers.set(m_ID, this); - ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval, 0); + ::SetTimer(m_runLoop->m_runLoopMessageWindow, m_ID, nextFireInterval * 1000, 0); } void RunLoop::TimerBase::stop() diff --git a/Source/WebKit2/Platform/win/WorkQueueWin.cpp b/Source/WebKit2/Platform/win/WorkQueueWin.cpp index f751b5d..0a89225 100644 --- a/Source/WebKit2/Platform/win/WorkQueueWin.cpp +++ b/Source/WebKit2/Platform/win/WorkQueueWin.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "WorkQueue.h" +#include <WebCore/NotImplemented.h> #include <wtf/Threading.h> -#include "NotImplemented.h" inline WorkQueue::WorkItemWin::WorkItemWin(PassOwnPtr<WorkItem> item, WorkQueue* queue) : m_item(item) |