diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 20:55:31 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 20:55:31 +0000 |
commit | d0ec242ea9e35797655a15240484f966ad513cc3 (patch) | |
tree | bee9488afb43d4e8705edf9056cda13cf92aa1f2 /content/browser/plugin_process_host.cc | |
parent | 875d83611df7fe24b61233eb6acad0a52c7feec2 (diff) | |
download | chromium_src-d0ec242ea9e35797655a15240484f966ad513cc3.zip chromium_src-d0ec242ea9e35797655a15240484f966ad513cc3.tar.gz chromium_src-d0ec242ea9e35797655a15240484f966ad513cc3.tar.bz2 |
Fix a browser, renderer, plugin deadlock caused by the change to reparent plugin windows in the browser
process. Reparenting occurs via Windows API calls on the IO thread which can result in window messages
being dispatched to plugin windows which may be blocked on outgoing sync calls.
Fix is to execute the Windows API calls on the UI thread.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=85397
BUG=85397
Review URL: http://codereview.chromium.org/6995082
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88393 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/plugin_process_host.cc')
-rw-r--r-- | content/browser/plugin_process_host.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 7cc5514..9b660e9 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -48,6 +48,21 @@ #if defined(OS_WIN) #include "webkit/plugins/npapi/webplugin_delegate_impl.h" +namespace { + +void ReparentPluginWindowHelper(HWND window, HWND parent) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + + int window_style = WS_CHILD; + if (!webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window)) + window_style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS; + + ::SetWindowLongPtr(window, GWL_STYLE, window_style); + ::SetParent(window, parent); +} + +} // namespace + void PluginProcessHost::OnPluginWindowDestroyed(HWND window, HWND parent) { // The window is destroyed at this point, we just care about its parent, which // is the intermediate window we created. @@ -71,13 +86,9 @@ void PluginProcessHost::OnReparentPluginWindow(HWND window, HWND parent) { if (process_id != ::GetCurrentProcessId()) return; - if (webkit::npapi::WebPluginDelegateImpl::IsDummyActivationWindow(window)) { - ::SetWindowLongPtr(window, GWL_STYLE, WS_CHILD); - } else { - ::SetWindowLongPtr(window, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | - WS_CLIPSIBLINGS); - } - ::SetParent(window, parent); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + NewRunnableFunction(ReparentPluginWindowHelper, window, parent)); } #endif // defined(OS_WIN) |