summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 21:19:06 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-01 21:19:06 +0000
commit44b6715519395494bb9287151322a15da774da78 (patch)
treeada10b9560477fadf4e1b44752ed7ee9e93e01da
parent949870e0eba9f1774ad1435e3d12e92bbf7309f0 (diff)
downloadchromium_src-44b6715519395494bb9287151322a15da774da78.zip
chromium_src-44b6715519395494bb9287151322a15da774da78.tar.gz
chromium_src-44b6715519395494bb9287151322a15da774da78.tar.bz2
Check for Carbon Mac plugin destruction after each GetNextEvent cycle
Also removes unnecessary event model checks (this method is only called for Carbon-event plugins) BUG=36928 TEST=none Review URL: http://codereview.chromium.org/661284 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40298 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm58
1 files changed, 27 insertions, 31 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index eac5981..15454fb 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -1049,40 +1049,36 @@ void WebPluginDelegateImpl::FireIdleEvent() {
ScopedActiveDelegate active_delegate(this);
if (!webkit_glue::IsPluginRunningInRendererProcess()) {
- switch (instance()->event_model()) {
- case NPEventModelCarbon:
- // If the plugin is running in a subprocess, drain any pending system
- // events so that the plugin's event handlers will get called on any
- // windows it has created. Filter out activate/deactivate events on
- // the fake browser window, but pass everything else through.
- EventRecord event;
- while (GetNextEvent(everyEvent, &event)) {
- if (event.what == activateEvt && cg_context_.window &&
- reinterpret_cast<void *>(event.message) != cg_context_.window)
- continue;
- instance()->NPP_HandleEvent(&event);
- // If the plugin went away during event handling, we're done.
- if (!instance())
- return;
- }
- break;
+ // If the plugin is running in a subprocess, drain any pending system
+ // events so that the plugin's event handlers will get called on any
+ // windows it has created. Filter out activate/deactivate events on
+ // the fake browser window, but pass everything else through.
+ EventRecord event;
+ while (GetNextEvent(everyEvent, &event)) {
+ if (!instance())
+ return;
+ if (event.what == activateEvt && cg_context_.window &&
+ reinterpret_cast<void *>(event.message) != cg_context_.window)
+ continue;
+ instance()->NPP_HandleEvent(&event);
}
+ // If the plugin went away during event handling, we're done.
+ if (!instance())
+ return;
}
- if (instance()->event_model() == NPEventModelCarbon) {
- // Send an idle event so that the plugin can do background work
- NPEvent np_event = {0};
- np_event.what = nullEvent;
- np_event.when = TickCount();
- np_event.modifiers = GetCurrentKeyModifiers();
- if (!Button())
- np_event.modifiers |= btnState;
- HIPoint mouse_location;
- HIGetMousePosition(kHICoordSpaceScreenPixel, NULL, &mouse_location);
- np_event.where.h = mouse_location.x;
- np_event.where.v = mouse_location.y;
- instance()->NPP_HandleEvent(&np_event);
- }
+ // Send an idle event so that the plugin can do background work
+ NPEvent np_event = {0};
+ np_event.what = nullEvent;
+ np_event.when = TickCount();
+ np_event.modifiers = GetCurrentKeyModifiers();
+ if (!Button())
+ np_event.modifiers |= btnState;
+ HIPoint mouse_location;
+ HIGetMousePosition(kHICoordSpaceScreenPixel, NULL, &mouse_location);
+ np_event.where.h = mouse_location.x;
+ np_event.where.v = mouse_location.y;
+ instance()->NPP_HandleEvent(&np_event);
#ifndef NP_NO_QUICKDRAW
// Quickdraw-based plugins can draw at any time, so tell the renderer to