summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-17 22:07:51 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-17 22:07:51 +0000
commit6041fad5ae36cea7f826e86c777a8f955bc9c4c7 (patch)
treedd5a788a53bfc658e1c185eebfec6353011d7d7f /ppapi/proxy
parentf23f82d6f6562a658fe85b1257c5842d1f40012b (diff)
downloadchromium_src-6041fad5ae36cea7f826e86c777a8f955bc9c4c7.zip
chromium_src-6041fad5ae36cea7f826e86c777a8f955bc9c4c7.tar.gz
chromium_src-6041fad5ae36cea7f826e86c777a8f955bc9c4c7.tar.bz2
Start IPC-based NaCl PPAPI proxy after all untrusted code has loaded.
This delays the IPC proxy startup to happen at the same time as the SRPC proxy, so that dynamically loaded apps work. The IRT startup is also changed to start SRPC correctly. With this change, glibc examples work. BUG=116317 TEST=manual Review URL: https://codereview.chromium.org/10905310 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/plugin_main_nacl.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index cbe06a7..aba7be6 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -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 @@ void PpapiPluginRegisterThreadCreator(
}
int IrtInit() {
+ static int initialized = 0;
+ if (initialized) {
+ return 0;
+ }
+ if (!NaClSrpcModuleInit()) {
+ return 1;
+ }
+ initialized = 1;
return 0;
}
@@ -234,6 +243,15 @@ int PpapiPluginMain() {
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 @@ int PpapiPluginMain() {
PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy());
loop.Run();
+
+ NaClSrpcModuleFini();
+
return 0;
}