summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 21:48:36 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 21:48:36 +0000
commit875d489e8aadd251c638c1bad6bb7ca967605f98 (patch)
treee1be54c561d33b240f6c88b042c9b2df732ac5c6 /chrome/plugin
parente3db4fabfc7aabca3cd1998e05d2a769fbd0c5b6 (diff)
downloadchromium_src-875d489e8aadd251c638c1bad6bb7ca967605f98.zip
chromium_src-875d489e8aadd251c638c1bad6bb7ca967605f98.tar.gz
chromium_src-875d489e8aadd251c638c1bad6bb7ca967605f98.tar.bz2
Fix hang seen in plugin process because plugin creation ended up having to wait on UI thread. Instead of using sync messages, the plugin hwnd is initially parented to the RenderWidgetHost's HWND. It's then lazily reparented to an intermediate HWND on the UI thread when it comes time to move it.
BUG=10711 TEST=added regression tests, but testers please confirm plugins on top video sites are placed correctly. Review URL: http://codereview.chromium.org/67285 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14137 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/webplugin_proxy.cc39
-rw-r--r--chrome/plugin/webplugin_proxy.h4
2 files changed, 11 insertions, 32 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 7933082..6a827ce 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -38,49 +38,28 @@ WebPluginProxy::WebPluginProxy(
delegate_(delegate),
waiting_for_paint_(false),
#pragma warning(suppress: 4355) // can use this
- runnable_method_factory_(this),
- parent_window_(NULL) {
+ runnable_method_factory_(this) {
}
WebPluginProxy::~WebPluginProxy() {
if (cp_browsing_context_)
GetContextMap().erase(cp_browsing_context_);
-
- if (parent_window_) {
- PluginThread::current()->Send(
- new PluginProcessHostMsg_DestroyWindow(parent_window_));
- }
}
bool WebPluginProxy::Send(IPC::Message* msg) {
return channel_->Send(msg);
}
-bool WebPluginProxy::SetWindow(gfx::NativeView window) {
- if (window) {
- // To make scrolling windowed plugins fast, we create the page's direct
- // child windows in the browser process. This way no cross process messages
- // are sent.
- HWND old_parent = GetParent(window);
- IPC::SyncMessage* msg = new PluginProcessHostMsg_CreateWindow(
- old_parent, &parent_window_);
-
- // Need to process window messages in the meantime to avoid a deadlock if
- // the browser paints or sends any other (synchronous) WM_ message to the
- // plugin window.
- msg->EnableMessagePumping();
- PluginThread::current()->Send(msg);
-
- SetParent(window, parent_window_);
-
- // We want the browser process to move this window which has a message loop
- // in its process.
- window = parent_window_;
- }
-
+void WebPluginProxy::SetWindow(gfx::NativeView window) {
Send(new PluginHostMsg_SetWindow(route_id_, gfx::IdFromNativeView(window)));
+}
- return false;
+void WebPluginProxy::WillDestroyWindow(gfx::NativeView window) {
+#if defined(OS_WIN)
+ PluginThread::current()->Send(
+ new PluginProcessHostMsg_PluginWindowDestroyed(
+ window, ::GetParent(window)));
+#endif
}
#if defined(OS_WIN)
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 8c4629d..ea2c124 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -34,7 +34,8 @@ class WebPluginProxy : public WebPlugin {
~WebPluginProxy();
// WebPlugin overrides
- bool SetWindow(gfx::NativeView window);
+ void SetWindow(gfx::NativeView window);
+ void WillDestroyWindow(gfx::NativeView window);
#if defined(OS_WIN)
void SetWindowlessPumpEvent(HANDLE pump_messages_event);
void SetModalDialogEvent(HANDLE modal_dialog_event);
@@ -136,7 +137,6 @@ class WebPluginProxy : public WebPlugin {
bool waiting_for_paint_;
uint32 cp_browsing_context_;
scoped_ptr<base::WaitableEvent> modal_dialog_event_;
- HWND parent_window_;
// Variables used for desynchronized windowless plugin painting. See note in
// webplugin_delegate_proxy.h for how this works.