summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/nacl/renderer/ppb_nacl_private_impl.cc48
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl21
-rw-r--r--ppapi/c/private/ppb_nacl_private.h23
-rw-r--r--ppapi/native_client/src/trusted/plugin/nacl_entry_points.h4
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc46
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h13
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc44
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h7
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc54
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.h14
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c6
11 files changed, 169 insertions, 111 deletions
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 5fd2f38..a9d909a 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -79,16 +79,17 @@ static int GetRoutingID(PP_Instance instance) {
}
// Launch NaCl's sel_ldr process.
-PP_ExternalPluginResult LaunchSelLdr(PP_Instance instance,
- const char* alleged_url,
- PP_Bool uses_irt,
- PP_Bool uses_ppapi,
- PP_Bool enable_ppapi_dev,
- PP_Bool enable_dyncode_syscalls,
- PP_Bool enable_exception_handling,
- PP_Bool enable_crash_throttling,
- void* imc_handle,
- struct PP_Var* error_message) {
+void LaunchSelLdr(PP_Instance instance,
+ const char* alleged_url,
+ PP_Bool uses_irt,
+ PP_Bool uses_ppapi,
+ PP_Bool enable_ppapi_dev,
+ PP_Bool enable_dyncode_syscalls,
+ PP_Bool enable_exception_handling,
+ PP_Bool enable_crash_throttling,
+ void* imc_handle,
+ struct PP_Var* error_message,
+ PP_CompletionCallback callback) {
nacl::FileDescriptor result_socket;
IPC::Sender* sender = content::RenderThread::Get();
DCHECK(sender);
@@ -100,8 +101,13 @@ PP_ExternalPluginResult LaunchSelLdr(PP_Instance instance,
// so those nexes can skip finding a routing_id.
if (uses_ppapi) {
routing_id = GetRoutingID(instance);
- if (!routing_id)
- return PP_EXTERNAL_PLUGIN_FAILED;
+ if (!routing_id) {
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
+ FROM_HERE,
+ base::Bind(callback.func, callback.user_data,
+ static_cast<int32_t>(PP_ERROR_FAILED)));
+ return;
+ }
}
InstanceInfo instance_info;
@@ -128,11 +134,19 @@ PP_ExternalPluginResult LaunchSelLdr(PP_Instance instance,
PP_ToBool(enable_crash_throttling)),
&launch_result,
&error_message_string))) {
- return PP_EXTERNAL_PLUGIN_FAILED;
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
+ FROM_HERE,
+ base::Bind(callback.func, callback.user_data,
+ static_cast<int32_t>(PP_ERROR_FAILED)));
+ return;
}
if (!error_message_string.empty()) {
*error_message = ppapi::StringVar::StringToPPVar(error_message_string);
- return PP_EXTERNAL_PLUGIN_FAILED;
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
+ FROM_HERE,
+ base::Bind(callback.func, callback.user_data,
+ static_cast<int32_t>(PP_ERROR_FAILED)));
+ return;
}
result_socket = launch_result.imc_channel_handle;
instance_info.channel_handle = launch_result.ipc_channel_handle;
@@ -149,8 +163,10 @@ PP_ExternalPluginResult LaunchSelLdr(PP_Instance instance,
*(static_cast<NaClHandle*>(imc_handle)) =
nacl::ToNativeHandle(result_socket);
-
- return PP_EXTERNAL_PLUGIN_OK;
+ ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask(
+ FROM_HERE,
+ base::Bind(callback.func, callback.user_data,
+ static_cast<int32_t>(PP_OK)));
}
PP_ExternalPluginResult StartPpapiProxy(PP_Instance instance) {
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index c8ef073..6dfbff7 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -54,16 +54,17 @@ interface PPB_NaCl_Private {
* the nexe contribute to crash throttling statisics and whether nexe starts
* are throttled by crash throttling.
*/
- PP_ExternalPluginResult LaunchSelLdr([in] PP_Instance instance,
- [in] str_t alleged_url,
- [in] PP_Bool uses_irt,
- [in] PP_Bool uses_ppapi,
- [in] PP_Bool enable_ppapi_dev,
- [in] PP_Bool enable_dyncode_syscalls,
- [in] PP_Bool enable_exception_handling,
- [in] PP_Bool enable_crash_throttling,
- [out] mem_t imc_handle,
- [out] PP_Var error_message);
+ void LaunchSelLdr([in] PP_Instance instance,
+ [in] str_t alleged_url,
+ [in] PP_Bool uses_irt,
+ [in] PP_Bool uses_ppapi,
+ [in] PP_Bool enable_ppapi_dev,
+ [in] PP_Bool enable_dyncode_syscalls,
+ [in] PP_Bool enable_exception_handling,
+ [in] PP_Bool enable_crash_throttling,
+ [out] mem_t imc_handle,
+ [out] PP_Var error_message,
+ [in] PP_CompletionCallback callback);
/* This function starts the IPC proxy so the nexe can communicate with the
* browser. Returns PP_EXTERNAL_PLUGIN_OK on success, otherwise a result code
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 0e98eed..0001148 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Fri Feb 7 16:10:35 2014. */
+/* From private/ppb_nacl_private.idl modified Mon Feb 10 11:05:29 2014. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -78,16 +78,17 @@ struct PPB_NaCl_Private_1_0 {
* the nexe contribute to crash throttling statisics and whether nexe starts
* are throttled by crash throttling.
*/
- PP_ExternalPluginResult (*LaunchSelLdr)(PP_Instance instance,
- const char* alleged_url,
- PP_Bool uses_irt,
- PP_Bool uses_ppapi,
- PP_Bool enable_ppapi_dev,
- PP_Bool enable_dyncode_syscalls,
- PP_Bool enable_exception_handling,
- PP_Bool enable_crash_throttling,
- void* imc_handle,
- struct PP_Var* error_message);
+ void (*LaunchSelLdr)(PP_Instance instance,
+ const char* alleged_url,
+ PP_Bool uses_irt,
+ PP_Bool uses_ppapi,
+ PP_Bool enable_ppapi_dev,
+ PP_Bool enable_dyncode_syscalls,
+ PP_Bool enable_exception_handling,
+ PP_Bool enable_crash_throttling,
+ void* imc_handle,
+ struct PP_Var* error_message,
+ struct PP_CompletionCallback callback);
/* This function starts the IPC proxy so the nexe can communicate with the
* browser. Returns PP_EXTERNAL_PLUGIN_OK on success, otherwise a result code
* indicating the failure. PP_EXTERNAL_PLUGIN_FAILED is returned if
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
index 0d18208..b924066 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -13,6 +13,7 @@
#include <string>
#include "native_client/src/shared/imc/nacl_imc_c.h"
+#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/private/ppb_instance_private.h"
@@ -26,7 +27,8 @@ typedef PP_ExternalPluginResult (*LaunchNaClProcessFunc)(
PP_Bool enable_exception_handling,
PP_Bool enable_crash_throttling,
NaClHandle* result_socket,
- struct PP_Var* error_message);
+ struct PP_Var* error_message,
+ PP_CompletionCallback callback);
extern LaunchNaClProcessFunc launch_nacl_process;
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 841c5e3..701851d 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -302,10 +302,14 @@ bool Plugin::LoadNaClModuleFromBackgroundThread(
// Now start the SelLdr instance. This must be created on the main thread.
bool service_runtime_started;
+ pp::CompletionCallback sel_ldr_callback =
+ callback_factory_.NewCallback(&Plugin::SignalStartSelLdrDone,
+ &service_runtime_started,
+ service_runtime);
pp::CompletionCallback callback =
callback_factory_.NewCallback(&Plugin::StartSelLdrOnMainThread,
service_runtime, params,
- &service_runtime_started);
+ sel_ldr_callback);
pp::Module::Get()->core()->CallOnMainThread(0, callback, 0);
service_runtime->WaitForSelLdrStart();
PLUGIN_PRINTF(("Plugin::LoadNaClModuleFromBackgroundThread "
@@ -327,16 +331,20 @@ bool Plugin::LoadNaClModuleFromBackgroundThread(
void Plugin::StartSelLdrOnMainThread(int32_t pp_error,
ServiceRuntime* service_runtime,
const SelLdrStartParams& params,
- bool* success) {
+ pp::CompletionCallback callback) {
if (pp_error != PP_OK) {
PLUGIN_PRINTF(("Plugin::StartSelLdrOnMainThread: non-PP_OK arg "
"-- SHOULD NOT HAPPEN\n"));
- *success = false;
+ pp::Module::Get()->core()->CallOnMainThread(0, callback, pp_error);
return;
}
- *success = service_runtime->StartSelLdr(params);
- // Signal outside of StartSelLdr here, so that the write to *success
- // is done before signaling.
+ service_runtime->StartSelLdr(params, callback);
+}
+
+void Plugin::SignalStartSelLdrDone(int32_t pp_error,
+ bool* started,
+ ServiceRuntime* service_runtime) {
+ *started = (pp_error == PP_OK);
service_runtime->SignalStartSelLdrDone();
}
@@ -346,6 +354,7 @@ void Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
bool enable_crash_throttling,
const pp::CompletionCallback& init_done_cb,
const pp::CompletionCallback& crash_cb) {
+ nacl::scoped_ptr<nacl::DescWrapper> scoped_wrapper(wrapper);
CHECK(pp::Module::Get()->core()->IsMainThread());
// Before forking a new sel_ldr process, ensure that we do not leak
// the ServiceRuntime object for an existing subprocess, and that any
@@ -373,15 +382,20 @@ void Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
return;
}
- // Now start the SelLdr instance. This must be created on the main thread.
- bool service_runtime_started;
- StartSelLdrOnMainThread(PP_OK, service_runtime, params,
- &service_runtime_started);
- PLUGIN_PRINTF(("Plugin::LoadNaClModule (service_runtime_started=%d)\n",
- service_runtime_started));
- if (!service_runtime_started) {
+ pp::CompletionCallback callback = callback_factory_.NewCallback(
+ &Plugin::LoadNexeAndStart, scoped_wrapper.release(), service_runtime,
+ crash_cb);
+ StartSelLdrOnMainThread(
+ static_cast<int32_t>(PP_OK), service_runtime, params, callback);
+}
+
+void Plugin::LoadNexeAndStart(int32_t pp_error,
+ nacl::DescWrapper* wrapper,
+ ServiceRuntime* service_runtime,
+ const pp::CompletionCallback& crash_cb) {
+ nacl::scoped_ptr<nacl::DescWrapper> scoped_wrapper(wrapper);
+ if (pp_error != PP_OK)
return;
- }
// Now actually load the nexe, which can happen on a background thread.
bool nexe_loaded = service_runtime->LoadNexeAndStart(wrapper, crash_cb);
@@ -786,7 +800,7 @@ void Plugin::NexeFileDidOpen(int32_t pp_error) {
wrapper(wrapper_factory()->MakeFileDesc(file_desc_ok_to_close, O_RDONLY));
NaClLog(4, "NexeFileDidOpen: invoking LoadNaClModule\n");
LoadNaClModule(
- wrapper.get(),
+ wrapper.release(),
true, /* enable_dyncode_syscalls */
true, /* enable_exception_handling */
false, /* enable_crash_throttling */
@@ -903,7 +917,7 @@ void Plugin::BitcodeDidTranslate(int32_t pp_error) {
nacl::scoped_ptr<nacl::DescWrapper>
wrapper(pnacl_coordinator_.get()->ReleaseTranslatedFD());
LoadNaClModule(
- wrapper.get(),
+ wrapper.release(),
false, /* enable_dyncode_syscalls */
false, /* enable_exception_handling */
true, /* enable_crash_throttling */
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index 1f22aec..3c17698 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -299,12 +299,21 @@ class Plugin : public pp::InstancePrivate {
const SelLdrStartParams& params);
// Start sel_ldr from the main thread, given the start params.
- // Sets |success| to true on success.
// |pp_error| is set by CallOnMainThread (should be PP_OK).
void StartSelLdrOnMainThread(int32_t pp_error,
ServiceRuntime* service_runtime,
const SelLdrStartParams& params,
- bool* success);
+ pp::CompletionCallback callback);
+
+ // Signals that StartSelLdr has finished.
+ void SignalStartSelLdrDone(int32_t pp_error,
+ bool* started,
+ ServiceRuntime* service_runtime);
+
+ void LoadNexeAndStart(int32_t pp_error,
+ nacl::DescWrapper* wrapper,
+ ServiceRuntime* service_runtime,
+ const pp::CompletionCallback& crash_cb);
// Callback used when getting the URL for the .nexe file. If the URL loading
// is successful, the file descriptor is opened and can be passed to sel_ldr
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
index 486696b..7fcfa91 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -3,11 +3,11 @@
// found in the LICENSE file.
#include "native_client/src/include/nacl_macros.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/module.h"
#include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
#include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h"
-#include "ppapi/cpp/var.h"
-
LaunchNaClProcessFunc launch_nacl_process = NULL;
namespace plugin {
@@ -17,7 +17,7 @@ bool SelLdrLauncherChrome::Start(const char* url) {
return false;
}
-bool SelLdrLauncherChrome::Start(PP_Instance instance,
+void SelLdrLauncherChrome::Start(PP_Instance instance,
const char* url,
bool uses_irt,
bool uses_ppapi,
@@ -25,29 +25,23 @@ bool SelLdrLauncherChrome::Start(PP_Instance instance,
bool enable_dyncode_syscalls,
bool enable_exception_handling,
bool enable_crash_throttling,
- nacl::string* error_message) {
- *error_message = "";
- if (!launch_nacl_process)
- return false;
- PP_Var var_error_message;
- // send a synchronous message to the browser process
- if (launch_nacl_process(instance,
- url,
- PP_FromBool(uses_irt),
- PP_FromBool(uses_ppapi),
- PP_FromBool(enable_ppapi_dev),
- PP_FromBool(enable_dyncode_syscalls),
- PP_FromBool(enable_exception_handling),
- PP_FromBool(enable_crash_throttling),
- &channel_,
- &var_error_message) != PP_EXTERNAL_PLUGIN_OK) {
- pp::Var var_error_message_cpp(pp::PASS_REF, var_error_message);
- if (var_error_message_cpp.is_string()) {
- *error_message = var_error_message_cpp.AsString();
- }
- return false;
+ PP_Var* error_message,
+ pp::CompletionCallback callback) {
+ if (!launch_nacl_process) {
+ pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED);
+ return;
}
- return true;
+ launch_nacl_process(instance,
+ url,
+ PP_FromBool(uses_irt),
+ PP_FromBool(uses_ppapi),
+ PP_FromBool(enable_ppapi_dev),
+ PP_FromBool(enable_dyncode_syscalls),
+ PP_FromBool(enable_exception_handling),
+ PP_FromBool(enable_crash_throttling),
+ &channel_,
+ error_message,
+ callback.pp_completion_callback());
}
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
index 69c1716..8774116 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h
@@ -7,13 +7,15 @@
#include "native_client/src/trusted/nonnacl_util/sel_ldr_launcher.h"
#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_var.h"
+#include "ppapi/cpp/completion_callback.h"
namespace plugin {
class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase {
public:
virtual bool Start(const char* url);
- virtual bool Start(PP_Instance instance,
+ virtual void Start(PP_Instance instance,
const char* url,
bool uses_irt,
bool uses_ppapi,
@@ -21,7 +23,8 @@ class SelLdrLauncherChrome : public nacl::SelLdrLauncherBase {
bool enable_dyncode_syscalls,
bool enable_exception_handling,
bool enable_crash_throttling,
- nacl::string* error_message);
+ PP_Var* error_message,
+ pp::CompletionCallback callback);
};
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 9bc7b71..6b31439 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -484,7 +484,8 @@ ServiceRuntime::ServiceRuntime(Plugin* plugin,
this,
init_done_cb, crash_cb)),
exit_status_(-1),
- start_sel_ldr_done_(false) {
+ start_sel_ldr_done_(false),
+ callback_factory_(this) {
NaClSrpcChannelInitialize(&command_channel_);
NaClXMutexCtor(&mu_);
NaClXCondVarCtor(&cond_);
@@ -577,7 +578,8 @@ bool ServiceRuntime::StartModule(ErrorInfo* error_info) {
return true;
}
-bool ServiceRuntime::StartSelLdr(const SelLdrStartParams& params) {
+void ServiceRuntime::StartSelLdr(const SelLdrStartParams& params,
+ pp::CompletionCallback callback) {
NaClLog(4, "ServiceRuntime::Start\n");
nacl::scoped_ptr<SelLdrLauncherChrome>
@@ -591,21 +593,37 @@ bool ServiceRuntime::StartSelLdr(const SelLdrStartParams& params) {
"ServiceRuntime: failed to create sel_ldr launcher");
plugin_->ReportLoadError(error_info);
}
- return false;
+ pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED);
+ return;
}
- nacl::string error_message;
- bool started = tmp_subprocess->Start(plugin_->pp_instance(),
- params.url.c_str(),
- params.uses_irt,
- params.uses_ppapi,
- params.enable_dev_interfaces,
- params.enable_dyncode_syscalls,
- params.enable_exception_handling,
- params.enable_crash_throttling,
- &error_message);
- if (!started) {
- NaClLog(LOG_ERROR, "ServiceRuntime::Start (start failed)\n");
+ pp::CompletionCallback internal_callback =
+ callback_factory_.NewCallback(&ServiceRuntime::StartSelLdrContinuation,
+ callback);
+
+ tmp_subprocess->Start(plugin_->pp_instance(),
+ params.url.c_str(),
+ params.uses_irt,
+ params.uses_ppapi,
+ params.enable_dev_interfaces,
+ params.enable_dyncode_syscalls,
+ params.enable_exception_handling,
+ params.enable_crash_throttling,
+ &start_sel_ldr_error_message_,
+ internal_callback);
+ subprocess_.reset(tmp_subprocess.release());
+}
+
+void ServiceRuntime::StartSelLdrContinuation(int32_t pp_error,
+ pp::CompletionCallback callback) {
+ if (pp_error != PP_OK) {
+ NaClLog(LOG_ERROR, "ServiceRuntime::StartSelLdrContinuation "
+ " (start failed)\n");
if (main_service_runtime_) {
+ std::string error_message;
+ pp::Var var_error_message_cpp(pp::PASS_REF, start_sel_ldr_error_message_);
+ if (var_error_message_cpp.is_string()) {
+ error_message = var_error_message_cpp.AsString();
+ }
ErrorInfo error_info;
error_info.SetReportWithConsoleOnlyError(
ERROR_SEL_LDR_LAUNCH,
@@ -613,12 +631,8 @@ bool ServiceRuntime::StartSelLdr(const SelLdrStartParams& params) {
error_message);
plugin_->ReportLoadError(error_info);
}
- return false;
}
-
- subprocess_.reset(tmp_subprocess.release());
- NaClLog(4, "ServiceRuntime::StartSelLdr (return 1)\n");
- return true;
+ pp::Module::Get()->core()->CallOnMainThread(0, callback, pp_error);
}
void ServiceRuntime::WaitForSelLdrStart() {
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index 30200b8..8186e5b 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -24,8 +24,8 @@
#include "native_client/src/trusted/weak_ref/weak_ref.h"
#include "ppapi/cpp/completion_callback.h"
-
#include "ppapi/native_client/src/trusted/plugin/utility.h"
+#include "ppapi/utility/completion_callback_factory.h"
struct NaClFileInfo;
@@ -229,10 +229,9 @@ class ServiceRuntime {
// The destructor terminates the sel_ldr process.
~ServiceRuntime();
- // Spawn the sel_ldr instance. On success, returns true.
- // On failure, returns false and |error_string| is set to something
- // describing the error.
- bool StartSelLdr(const SelLdrStartParams& params);
+ // Spawn the sel_ldr instance.
+ void StartSelLdr(const SelLdrStartParams& params,
+ pp::CompletionCallback callback);
// If starting sel_ldr from a background thread, wait for sel_ldr to
// actually start.
@@ -274,6 +273,8 @@ class ServiceRuntime {
bool LoadModule(nacl::DescWrapper* shm, ErrorInfo* error_info);
bool InitReverseService(ErrorInfo* error_info);
bool StartModule(ErrorInfo* error_info);
+ void StartSelLdrContinuation(int32_t pp_error,
+ pp::CompletionCallback callback);
NaClSrpcChannel command_channel_;
Plugin* plugin_;
@@ -292,6 +293,9 @@ class ServiceRuntime {
NaClCondVar cond_;
int exit_status_;
bool start_sel_ldr_done_;
+
+ PP_Var start_sel_ldr_error_message_;
+ pp::CompletionCallbackFactory<ServiceRuntime> callback_factory_;
};
} // namespace plugin
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index fcb4975..44596c0 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -3090,9 +3090,9 @@ static int32_t Pnacl_M33_PPB_IsolatedFileSystem_Private_Open(PP_Instance instanc
/* Begin wrapper methods for PPB_NaCl_Private_1_0 */
-static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message) {
+static void Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message, struct PP_CompletionCallback* callback) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
- return iface->LaunchSelLdr(instance, alleged_url, uses_irt, uses_ppapi, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, enable_crash_throttling, imc_handle, error_message);
+ iface->LaunchSelLdr(instance, alleged_url, uses_irt, uses_ppapi, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, enable_crash_throttling, imc_handle, error_message, *callback);
}
static PP_ExternalPluginResult Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) {
@@ -5008,7 +5008,7 @@ static struct PPB_IsolatedFileSystem_Private_0_2 Pnacl_Wrappers_PPB_IsolatedFile
};
static struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
- .LaunchSelLdr = (PP_ExternalPluginResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr,
+ .LaunchSelLdr = (void (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, PP_Bool enable_crash_throttling, void* imc_handle, struct PP_Var* error_message, struct PP_CompletionCallback callback))&Pnacl_M25_PPB_NaCl_Private_LaunchSelLdr,
.StartPpapiProxy = (PP_ExternalPluginResult (*)(PP_Instance instance))&Pnacl_M25_PPB_NaCl_Private_StartPpapiProxy,
.UrandomFD = (int32_t (*)(void))&Pnacl_M25_PPB_NaCl_Private_UrandomFD,
.Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M25_PPB_NaCl_Private_Are3DInterfacesDisabled,