diff options
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.cc | 21 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.h | 3 | ||||
-rw-r--r-- | ppapi/proxy/plugin_main_nacl.cc | 21 |
3 files changed, 20 insertions, 25 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 1f8b0cb..e811e75 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -569,6 +569,16 @@ bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, if (!service_runtime_started) { return false; } + + // Try to start the Chrome IPC-based proxy. + if (nacl_interface_->StartPpapiProxy(pp_instance())) { + using_ipc_proxy_ = true; + // We need to explicitly schedule this here. It is normally called in + // response to starting the SRPC proxy. + CHECK(init_done_cb.pp_completion_callback().func != NULL); + PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon, started ipc proxy.\n")); + pp::Module::Get()->core()->CallOnMainThread(0, init_done_cb, PP_OK); + } return true; } @@ -591,16 +601,18 @@ bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, } bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) { + // If we are using the IPC proxy, StartSrpcServices and StartJSObjectProxy + // don't makes sense. Return 'true' so that the plugin continues loading. + if (using_ipc_proxy_) + return true; + if (!main_subprocess_.StartSrpcServices()) { error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL, "SRPC connection failure for " + main_subprocess_.description()); return false; } - // Try to start the Chrome IPC-based proxy first. If that fails, we - // must be using the SRPC proxy. - if (!nacl_interface_->StartPpapiProxy(pp_instance()) && - !main_subprocess_.StartJSObjectProxy(this, error_info)) { + if (!main_subprocess_.StartJSObjectProxy(this, error_info)) { return false; } PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n", @@ -826,6 +838,7 @@ Plugin::Plugin(PP_Instance pp_instance) ready_time_(0), nexe_size_(0), time_of_last_progress_event_(0), + using_ipc_proxy_(false), nacl_interface_(NULL) { PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" NACL_PRId32")\n", static_cast<void*>(this), pp_instance)); diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index be0d241..35bdb33 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -527,6 +527,9 @@ class Plugin : public pp::InstancePrivate { int64_t time_of_last_progress_event_; + // Whether we are using IPC-based PPAPI proxy. + bool using_ipc_proxy_; + const PPB_NaCl_Private* nacl_interface_; }; diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc index aba7be6..cbe06a7 100644 --- a/ppapi/proxy/plugin_main_nacl.cc +++ b/ppapi/proxy/plugin_main_nacl.cc @@ -18,7 +18,6 @@ #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" @@ -222,14 +221,6 @@ void PpapiPluginRegisterThreadCreator( } int IrtInit() { - static int initialized = 0; - if (initialized) { - return 0; - } - if (!NaClSrpcModuleInit()) { - return 1; - } - initialized = 1; return 0; } @@ -243,15 +234,6 @@ 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); @@ -262,9 +244,6 @@ int PpapiPluginMain() { PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy()); loop.Run(); - - NaClSrpcModuleFini(); - return 0; } |