diff options
author | gregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 17:42:32 +0000 |
---|---|---|
committer | gregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 17:42:32 +0000 |
commit | 2461cf0a67fec9bf61c5c80ca64a9a234c0d0e8d (patch) | |
tree | 9c8c5cce5d316c41019ba7f7c6fcccc43d272862 | |
parent | 0ba99697453983e547ea145251b802daf0fbca90 (diff) | |
download | chromium_src-2461cf0a67fec9bf61c5c80ca64a9a234c0d0e8d.zip chromium_src-2461cf0a67fec9bf61c5c80ca64a9a234c0d0e8d.tar.gz chromium_src-2461cf0a67fec9bf61c5c80ca64a9a234c0d0e8d.tar.bz2 |
Add support for IMC handle passing in Chrome sandbox
Review URL: http://codereview.chromium.org/292056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29782 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/nacl_process_host.cc | 11 | ||||
-rw-r--r-- | chrome/browser/nacl_process_host.h | 4 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.cc | 4 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 4 | ||||
-rw-r--r-- | chrome/renderer/render_process.cc | 12 |
6 files changed, 20 insertions, 19 deletions
diff --git a/chrome/browser/nacl_process_host.cc b/chrome/browser/nacl_process_host.cc index 9d7f445..dcd3401 100644 --- a/chrome/browser/nacl_process_host.cc +++ b/chrome/browser/nacl_process_host.cc @@ -41,8 +41,8 @@ NaClProcessHost::NaClProcessHost( bool NaClProcessHost::Launch(ResourceMessageFilter* renderer_msg_filter, const int descriptor, nacl::FileDescriptor* imc_handle, - nacl::FileDescriptor* nacl_process_handle, - int* nacl_process_id) { + base::ProcessHandle* nacl_process_handle, + base::ProcessId* nacl_process_id) { #ifdef DISABLE_NACL NOTIMPLEMENTED() << "Native Client disabled at build time"; return false; @@ -51,7 +51,7 @@ bool NaClProcessHost::Launch(ResourceMessageFilter* renderer_msg_filter, bool success = false; NATIVE_HANDLE(*imc_handle) = nacl::kInvalidHandle; - NATIVE_HANDLE(*nacl_process_handle) = nacl::kInvalidHandle; + *nacl_process_handle = nacl::kInvalidHandle; *nacl_process_id = 0; // Create a connected socket @@ -97,8 +97,9 @@ bool NaClProcessHost::Launch(ResourceMessageFilter* renderer_msg_filter, imc_handle->fd = pair[0]; imc_handle->auto_close = true; - // Process handles are used on Windows only - NATIVE_HANDLE(*nacl_process_handle) = nacl::kInvalidHandle; + // We use pid as process handle on Posix + *nacl_process_handle = handle(); + #endif // Get the pid of the NaCl process diff --git a/chrome/browser/nacl_process_host.h b/chrome/browser/nacl_process_host.h index 6d549cf..eb38631 100644 --- a/chrome/browser/nacl_process_host.h +++ b/chrome/browser/nacl_process_host.h @@ -28,8 +28,8 @@ class NaClProcessHost : public ChildProcessHost { bool Launch(ResourceMessageFilter* renderer_msg_filter, const int descriptor, nacl::FileDescriptor* handle, - nacl::FileDescriptor* nacl_process_handle, - int* nacl_process_id); + base::ProcessHandle* nacl_process_handle, + base::ProcessId* nacl_process_id); virtual void OnMessageReceived(const IPC::Message& msg); diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 5d2efab..6818a90 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -606,8 +606,8 @@ void ResourceMessageFilter::OnOpenChannelToPlugin(const GURL& url, void ResourceMessageFilter::OnLaunchNaCl(const std::wstring& url, int channel_descriptor, nacl::FileDescriptor* imc_handle, - nacl::FileDescriptor* nacl_process_handle, - int* nacl_process_id) { + base::ProcessHandle* nacl_process_handle, + base::ProcessId* nacl_process_id) { NaClProcessHost* nacl_host = new NaClProcessHost(resource_dispatcher_host_, url); nacl_host->Launch(this, diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 02c934f..95df005 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -156,8 +156,8 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, void OnLaunchNaCl(const std::wstring& url, int channel_descriptor, nacl::FileDescriptor* handle, - nacl::FileDescriptor* nacl_process_handle, - int* nacl_process_id); + base::ProcessHandle* nacl_process_handle, + base::ProcessId* nacl_process_id); void OnCreateDedicatedWorker(const GURL& url, int render_view_route_id, int* route_id); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index a4dbf29..40736b4 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1175,8 +1175,8 @@ IPC_BEGIN_MESSAGES(ViewHost) std::wstring /* url for the NaCl module */, int /* channel number */, nacl::FileDescriptor /* imc channel handle */, - nacl::FileDescriptor /* NaCl process handle */, - int /* NaCl process id */) + base::ProcessHandle /* NaCl process handle */, + base::ProcessId /* NaCl process id */) #if defined(OS_LINUX) // A renderer sends this when it needs a browser-side widget for diff --git a/chrome/renderer/render_process.cc b/chrome/renderer/render_process.cc index 78bd935..229187d 100644 --- a/chrome/renderer/render_process.cc +++ b/chrome/renderer/render_process.cc @@ -142,17 +142,17 @@ bool RenderProcess::LaunchNaClProcess(const char* url, // TODO(gregoryd): nacl::FileDescriptor will be soon merged with // base::FileDescriptor nacl::FileDescriptor imc_descriptor; - nacl::FileDescriptor nacl_process_descriptor; + base::ProcessHandle nacl_process; if (!RenderThread::current()->Send( new ViewHostMsg_LaunchNaCl(ASCIIToWide(url), - imc_fd, - &imc_descriptor, - &nacl_process_descriptor, - nacl_process_id))) { + imc_fd, + &imc_descriptor, + &nacl_process, + reinterpret_cast<base::ProcessId*>(nacl_process_id)))) { return false; } *imc_handle = NATIVE_HANDLE(imc_descriptor); - *nacl_process_handle = NATIVE_HANDLE(nacl_process_descriptor); + *nacl_process_handle = nacl_process; return true; } |