summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/WebProcess/win
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-02 12:07:03 +0100
committerBen Murdoch <benm@google.com>2011-06-10 10:47:21 +0100
commit2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch)
treee4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebKit2/WebProcess/win
parent87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff)
downloadexternal_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz
external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebKit2/WebProcess/win')
-rw-r--r--Source/WebKit2/WebProcess/win/WebProcessWin.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp
index d56fef6..d9a4af5 100644
--- a/Source/WebKit2/WebProcess/win/WebProcessWin.cpp
+++ b/Source/WebKit2/WebProcess/win/WebProcessWin.cpp
@@ -27,6 +27,7 @@
#include "WebProcess.h"
#include "WebCookieManager.h"
+#include "WebPage.h"
#include "WebProcessCreationParameters.h"
#include <WebCore/FileSystem.h>
#include <WebCore/MemoryCache.h>
@@ -137,4 +138,49 @@ void WebProcess::setShouldPaintNativeControls(bool shouldPaintNativeControls)
#endif
}
+struct EnumWindowsContext {
+ DWORD currentThreadID;
+ Vector<HWND>* windows;
+};
+
+static BOOL CALLBACK addWindowToVectorIfOwnedByCurrentThread(HWND window, LPARAM lParam)
+{
+ EnumWindowsContext* context = reinterpret_cast<EnumWindowsContext*>(lParam);
+
+ if (::GetWindowThreadProcessId(window, 0) != context->currentThreadID)
+ return TRUE;
+
+ context->windows->append(window);
+ return TRUE;
+}
+
+Vector<HWND> WebProcess::windowsToReceiveSentMessagesWhileWaitingForSyncReply()
+{
+ Vector<HWND> windows;
+
+ // Any non-message-only window created by this thread needs to receive sent messages while we
+ // wait for a sync reply. Otherwise we could deadlock with the UI process if, e.g., the focus
+ // window changes. See <http://webkit.org/b/58239>.
+
+ EnumWindowsContext context;
+ context.currentThreadID = ::GetCurrentThreadId();
+ context.windows = &windows;
+
+ // Start out with top-level windows created by this thread (like Flash's hidden
+ // SWFlash_PlaceholderX top-level windows).
+ ::EnumThreadWindows(context.currentThreadID, addWindowToVectorIfOwnedByCurrentThread, reinterpret_cast<LPARAM>(&context));
+
+ // Also include any descendants of those top-level windows.
+ size_t topLevelWindowCount = windows.size();
+ for (size_t i = 0; i < topLevelWindowCount; ++i)
+ ::EnumChildWindows(windows[i], addWindowToVectorIfOwnedByCurrentThread, reinterpret_cast<LPARAM>(&context));
+
+ // Also include any descendants of the WebPages' windows which we've created (e.g., for windowed plugins).
+ HashMap<uint64_t, RefPtr<WebPage> >::const_iterator::Values end = m_pageMap.end();
+ for (HashMap<uint64_t, RefPtr<WebPage> >::const_iterator::Values it = m_pageMap.begin(); it != end; ++it)
+ ::EnumChildWindows((*it)->nativeWindow(), addWindowToVectorIfOwnedByCurrentThread, reinterpret_cast<LPARAM>(&context));
+
+ return windows;
+}
+
} // namespace WebKit