| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/plugin/plugin_channel.h" | 5 #include "content/plugin/plugin_channel.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 base::WaitableEvent* event; | 129 base::WaitableEvent* event; |
| 130 int refcount; // There could be multiple plugin instances per tab. | 130 int refcount; // There could be multiple plugin instances per tab. |
| 131 }; | 131 }; |
| 132 typedef std::map<gfx::NativeViewId, WaitableEventWrapper> ModalDialogEventMap; | 132 typedef std::map<gfx::NativeViewId, WaitableEventWrapper> ModalDialogEventMap; |
| 133 ModalDialogEventMap modal_dialog_event_map_; | 133 ModalDialogEventMap modal_dialog_event_map_; |
| 134 base::Lock modal_dialog_event_map_lock_; | 134 base::Lock modal_dialog_event_map_lock_; |
| 135 | 135 |
| 136 IPC::Channel* channel_; | 136 IPC::Channel* channel_; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 PluginChannel* PluginChannel::GetPluginChannel(int renderer_id, | 139 PluginChannel* PluginChannel::GetPluginChannel( |
| 140 MessageLoop* ipc_message_loop) { | 140 int renderer_id, base::MessageLoopProxy* ipc_message_loop) { |
| 141 // Map renderer ID to a (single) channel to that process. | 141 // Map renderer ID to a (single) channel to that process. |
| 142 std::string channel_key = StringPrintf( | 142 std::string channel_key = StringPrintf( |
| 143 "%d.r%d", base::GetCurrentProcId(), renderer_id); | 143 "%d.r%d", base::GetCurrentProcId(), renderer_id); |
| 144 | 144 |
| 145 PluginChannel* channel = | 145 PluginChannel* channel = |
| 146 static_cast<PluginChannel*>(PluginChannelBase::GetChannel( | 146 static_cast<PluginChannel*>(PluginChannelBase::GetChannel( |
| 147 channel_key, | 147 channel_key, |
| 148 IPC::Channel::MODE_SERVER, | 148 IPC::Channel::MODE_SERVER, |
| 149 ClassFactory, | 149 ClassFactory, |
| 150 ipc_message_loop, | 150 ipc_message_loop, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 // Need to addref this object temporarily because otherwise removing the last | 317 // Need to addref this object temporarily because otherwise removing the last |
| 318 // stub will cause the destructor of this object to be called, however at | 318 // stub will cause the destructor of this object to be called, however at |
| 319 // that point plugin_stubs_ will have one element and its destructor will be | 319 // that point plugin_stubs_ will have one element and its destructor will be |
| 320 // called twice. | 320 // called twice. |
| 321 scoped_refptr<PluginChannel> me(this); | 321 scoped_refptr<PluginChannel> me(this); |
| 322 | 322 |
| 323 plugin_stubs_.clear(); | 323 plugin_stubs_.clear(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool PluginChannel::Init(MessageLoop* ipc_message_loop, bool create_pipe_now) { | 326 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, |
| 327 bool create_pipe_now) { |
| 327 if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now)) | 328 if (!PluginChannelBase::Init(ipc_message_loop, create_pipe_now)) |
| 328 return false; | 329 return false; |
| 329 | 330 |
| 330 channel_->AddFilter(filter_.get()); | 331 channel_->AddFilter(filter_.get()); |
| 331 return true; | 332 return true; |
| 332 } | 333 } |
| 333 | 334 |
| OLD | NEW |