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

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

Issue 10081018: Revert 132218 - Convert plugin and GPU process to brokered handle duplication. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/plugin/plugin_channel.h ('k') | content/plugin/webplugin_proxy.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_util.h" 9 #include "base/process_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 return channel; 155 return channel;
156 } 156 }
157 157
158 // static 158 // static
159 void PluginChannel::NotifyRenderersOfPendingShutdown() { 159 void PluginChannel::NotifyRenderersOfPendingShutdown() {
160 Broadcast(new PluginHostMsg_PluginShuttingDown()); 160 Broadcast(new PluginHostMsg_PluginShuttingDown());
161 } 161 }
162 162
163 PluginChannel::PluginChannel() 163 PluginChannel::PluginChannel()
164 : renderer_id_(-1), 164 : renderer_handle_(0),
165 renderer_id_(-1),
165 in_send_(0), 166 in_send_(0),
166 incognito_(false), 167 incognito_(false),
167 filter_(new MessageFilter()) { 168 filter_(new MessageFilter()) {
168 set_send_unblocking_only_during_unblock_dispatch(); 169 set_send_unblocking_only_during_unblock_dispatch();
169 ChildProcess::current()->AddRefProcess(); 170 ChildProcess::current()->AddRefProcess();
170 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 171 const CommandLine* command_line = CommandLine::ForCurrentProcess();
171 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 172 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
172 } 173 }
173 174
174 PluginChannel::~PluginChannel() { 175 PluginChannel::~PluginChannel() {
176 if (renderer_handle_)
177 base::CloseProcessHandle(renderer_handle_);
178
175 MessageLoop::current()->PostDelayedTask( 179 MessageLoop::current()->PostDelayedTask(
176 FROM_HERE, 180 FROM_HERE,
177 base::Bind(&PluginReleaseCallback), 181 base::Bind(&PluginReleaseCallback),
178 base::TimeDelta::FromMinutes(kPluginReleaseTimeMinutes)); 182 base::TimeDelta::FromMinutes(kPluginReleaseTimeMinutes));
179 } 183 }
180 184
181 bool PluginChannel::Send(IPC::Message* msg) { 185 bool PluginChannel::Send(IPC::Message* msg) {
182 in_send_++; 186 in_send_++;
183 if (log_messages_) { 187 if (log_messages_) {
184 VLOG(1) << "sending message @" << msg << " on channel @" << this 188 VLOG(1) << "sending message @" << msg << " on channel @" << this
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 278 }
275 } 279 }
276 Send(new PluginHostMsg_ClearSiteDataResult(success)); 280 Send(new PluginHostMsg_ClearSiteDataResult(success));
277 } 281 }
278 282
279 base::WaitableEvent* PluginChannel::GetModalDialogEvent( 283 base::WaitableEvent* PluginChannel::GetModalDialogEvent(
280 gfx::NativeViewId containing_window) { 284 gfx::NativeViewId containing_window) {
281 return filter_->GetModalDialogEvent(containing_window); 285 return filter_->GetModalDialogEvent(containing_window);
282 } 286 }
283 287
288 void PluginChannel::OnChannelConnected(int32 peer_pid) {
289 base::ProcessHandle handle;
290 if (!base::OpenProcessHandle(peer_pid, &handle)) {
291 NOTREACHED();
292 }
293 renderer_handle_ = handle;
294 NPChannelBase::OnChannelConnected(peer_pid);
295 }
296
284 void PluginChannel::OnChannelError() { 297 void PluginChannel::OnChannelError() {
298 base::CloseProcessHandle(renderer_handle_);
299 renderer_handle_ = 0;
285 NPChannelBase::OnChannelError(); 300 NPChannelBase::OnChannelError();
286 CleanUp(); 301 CleanUp();
287 } 302 }
288 303
289 void PluginChannel::CleanUp() { 304 void PluginChannel::CleanUp() {
290 // We need to clean up the stubs so that they call NPPDestroy. This will 305 // We need to clean up the stubs so that they call NPPDestroy. This will
291 // also lead to them releasing their reference on this object so that it can 306 // also lead to them releasing their reference on this object so that it can
292 // be deleted. 307 // be deleted.
293 for (size_t i = 0; i < plugin_stubs_.size(); ++i) 308 for (size_t i = 0; i < plugin_stubs_.size(); ++i)
294 RemoveRoute(plugin_stubs_[i]->instance_id()); 309 RemoveRoute(plugin_stubs_[i]->instance_id());
(...skipping 10 matching lines...) Expand all
305 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop, 320 bool PluginChannel::Init(base::MessageLoopProxy* ipc_message_loop,
306 bool create_pipe_now, 321 bool create_pipe_now,
307 base::WaitableEvent* shutdown_event) { 322 base::WaitableEvent* shutdown_event) {
308 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event)) 323 if (!NPChannelBase::Init(ipc_message_loop, create_pipe_now, shutdown_event))
309 return false; 324 return false;
310 325
311 channel_->AddFilter(filter_.get()); 326 channel_->AddFilter(filter_.get());
312 return true; 327 return true;
313 } 328 }
314 329
OLDNEW
« no previous file with comments | « content/plugin/plugin_channel.h ('k') | content/plugin/webplugin_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698