summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 21:24:03 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 21:24:03 +0000
commit5d89cc98e7423ec7c0d6506f956ba68ab84d8477 (patch)
tree8694d8693c2e62923e4153e839e1a13930cc5739 /chrome/plugin
parentc51ec376738f7f8748ffefffd2a4db3403220c8c (diff)
downloadchromium_src-5d89cc98e7423ec7c0d6506f956ba68ab84d8477.zip
chromium_src-5d89cc98e7423ec7c0d6506f956ba68ab84d8477.tar.gz
chromium_src-5d89cc98e7423ec7c0d6506f956ba68ab84d8477.tar.bz2
Fail the plugin initialization if we are unable to duplicate the event handle which is used for deciding whether we need to pump window messages in outgoing sync calls from the plugin. The theory is that the DuplicateHandle call could fail if the renderer process exited.
It is unclear as to what a reliable test for this would be. Will think over and possibly add in a future CB. Fixes http://code.google.com/p/chromium/issues/detail?id=10972 Bug=10972 Review URL: http://codereview.chromium.org/99018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14662 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc3
-rw-r--r--chrome/plugin/webplugin_proxy.cc8
-rw-r--r--chrome/plugin/webplugin_proxy.h3
3 files changed, 10 insertions, 4 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index a782b65..dcf7505 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -144,7 +144,8 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
if (delegate_) {
webplugin_ = new WebPluginProxy(channel_, instance_id_, delegate_);
#if defined(OS_WIN)
- webplugin_->SetModalDialogEvent(params.modal_dialog_event);
+ if (!webplugin_->SetModalDialogEvent(params.modal_dialog_event))
+ return;
#endif
*result = delegate_->Initialize(
params.url, argn, argv, argc, webplugin_, params.load_manually);
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 3890ec9..0a3a412 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -78,10 +78,10 @@ void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) {
route_id_, pump_messages_event_for_renderer));
}
-void WebPluginProxy::SetModalDialogEvent(HANDLE modal_dialog_event) {
+bool WebPluginProxy::SetModalDialogEvent(HANDLE modal_dialog_event) {
// TODO(port): figure out how this will be set in the browser process, or
// come up with a different mechanism.
- HANDLE event;
+ HANDLE event = NULL;
BOOL result = DuplicateHandle(channel_->renderer_handle(),
modal_dialog_event,
GetCurrentProcess(),
@@ -92,7 +92,11 @@ void WebPluginProxy::SetModalDialogEvent(HANDLE modal_dialog_event) {
DCHECK(result) <<
"Couldn't duplicate the modal dialog handle for the plugin." \
"handle: " << channel_->renderer_handle() << ". err: " << GetLastError();
+ if (!event)
+ return false;
+
modal_dialog_event_.reset(new base::WaitableEvent(event));
+ return true;
}
#endif
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index f181613..2822fa8 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -39,7 +39,8 @@ class WebPluginProxy : public WebPlugin {
void WillDestroyWindow(gfx::NativeView window);
#if defined(OS_WIN)
void SetWindowlessPumpEvent(HANDLE pump_messages_event);
- void SetModalDialogEvent(HANDLE modal_dialog_event);
+ // Returns true on success.
+ bool SetModalDialogEvent(HANDLE modal_dialog_event);
#endif
void CancelResource(int id);
void Invalidate();