OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 int refcount; // There could be multiple plugin instances per tab. | 133 int refcount; // There could be multiple plugin instances per tab. |
134 }; | 134 }; |
135 typedef std::map<int, WaitableEventWrapper> ModalDialogEventMap; | 135 typedef std::map<int, WaitableEventWrapper> ModalDialogEventMap; |
136 ModalDialogEventMap modal_dialog_event_map_; | 136 ModalDialogEventMap modal_dialog_event_map_; |
137 base::Lock modal_dialog_event_map_lock_; | 137 base::Lock modal_dialog_event_map_lock_; |
138 | 138 |
139 IPC::Sender* sender_; | 139 IPC::Sender* sender_; |
140 }; | 140 }; |
141 | 141 |
142 PluginChannel* PluginChannel::GetPluginChannel( | 142 PluginChannel* PluginChannel::GetPluginChannel( |
143 int renderer_id, base::MessageLoopProxy* ipc_message_loop) { | 143 int renderer_id, base::SingleThreadTaskRunner* ipc_task_runner) { |
144 // Map renderer ID to a (single) channel to that process. | 144 // Map renderer ID to a (single) channel to that process. |
145 std::string channel_key = base::StringPrintf( | 145 std::string channel_key = base::StringPrintf( |
146 "%d.r%d", base::GetCurrentProcId(), renderer_id); | 146 "%d.r%d", base::GetCurrentProcId(), renderer_id); |
147 | 147 |
148 PluginChannel* channel = | 148 PluginChannel* channel = |
149 static_cast<PluginChannel*>(NPChannelBase::GetChannel( | 149 static_cast<PluginChannel*>(NPChannelBase::GetChannel( |
150 channel_key, | 150 channel_key, |
151 IPC::Channel::MODE_SERVER, | 151 IPC::Channel::MODE_SERVER, |
152 ClassFactory, | 152 ClassFactory, |
153 ipc_message_loop, | 153 ipc_task_runner, |
154 false, | 154 false, |
155 ChildProcess::current()->GetShutDownEvent())); | 155 ChildProcess::current()->GetShutDownEvent())); |
156 | 156 |
157 if (channel) | 157 if (channel) |
158 channel->renderer_id_ = renderer_id; | 158 channel->renderer_id_ = renderer_id; |
159 | 159 |
160 return channel; | 160 return channel; |
161 } | 161 } |
162 | 162 |
163 // static | 163 // static |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 scoped_refptr<PluginChannel> me(this); | 219 scoped_refptr<PluginChannel> me(this); |
220 | 220 |
221 while (!plugin_stubs_.empty()) { | 221 while (!plugin_stubs_.empty()) { |
222 // Separate vector::erase and ~WebPluginDelegateStub. | 222 // Separate vector::erase and ~WebPluginDelegateStub. |
223 // See https://code.google.com/p/chromium/issues/detail?id=314088 | 223 // See https://code.google.com/p/chromium/issues/detail?id=314088 |
224 scoped_refptr<WebPluginDelegateStub> stub = plugin_stubs_[0]; | 224 scoped_refptr<WebPluginDelegateStub> stub = plugin_stubs_[0]; |
225 plugin_stubs_.erase(plugin_stubs_.begin()); | 225 plugin_stubs_.erase(plugin_stubs_.begin()); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, | 229 bool PluginChannel::Init(base::SingleThreadTaskRunner* ipc_task_runner, |
230 bool create_pipe_now, | 230 bool create_pipe_now, |
231 base::WaitableEvent* shutdown_event) { | 231 base::WaitableEvent* shutdown_event) { |
232 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event)) | 232 if (!NPChannelBase::Init(ipc_task_runner, create_pipe_now, shutdown_event)) |
233 return false; | 233 return false; |
234 | 234 |
235 channel_->AddFilter(filter_.get()); | 235 channel_->AddFilter(filter_.get()); |
236 return true; | 236 return true; |
237 } | 237 } |
238 | 238 |
239 PluginChannel::PluginChannel() | 239 PluginChannel::PluginChannel() |
240 : renderer_id_(-1), | 240 : renderer_id_(-1), |
241 in_send_(0), | 241 in_send_(0), |
242 incognito_(false), | 242 incognito_(false), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 void PluginChannel::OnDidAbortLoading(int render_view_id) { | 338 void PluginChannel::OnDidAbortLoading(int render_view_id) { |
339 for (size_t i = 0; i < plugin_stubs_.size(); ++i) { | 339 for (size_t i = 0; i < plugin_stubs_.size(); ++i) { |
340 if (plugin_stubs_[i]->webplugin()->host_render_view_routing_id() == | 340 if (plugin_stubs_[i]->webplugin()->host_render_view_routing_id() == |
341 render_view_id) { | 341 render_view_id) { |
342 plugin_stubs_[i]->delegate()->instance()->CloseStreams(); | 342 plugin_stubs_[i]->delegate()->instance()->CloseStreams(); |
343 } | 343 } |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 } // namespace content | 347 } // namespace content |
OLD | NEW |