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

Unified Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 149403005: Pepper: Make StartSelLdr asynchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CompletionCallback cleanup in service_runtime Created 6 years, 10 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 | « no previous file | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 5fd2f38d630e56cf8cc73b9883fd8942cbe65ddc..a9d909a5e322e8476a139b4205cf80f766e5e400 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) {
« no previous file with comments | « no previous file | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698