| 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) {
|
|
|