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

Unified Diff: chrome/renderer/render_process_impl.cc

Issue 2832093: NaCl: Allow setting up multiple sockets for subprocess instead of just one (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Whitespace fixes Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« chrome/common/nacl_messages_internal.h ('K') | « chrome/nacl/nacl_thread.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_process_impl.cc
diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc
index 0085ae76437c118f8c2bce951d078a4b246629e3..e971e68c82ecb525e22d3fd6c10092bde8982142 100644
--- a/chrome/renderer/render_process_impl.cc
+++ b/chrome/renderer/render_process_impl.cc
@@ -50,17 +50,45 @@ bool LaunchNaClProcess(const char* url,
int* nacl_process_id) {
// TODO(gregoryd): nacl::FileDescriptor will be soon merged with
// base::FileDescriptor
- nacl::FileDescriptor imc_descriptor;
+ std::vector<nacl::FileDescriptor> sockets;
base::ProcessHandle nacl_process;
if (!RenderThread::current()->Send(
- new ViewHostMsg_LaunchNaCl(ASCIIToWide(url),
- imc_fd,
- &imc_descriptor,
+ new ViewHostMsg_LaunchNaCl(
+ ASCIIToWide(url),
+ /* socket_count= */ 1,
+ &sockets,
&nacl_process,
reinterpret_cast<base::ProcessId*>(nacl_process_id)))) {
return false;
}
- *imc_handle = nacl::ToNativeHandle(imc_descriptor);
+ CHECK(static_cast<int>(sockets.size()) == 1);
+ *imc_handle = nacl::ToNativeHandle(sockets[0]);
+ *nacl_process_handle = nacl_process;
+ return true;
+}
+
+bool LaunchNaClProcessMultiFD(const char* alleged_url,
+ int socket_count,
+ nacl::Handle* imc_handles,
+ nacl::Handle* nacl_process_handle,
+ int* nacl_process_id) {
+ // TODO(gregoryd): nacl::FileDescriptor will be soon merged with
+ // base::FileDescriptor
+ std::vector<nacl::FileDescriptor> sockets;
+ base::ProcessHandle nacl_process;
+ if (!RenderThread::current()->Send(
+ new ViewHostMsg_LaunchNaCl(
+ ASCIIToWide(alleged_url),
+ socket_count,
+ &sockets,
+ &nacl_process,
+ reinterpret_cast<base::ProcessId*>(nacl_process_id)))) {
+ return false;
+ }
+ CHECK(static_cast<int>(sockets.size()) == socket_count);
+ for (int i = 0; i < socket_count; i++) {
+ imc_handles[i] = nacl::ToNativeHandle(sockets[i]);
+ }
*nacl_process_handle = nacl_process;
return true;
}
@@ -158,6 +186,8 @@ RenderProcessImpl::RenderProcessImpl()
std::map<std::string, uintptr_t> funcs;
funcs["launch_nacl_process"] =
reinterpret_cast<uintptr_t>(LaunchNaClProcess);
+ funcs["launch_nacl_process_multi_fd"] =
+ reinterpret_cast<uintptr_t>(LaunchNaClProcessMultiFD);
RegisterInternalNaClPlugin(funcs);
}
#endif
« chrome/common/nacl_messages_internal.h ('K') | « chrome/nacl/nacl_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698