From f0ecb550248afddff9a28c8bf645e689f59a6e3e Mon Sep 17 00:00:00 2001 From: "jschuh@chromium.org" Date: Fri, 11 May 2012 22:09:11 +0000 Subject: Broker out PPAPI handle duplication BUG=127449 Review URL: https://chromiumcodereview.appspot.com/10378057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136686 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/plugin_data_remover_impl.cc | 1 - content/browser/plugin_service_impl.cc | 6 ++--- content/browser/ppapi_plugin_process_host.cc | 30 ++++------------------ content/browser/ppapi_plugin_process_host.h | 3 +-- .../browser/renderer_host/render_message_filter.cc | 9 +++---- 5 files changed, 11 insertions(+), 38 deletions(-) (limited to 'content/browser') diff --git a/content/browser/plugin_data_remover_impl.cc b/content/browser/plugin_data_remover_impl.cc index be082c1..d84f0d3 100644 --- a/content/browser/plugin_data_remover_impl.cc +++ b/content/browser/plugin_data_remover_impl.cc @@ -163,7 +163,6 @@ class PluginDataRemoverImpl::Context } virtual void OnPpapiChannelOpened( - base::ProcessHandle /* plugin_process_handle */, const IPC::ChannelHandle& channel_handle, int /* child_id */) OVERRIDE { if (!channel_handle.name.empty()) diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index e239126..e7dfead 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -344,8 +344,7 @@ void PluginServiceImpl::OpenChannelToPpapiPlugin( plugin_host->OpenChannelToPlugin(client); } else { // Send error. - client->OnPpapiChannelOpened(base::kNullProcessHandle, - IPC::ChannelHandle(), 0); + client->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); } } @@ -357,8 +356,7 @@ void PluginServiceImpl::OpenChannelToPpapiBroker( plugin_host->OpenChannelToPlugin(client); } else { // Send error. - client->OnPpapiChannelOpened(base::kNullProcessHandle, - IPC::ChannelHandle(), 0); + client->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); } } diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index 48d019f..d774718 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -207,13 +207,12 @@ void PpapiPluginProcessHost::RequestPluginChannel(Client* client) { // We can't send any sync messages from the browser because it might lead to // a hang. See the similar code in PluginProcessHost for more description. PpapiMsg_CreateChannel* msg = new PpapiMsg_CreateChannel( - process_handle, renderer_id, client->OffTheRecord()); + renderer_id, client->OffTheRecord()); msg->set_unblock(true); if (Send(msg)) { sent_requests_.push(client); } else { - client->OnPpapiChannelOpened(base::kNullProcessHandle, - IPC::ChannelHandle(), 0); + client->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); } } @@ -260,14 +259,12 @@ void PpapiPluginProcessHost::CancelRequests() { DVLOG(1) << "PpapiPluginProcessHost" << (is_broker_ ? "[broker]" : "") << "CancelRequests()"; for (size_t i = 0; i < pending_requests_.size(); i++) { - pending_requests_[i]->OnPpapiChannelOpened(base::kNullProcessHandle, - IPC::ChannelHandle(), 0); + pending_requests_[i]->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); } pending_requests_.clear(); while (!sent_requests_.empty()) { - sent_requests_.front()->OnPpapiChannelOpened(base::kNullProcessHandle, - IPC::ChannelHandle(), 0); + sent_requests_.front()->OnPpapiChannelOpened(IPC::ChannelHandle(), 0); sent_requests_.pop(); } } @@ -283,22 +280,5 @@ void PpapiPluginProcessHost::OnRendererPluginChannelCreated( Client* client = sent_requests_.front(); sent_requests_.pop(); - // Prepare the handle to send to the renderer. - base::ProcessHandle plugin_process = process_->GetHandle(); -#if defined(OS_WIN) - base::ProcessHandle renderer_process; - int renderer_id; - client->GetPpapiChannelInfo(&renderer_process, &renderer_id); - - base::ProcessHandle renderers_plugin_handle = NULL; - ::DuplicateHandle(::GetCurrentProcess(), plugin_process, - renderer_process, &renderers_plugin_handle, - 0, FALSE, DUPLICATE_SAME_ACCESS); -#elif defined(OS_POSIX) - // Don't need to duplicate anything on POSIX since it's just a PID. - base::ProcessHandle renderers_plugin_handle = plugin_process; -#endif - - client->OnPpapiChannelOpened(renderers_plugin_handle, channel_handle, - process_->GetData().id); + client->OnPpapiChannelOpened(channel_handle, process_->GetData().id); } diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h index 6054a0d..deef50f 100644 --- a/content/browser/ppapi_plugin_process_host.h +++ b/content/browser/ppapi_plugin_process_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -45,7 +45,6 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, // IPC::ChannelHandle(), // 0 virtual void OnPpapiChannelOpened( - base::ProcessHandle plugin_process_handle, const IPC::ChannelHandle& channel_handle, int plugin_child_id) = 0; diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 248e563..e704ec62 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -130,11 +130,10 @@ class OpenChannelToPpapiPluginCallback *renderer_id = filter()->render_process_id(); } - virtual void OnPpapiChannelOpened(base::ProcessHandle plugin_process_handle, - const IPC::ChannelHandle& channel_handle, + virtual void OnPpapiChannelOpened(const IPC::ChannelHandle& channel_handle, int plugin_child_id) { ViewHostMsg_OpenChannelToPepperPlugin::WriteReplyParams( - reply_msg(), plugin_process_handle, channel_handle, plugin_child_id); + reply_msg(), channel_handle, plugin_child_id); SendReplyAndDeleteThis(); } @@ -169,12 +168,10 @@ class OpenChannelToPpapiBrokerCallback *renderer_id = filter_->render_process_id(); } - virtual void OnPpapiChannelOpened(base::ProcessHandle broker_process_handle, - const IPC::ChannelHandle& channel_handle, + virtual void OnPpapiChannelOpened(const IPC::ChannelHandle& channel_handle, int /* plugin_child_id */) { filter_->Send(new ViewMsg_PpapiBrokerChannelCreated(routing_id_, request_id_, - broker_process_handle, channel_handle)); delete this; } -- cgit v1.1