diff options
Diffstat (limited to 'content/renderer')
9 files changed, 27 insertions, 28 deletions
diff --git a/content/renderer/pepper/pepper_broker_impl.cc b/content/renderer/pepper/pepper_broker_impl.cc index 94b88a4..1885b8e 100644 --- a/content/renderer/pepper/pepper_broker_impl.cc +++ b/content/renderer/pepper/pepper_broker_impl.cc @@ -55,7 +55,6 @@ PepperBrokerDispatcherWrapper::~PepperBrokerDispatcherWrapper() { } bool PepperBrokerDispatcherWrapper::Init( - base::ProcessHandle broker_process_handle, const IPC::ChannelHandle& channel_handle) { if (channel_handle.name.empty()) return false; @@ -68,7 +67,7 @@ bool PepperBrokerDispatcherWrapper::Init( dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); dispatcher_.reset( - new ppapi::proxy::BrokerHostDispatcher(broker_process_handle)); + new ppapi::proxy::BrokerHostDispatcher()); if (!dispatcher_->InitBrokerWithChannel(dispatcher_delegate_.get(), channel_handle, @@ -191,11 +190,10 @@ void PepperBrokerImpl::Disconnect(webkit::ppapi::PPB_Broker_Impl* client) { } void PepperBrokerImpl::OnBrokerChannelConnected( - base::ProcessHandle broker_process_handle, const IPC::ChannelHandle& channel_handle) { scoped_ptr<PepperBrokerDispatcherWrapper> dispatcher( new PepperBrokerDispatcherWrapper); - if (dispatcher->Init(broker_process_handle, channel_handle)) { + if (dispatcher->Init(channel_handle)) { dispatcher_.reset(dispatcher.release()); // Process all pending channel requests from the plugins. diff --git a/content/renderer/pepper/pepper_broker_impl.h b/content/renderer/pepper/pepper_broker_impl.h index cbed850..091000e 100644 --- a/content/renderer/pepper/pepper_broker_impl.h +++ b/content/renderer/pepper/pepper_broker_impl.h @@ -37,8 +37,7 @@ class CONTENT_EXPORT PepperBrokerDispatcherWrapper { PepperBrokerDispatcherWrapper(); ~PepperBrokerDispatcherWrapper(); - bool Init(base::ProcessHandle plugin_process_handle, - const IPC::ChannelHandle& channel_handle); + bool Init(const IPC::ChannelHandle& channel_handle); int32_t SendHandleToBroker(PP_Instance instance, base::SyncSocket::Handle handle); @@ -59,8 +58,7 @@ class PepperBrokerImpl : public webkit::ppapi::PluginDelegate::Broker, virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; // Called when the channel to the broker has been established. - void OnBrokerChannelConnected(base::ProcessHandle broker_process_handle, - const IPC::ChannelHandle& channel_handle); + void OnBrokerChannelConnected(const IPC::ChannelHandle& channel_handle); // Connects the plugin to the broker via a pipe. void ConnectPluginToBroker(webkit::ppapi::PPB_Broker_Impl* client); diff --git a/content/renderer/pepper/pepper_broker_impl_unittest.cc b/content/renderer/pepper/pepper_broker_impl_unittest.cc index b3148cc..4a909a1 100644 --- a/content/renderer/pepper/pepper_broker_impl_unittest.cc +++ b/content/renderer/pepper/pepper_broker_impl_unittest.cc @@ -25,21 +25,19 @@ class PepperBrokerImplTest : public ::testing::Test { // Initialization should fail. TEST_F(PepperBrokerImplTest, InitFailure) { PepperBrokerDispatcherWrapper dispatcher_wrapper; - base::ProcessHandle broker_process_handle = base::kNullProcessHandle; IPC::ChannelHandle invalid_channel; // Invalid by default. // An invalid handle should result in a failure (false) without a LOG(FATAL), // such as the one in CreatePipe(). Call it twice because without the invalid // handle check, the posix code would hit a one-time path due to a static // variable and go through the LOG(FATAL) path. - EXPECT_FALSE(dispatcher_wrapper.Init(broker_process_handle, invalid_channel)); - EXPECT_FALSE(dispatcher_wrapper.Init(broker_process_handle, invalid_channel)); + EXPECT_FALSE(dispatcher_wrapper.Init(invalid_channel)); + EXPECT_FALSE(dispatcher_wrapper.Init(invalid_channel)); } // On valid ChannelHandle, initialization should succeed. TEST_F(PepperBrokerImplTest, InitSuccess) { PepperBrokerDispatcherWrapper dispatcher_wrapper; - base::ProcessHandle broker_process_handle = base::kNullProcessHandle; const char kChannelName[] = "PepperPluginDelegateImplTestChannelName"; #if defined(OS_POSIX) int fds[2] = {-1, -1}; @@ -52,7 +50,7 @@ TEST_F(PepperBrokerImplTest, InitSuccess) { IPC::ChannelHandle valid_channel(kChannelName); #endif // defined(OS_POSIX)); - EXPECT_TRUE(dispatcher_wrapper.Init(broker_process_handle, valid_channel)); + EXPECT_TRUE(dispatcher_wrapper.Init(valid_channel)); #if defined(OS_POSIX) EXPECT_EQ(0, ::close(fds[0])); diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index 5803ffb..c6bad77 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -102,8 +102,7 @@ class HostDispatcherWrapper HostDispatcherWrapper() {} virtual ~HostDispatcherWrapper() {} - bool Init(base::ProcessHandle plugin_process_handle, - const IPC::ChannelHandle& channel_handle, + bool Init(const IPC::ChannelHandle& channel_handle, PP_Module pp_module, PP_GetInterface_Func local_get_interface, const ppapi::Preferences& preferences, @@ -119,7 +118,7 @@ class HostDispatcherWrapper dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl); dispatcher_.reset(new ppapi::proxy::HostDispatcher( - plugin_process_handle, pp_module, local_get_interface, filter)); + pp_module, local_get_interface, filter)); if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), channel_handle, @@ -234,11 +233,10 @@ PepperPluginDelegateImpl::CreatePepperPluginModule( } // Out of process: have the browser start the plugin process for us. - base::ProcessHandle plugin_process_handle = base::kNullProcessHandle; IPC::ChannelHandle channel_handle; int plugin_child_id = 0; render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin( - path, &plugin_process_handle, &channel_handle, &plugin_child_id)); + path, &channel_handle, &plugin_child_id)); if (channel_handle.name.empty()) { // Couldn't be initialized. return scoped_refptr<webkit::ppapi::PluginModule>(); @@ -256,7 +254,6 @@ PepperPluginDelegateImpl::CreatePepperPluginModule( PepperPluginRegistry::GetInstance()->AddLiveModule(path, module); scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper); if (!dispatcher->Init( - plugin_process_handle, channel_handle, module->pp_module(), webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), @@ -296,21 +293,20 @@ scoped_refptr<PepperBrokerImpl> PepperPluginDelegateImpl::CreateBroker( void PepperPluginDelegateImpl::OnPpapiBrokerChannelCreated( int request_id, - base::ProcessHandle broker_process_handle, const IPC::ChannelHandle& handle) { scoped_refptr<PepperBrokerImpl>* broker_ptr = pending_connect_broker_.Lookup(request_id); if (broker_ptr) { scoped_refptr<PepperBrokerImpl> broker = *broker_ptr; pending_connect_broker_.Remove(request_id); - broker->OnBrokerChannelConnected(broker_process_handle, handle); + broker->OnBrokerChannelConnected(handle); } else { // There is no broker waiting for this channel. Close it so the broker can // clean up and possibly exit. // The easiest way to clean it up is to just put it in an object // and then close them. This failure case is not performance critical. PepperBrokerDispatcherWrapper temp_dispatcher; - temp_dispatcher.Init(broker_process_handle, handle); + temp_dispatcher.Init(handle); } } @@ -837,8 +833,7 @@ class AsyncOpenFileSystemURLCallbackTranslator } virtual void DidOpenFile( - base::PlatformFile file, - base::ProcessHandle unused) { + base::PlatformFile file) { callback_.Run(base::PLATFORM_FILE_OK, base::PassPlatformFile(&file)); // Make sure we won't leak file handle if the requester has died. if (file != base::kInvalidPlatformFileValue) { diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index a7ce753..1d94723 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -119,7 +119,6 @@ class PepperPluginDelegateImpl // Called by RenderView when ViewMsg_PpapiBrokerChannelCreated. void OnPpapiBrokerChannelCreated(int request_id, - base::ProcessHandle broker_process_handle, const IPC::ChannelHandle& handle); // Removes broker from pending_connect_broker_ if present. Returns true if so. diff --git a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc index 3fef0dd..e9af62c 100644 --- a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc +++ b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.cc @@ -5,6 +5,7 @@ #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" #include "content/common/child_process.h" +#include "content/public/common/sandbox_init.h" namespace content { @@ -22,4 +23,13 @@ base::WaitableEvent* PepperProxyChannelDelegateImpl::GetShutdownEvent() { return ChildProcess::current()->GetShutDownEvent(); } +IPC::PlatformFileForTransit +PepperProxyChannelDelegateImpl::ShareHandleWithRemote( + base::PlatformFile handle, + const IPC::SyncChannel& channel, + bool should_close_source) { + return content::BrokerGetFileHandleForProcess(handle, channel.peer_pid(), + should_close_source); +} + } // namespace content diff --git a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h index 94636a6..243047b 100644 --- a/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h +++ b/content/renderer/pepper/pepper_proxy_channel_delegate_impl.h @@ -18,6 +18,10 @@ class PepperProxyChannelDelegateImpl // ProxyChannel::Delegate implementation. virtual base::MessageLoopProxy* GetIPCMessageLoop() OVERRIDE; virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE; + virtual IPC::PlatformFileForTransit ShareHandleWithRemote( + base::PlatformFile handle, + const IPC::SyncChannel& channel, + bool should_close_source) OVERRIDE; }; } // namespace content diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 821fe0b..67217f3 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -5269,10 +5269,8 @@ void RenderViewImpl::OnAsyncFileOpened( void RenderViewImpl::OnPpapiBrokerChannelCreated( int request_id, - base::ProcessHandle broker_process_handle, const IPC::ChannelHandle& handle) { pepper_delegate_.OnPpapiBrokerChannelCreated(request_id, - broker_process_handle, handle); } diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index 8e5522a..470aefe 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -809,7 +809,6 @@ class RenderViewImpl : public RenderWidget, IPC::PlatformFileForTransit file_for_transit, int message_id); void OnPpapiBrokerChannelCreated(int request_id, - base::ProcessHandle broker_process_handle, const IPC::ChannelHandle& handle); void OnCancelDownload(int32 download_id); void OnClearFocusedNode(); |