summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 02:18:30 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 02:18:30 +0000
commit8beff076f15f979f9334ad9f962444f57050fe52 (patch)
treef504f4c35856204e385fa12e2f3c8a45c6bdc6a8 /chrome/renderer
parente67efe3af047fdf3ca4e62ed54cadf12b5bbbea2 (diff)
downloadchromium_src-8beff076f15f979f9334ad9f962444f57050fe52.zip
chromium_src-8beff076f15f979f9334ad9f962444f57050fe52.tar.gz
chromium_src-8beff076f15f979f9334ad9f962444f57050fe52.tar.bz2
Get rid of the need for cross process events in order to get plugin processes to run nested message loops when a dialog is shown. Instead use an async message that's broadcast from the renderer to all plugin processes that are connected to it, and which is dispatched on the plugin IO thread to set a process-local waitable event. This fixes showModalDialog on Linux/Mac.
BUG=15891 TEST=covered by UI tests, undef's them for POSIX Review URL: http://codereview.chromium.org/242043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27456 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/plugin_channel_host.h4
-rw-r--r--chrome/renderer/render_view.cc13
-rw-r--r--chrome/renderer/render_view.h13
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc12
4 files changed, 13 insertions, 29 deletions
diff --git a/chrome/renderer/plugin_channel_host.h b/chrome/renderer/plugin_channel_host.h
index 8d27f9a..f3d066b 100644
--- a/chrome/renderer/plugin_channel_host.h
+++ b/chrome/renderer/plugin_channel_host.h
@@ -33,6 +33,10 @@ class PluginChannelHost : public PluginChannelBase {
static bool IsListening();
+ static void Broadcast(IPC::Message* message) {
+ PluginChannelBase::Broadcast(message);
+ }
+
private:
// Called on the render thread
PluginChannelHost();
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 231cfa7..66ac3bf 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -29,6 +29,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/page_zoom.h"
+#include "chrome/common/plugin_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/renderer_preferences.h"
#include "chrome/common/thumbnail_score.h"
@@ -44,6 +45,7 @@
#include "chrome/renderer/localized_error.h"
#include "chrome/renderer/media/audio_renderer_impl.h"
#include "chrome/renderer/navigation_state.h"
+#include "chrome/renderer/plugin_channel_host.h"
#include "chrome/renderer/print_web_view_helper.h"
#include "chrome/renderer/render_process.h"
#include "chrome/renderer/user_script_slave.h"
@@ -208,7 +210,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
last_indexed_page_id_(-1),
opened_by_user_gesture_(true),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
- modal_dialog_count_(0),
devtools_agent_(NULL),
devtools_client_(NULL),
history_back_list_count_(0),
@@ -230,8 +231,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
document_tag_(0),
webkit_preferences_(webkit_preferences) {
Singleton<RenderViewSet>()->render_view_set_.insert(this);
-
- modal_dialog_event_.reset(new base::WaitableEvent(true, false));
}
RenderView::~RenderView() {
@@ -3573,14 +3572,14 @@ void RenderView::EnsureDocumentTag() {
}
bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
- if (modal_dialog_count_++ == 0)
- modal_dialog_event_->Signal();
+ PluginChannelHost::Broadcast(
+ new PluginMsg_SignalModalDialogEvent(host_window_));
message->EnableMessagePumping(); // Runs a nested message loop.
bool rv = Send(message);
- if (--modal_dialog_count_ == 0)
- modal_dialog_event_->Reset();
+ PluginChannelHost::Broadcast(
+ new PluginMsg_ResetModalDialogEvent(host_window_));
return rv;
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index fd8c981..decad59 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -140,10 +140,6 @@ class RenderView : public RenderWidget,
return host_window_;
}
- base::WaitableEvent* modal_dialog_event() {
- return modal_dialog_event_.get();
- }
-
int browser_window_id() {
return browser_window_id_;
}
@@ -819,15 +815,6 @@ class RenderView : public RenderWidget,
// recent message if new ones come in).
scoped_ptr<IPC::Message> queued_find_reply_message_;
- // Handle to an event that's set when the page is showing a modal dialog (or
- // equivalent constrained window). The renderer and any plugin processes
- // check this to know if they should pump messages/tasks then.
- scoped_ptr<base::WaitableEvent> modal_dialog_event_;
-
- // Multiple dialog boxes can be shown before the first one is finished,
- // so we keep a counter to know when we can reset the modal dialog event.
- int modal_dialog_count_;
-
// Provides access to this renderer from the remote Inspector UI.
scoped_ptr<DevToolsAgent> devtools_agent_;
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 4c5e54e..cdf5720 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -271,9 +271,6 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url,
}
}
params.load_manually = load_manually;
-#if defined(OS_WIN)
- params.modal_dialog_event = render_view_->modal_dialog_event()->handle();
-#endif
plugin_ = plugin;
@@ -746,8 +743,7 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
return NULL;
npobject_ = NPObjectProxy::Create(
- channel_host_.get(), route_id, npobject_ptr,
- render_view_->modal_dialog_event(), page_url_);
+ channel_host_.get(), route_id, npobject_ptr, 0, page_url_);
return WebBindings::retainObject(npobject_);
}
@@ -833,8 +829,7 @@ void WebPluginDelegateProxy::OnGetWindowScriptNPObject(
// The stub will delete itself when the proxy tells it that it's released, or
// otherwise when the channel is closed.
NPObjectStub* stub = new NPObjectStub(
- npobject, channel_host_.get(), route_id,
- render_view_->modal_dialog_event(), page_url_);
+ npobject, channel_host_.get(), route_id, 0, page_url_);
window_script_object_ = stub;
window_script_object_->set_proxy(this);
*success = true;
@@ -853,8 +848,7 @@ void WebPluginDelegateProxy::OnGetPluginElement(
// The stub will delete itself when the proxy tells it that it's released, or
// otherwise when the channel is closed.
new NPObjectStub(
- npobject, channel_host_.get(), route_id,
- render_view_->modal_dialog_event(), page_url_);
+ npobject, channel_host_.get(), route_id, 0, page_url_);
*success = true;
*npobject_ptr = reinterpret_cast<intptr_t>(npobject);
}