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

Side by Side Diff: content/plugin/plugin_channel.cc

Issue 1184523003: attachment broker wip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comments. Created 5 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « content/plugin/plugin_channel.h ('k') | content/plugin/plugin_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::SingleThreadTaskRunner* ipc_task_runner) { 143 int renderer_id,
144 base::SingleThreadTaskRunner* ipc_task_runner,
145 IPC::AttachmentBroker* broker) {
144 // Map renderer ID to a (single) channel to that process. 146 // Map renderer ID to a (single) channel to that process.
145 std::string channel_key = base::StringPrintf( 147 std::string channel_key = base::StringPrintf(
146 "%d.r%d", base::GetCurrentProcId(), renderer_id); 148 "%d.r%d", base::GetCurrentProcId(), renderer_id);
147 149
148 PluginChannel* channel = 150 PluginChannel* channel =
149 static_cast<PluginChannel*>(NPChannelBase::GetChannel( 151 static_cast<PluginChannel*>(NPChannelBase::GetChannel(
150 channel_key, 152 channel_key, IPC::Channel::MODE_SERVER, ClassFactory, ipc_task_runner,
151 IPC::Channel::MODE_SERVER, 153 false, ChildProcess::current()->GetShutDownEvent(), broker));
152 ClassFactory,
153 ipc_task_runner,
154 false,
155 ChildProcess::current()->GetShutDownEvent()));
156 154
157 if (channel) 155 if (channel)
158 channel->renderer_id_ = renderer_id; 156 channel->renderer_id_ = renderer_id;
159 157
160 return channel; 158 return channel;
161 } 159 }
162 160
163 // static 161 // static
164 void PluginChannel::NotifyRenderersOfPendingShutdown() { 162 void PluginChannel::NotifyRenderersOfPendingShutdown() {
165 Broadcast(new PluginHostMsg_PluginShuttingDown()); 163 Broadcast(new PluginHostMsg_PluginShuttingDown());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 while (!plugin_stubs_.empty()) { 219 while (!plugin_stubs_.empty()) {
222 // Separate vector::erase and ~WebPluginDelegateStub. 220 // Separate vector::erase and ~WebPluginDelegateStub.
223 // See https://code.google.com/p/chromium/issues/detail?id=314088 221 // See https://code.google.com/p/chromium/issues/detail?id=314088
224 scoped_refptr<WebPluginDelegateStub> stub = plugin_stubs_[0]; 222 scoped_refptr<WebPluginDelegateStub> stub = plugin_stubs_[0];
225 plugin_stubs_.erase(plugin_stubs_.begin()); 223 plugin_stubs_.erase(plugin_stubs_.begin());
226 } 224 }
227 } 225 }
228 226
229 bool PluginChannel::Init(base::SingleThreadTaskRunner* ipc_task_runner, 227 bool PluginChannel::Init(base::SingleThreadTaskRunner* ipc_task_runner,
230 bool create_pipe_now, 228 bool create_pipe_now,
231 base::WaitableEvent* shutdown_event) { 229 base::WaitableEvent* shutdown_event,
232 if (!NPChannelBase::Init(ipc_task_runner, create_pipe_now, shutdown_event)) 230 IPC::AttachmentBroker* broker) {
231 if (!NPChannelBase::Init(ipc_task_runner, create_pipe_now, shutdown_event,
232 broker)) {
233 return false; 233 return false;
234 }
234 235
235 channel_->AddFilter(filter_.get()); 236 channel_->AddFilter(filter_.get());
236 return true; 237 return true;
237 } 238 }
238 239
239 PluginChannel::PluginChannel() 240 PluginChannel::PluginChannel()
240 : renderer_id_(-1), 241 : renderer_id_(-1),
241 in_send_(0), 242 in_send_(0),
242 incognito_(false), 243 incognito_(false),
243 filter_(new MessageFilter()), 244 filter_(new MessageFilter()),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 void PluginChannel::OnDidAbortLoading(int render_view_id) { 339 void PluginChannel::OnDidAbortLoading(int render_view_id) {
339 for (size_t i = 0; i < plugin_stubs_.size(); ++i) { 340 for (size_t i = 0; i < plugin_stubs_.size(); ++i) {
340 if (plugin_stubs_[i]->webplugin()->host_render_view_routing_id() == 341 if (plugin_stubs_[i]->webplugin()->host_render_view_routing_id() ==
341 render_view_id) { 342 render_view_id) {
342 plugin_stubs_[i]->delegate()->instance()->CloseStreams(); 343 plugin_stubs_[i]->delegate()->instance()->CloseStreams();
343 } 344 }
344 } 345 }
345 } 346 }
346 347
347 } // namespace content 348 } // namespace content
OLDNEW
« no previous file with comments | « content/plugin/plugin_channel.h ('k') | content/plugin/plugin_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698