Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5562)

Unified Diff: chrome/plugin/plugin_channel_base.cc

Issue 375005: When a plugin calls NPN_SetException, pass the exception along to every rende... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/plugin/plugin_channel_base.h ('k') | chrome/renderer/plugin_channel_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/plugin/plugin_channel_base.cc
===================================================================
--- chrome/plugin/plugin_channel_base.cc (revision 32119)
+++ chrome/plugin/plugin_channel_base.cc (working copy)
@@ -4,7 +4,10 @@
#include "chrome/plugin/plugin_channel_base.h"
+#include <stack>
+
#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
#include "chrome/common/child_process.h"
#include "ipc/ipc_sync_message.h"
@@ -17,6 +20,8 @@
static PluginChannelMap g_plugin_channels_;
+static base::LazyInstance<std::stack<scoped_refptr<PluginChannelBase> > >
+ lazy_plugin_channel_stack_(base::LINKER_INITIALIZED);
PluginChannelBase* PluginChannelBase::GetChannel(
const std::string& channel_name, IPC::Channel::Mode mode,
@@ -67,6 +72,10 @@
PluginChannelBase::~PluginChannelBase() {
}
+PluginChannelBase* PluginChannelBase::GetCurrentChannel() {
+ return lazy_plugin_channel_stack_.Pointer()->top();
+}
+
void PluginChannelBase::CleanupChannels() {
// Make a copy of the references as we can't iterate the map since items will
// be removed from it as we clean them up.
@@ -115,7 +124,8 @@
void PluginChannelBase::OnMessageReceived(const IPC::Message& message) {
// This call might cause us to be deleted, so keep an extra reference to
// ourself so that we can send the reply and decrement back in_dispatch_.
- scoped_refptr<PluginChannelBase> me(this);
+ lazy_plugin_channel_stack_.Pointer()->push(
+ scoped_refptr<PluginChannelBase>(this));
in_dispatch_++;
if (message.routing_id() == MSG_ROUTING_CONTROL) {
@@ -131,6 +141,8 @@
}
}
in_dispatch_--;
+
+ lazy_plugin_channel_stack_.Pointer()->pop();
}
void PluginChannelBase::OnChannelConnected(int32 peer_pid) {
« no previous file with comments | « chrome/plugin/plugin_channel_base.h ('k') | chrome/renderer/plugin_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698