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

Unified Diff: ppapi/proxy/plugin_main_nacl.cc

Issue 10905310: Start IPC-based NaCl PPAPI proxy after all untrusted code has loaded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/plugin_main_nacl.cc
===================================================================
--- ppapi/proxy/plugin_main_nacl.cc (revision 157181)
+++ ppapi/proxy/plugin_main_nacl.cc (working copy)
@@ -18,6 +18,7 @@
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message.h"
#include "native_client/src/shared/ppapi_proxy/ppruntime.h"
+#include "native_client/src/shared/srpc/nacl_srpc.h"
#include "native_client/src/untrusted/irt/irt_ppapi.h"
#include "ppapi/c/ppp.h"
#include "ppapi/c/ppp_instance.h"
@@ -221,6 +222,14 @@
}
int IrtInit() {
+ static int initialized = 0;
+ if (initialized) {
+ return 0;
+ }
+ if (!NaClSrpcModuleInit()) {
+ return 1;
+ }
+ initialized = 1;
return 0;
}
@@ -234,6 +243,15 @@
options.message_loop_type = MessageLoop::TYPE_IO;
io_thread.StartWithOptions(options);
+ // Start up the SRPC server on another thread. Otherwise, when it blocks
+ // on an RPC, the PPAPI proxy will hang. Do this before we initialize the
+ // module and start the PPAPI proxy so that the NaCl plugin can continue
+ // loading the app.
+ static struct NaClSrpcHandlerDesc srpc_methods[] = { { NULL, NULL } };
+ if (!NaClSrpcAcceptClientOnThread(srpc_methods)) {
+ return 1;
+ }
+
int32_t error = ::PPP_InitializeModule(
0 /* module */,
&ppapi::proxy::PluginDispatcher::GetBrowserInterface);
@@ -244,6 +262,9 @@
PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy());
loop.Run();
+
+ NaClSrpcModuleFini();
+
return 0;
}
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698