summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 03:48:53 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 03:48:53 +0000
commitbecd0bb2eb351e666ade9ec2ddc390aa892f5f5f (patch)
tree5a1077c92e4c4f30e220fc690f88449f675d466a /ppapi
parenta8af032a15562918cac89afa4b00a6f13fceef60 (diff)
downloadchromium_src-becd0bb2eb351e666ade9ec2ddc390aa892f5f5f.zip
chromium_src-becd0bb2eb351e666ade9ec2ddc390aa892f5f5f.tar.gz
chromium_src-becd0bb2eb351e666ade9ec2ddc390aa892f5f5f.tar.bz2
Merge 84751 - Keep a reference to the module when handling PPB_Flash::Navigate
This is needed because Navigate can end up destroying the last instance, but the dispatcher is still needed to send the reply. This also cleans up a typo in a safeguard, and an incorrect assumption. BUG=chromium-os:15044 TEST=http://nmd.mcd06514.orl.wayport.net/index.adp?MacAddr=48%3a5D%3a60%3a77%3a53%3a2A&IpAddr=192%2e168%2e6%2e84&vsgpId=&vsgId=60982&UserAgent=&ProxyHost= Review URL: http://codereview.chromium.org/6999006 TBR=piman@google.com Review URL: http://codereview.chromium.org/6991003 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@84752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/host_dispatcher.cc2
-rw-r--r--ppapi/proxy/plugin_resource_tracker.cc13
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc5
3 files changed, 12 insertions, 8 deletions
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index 2f4be5a..d755138 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -152,7 +152,7 @@ bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) {
if (Dispatcher::OnMessageReceived(msg))
return true;
- if (msg.routing_id() <= 0 && msg.routing_id() >= INTERFACE_ID_COUNT) {
+ if (msg.routing_id() <= 0 || msg.routing_id() >= INTERFACE_ID_COUNT) {
NOTREACHED();
// TODO(brettw): kill the plugin if it starts sending invalid messages?
return true;
diff --git a/ppapi/proxy/plugin_resource_tracker.cc b/ppapi/proxy/plugin_resource_tracker.cc
index 2e9e32a..87c8ec8 100644
--- a/ppapi/proxy/plugin_resource_tracker.cc
+++ b/ppapi/proxy/plugin_resource_tracker.cc
@@ -131,13 +131,12 @@ void PluginResourceTracker::ReleasePluginResourceRef(
resource_map_.erase(found);
plugin_resource.reset();
- if (notify_browser_on_release) {
- if (dispatcher) {
- dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
- INTERFACE_ID_PPB_CORE, host_resource));
- } else {
- NOTREACHED();
- }
+ // dispatcher can be NULL if the plugin held on to a resource after the
+ // instance was destroyed. In that case the browser-side resource has
+ // already been freed correctly on the browser side.
+ if (notify_browser_on_release && dispatcher) {
+ dispatcher->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
+ INTERFACE_ID_PPB_CORE, host_resource));
}
}
}
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index fab5fd3..a794073 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -183,6 +183,11 @@ const InterfaceProxy::Info* PPB_Flash_Proxy::GetInfo() {
}
bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
+ // Prevent the dispatcher from going away during a call to Navigate.
+ // This must happen OUTSIDE of OnMsgNavigate since the handling code use
+ // the dispatcher upon return of the function (sending the reply message).
+ ScopedModuleReference death_grip(dispatcher());
+
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop,