summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/pepper
diff options
context:
space:
mode:
authorhalyavin@google.com <halyavin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-22 18:01:30 +0000
committerhalyavin@google.com <halyavin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-22 18:01:30 +0000
commit05c7cc7cbf45b00d5d3400cb893adb1c196c10ee (patch)
treedf2e7d167527c561f56046535b468491ed127490 /chrome/renderer/pepper
parent8df07d2a28b8de7a857a9e1ad8df36a6026939a8 (diff)
downloadchromium_src-05c7cc7cbf45b00d5d3400cb893adb1c196c10ee.zip
chromium_src-05c7cc7cbf45b00d5d3400cb893adb1c196c10ee.tar.gz
chromium_src-05c7cc7cbf45b00d5d3400cb893adb1c196c10ee.tar.bz2
Show more different NaCl loading errors.
Also refactor NaCl launch message to pass output parameters in a single structure. I changed nacl::FileDescriptor type on Windows from int to HANDLE to make it compatible with IPC::PlatformFileForTransit. The only ways nacl::FileDescriptor is currently used are its initialization, passing in IPC message and in nacl::ToNativeHandle function. The behaviour of nacl::ToNativeHandle haven't changed. IPC doesn't have special handling for integers and it only truncates HANDLEs to 32-bit (so that they can be passed between 32-bit and 64-bit processes) on Windows. So the change shouldn't affect any existing users of nacl::FileDescriptor type. TEST= bots + changing code to produce an error on normal code path BUG= 259333 Review URL: https://chromiumcodereview.appspot.com/18045007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/pepper')
-rw-r--r--chrome/renderer/pepper/ppb_nacl_private_impl.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chrome/renderer/pepper/ppb_nacl_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
index 846a860..4d91899 100644
--- a/chrome/renderer/pepper/ppb_nacl_private_impl.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -85,10 +85,12 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
PP_Bool enable_ppapi_dev,
PP_Bool enable_dyncode_syscalls,
PP_Bool enable_exception_handling,
- void* imc_handle) {
+ void* imc_handle,
+ struct PP_Var* error_message) {
nacl::FileDescriptor result_socket;
IPC::Sender* sender = content::RenderThread::Get();
DCHECK(sender);
+ *error_message = PP_MakeUndefined();
int routing_id = 0;
// If the nexe uses ppapi APIs, we need a routing ID.
// To get the routing ID, we must be on the main thread.
@@ -111,6 +113,8 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
perm_bits |= ppapi::PERMISSION_DEV;
instance_info.permissions =
ppapi::PpapiPermissions::GetForCommandLine(perm_bits);
+ std::string error_message_string;
+ nacl::NaClLaunchResult launch_result;
if (!sender->Send(new NaClHostMsg_LaunchNaCl(
nacl::NaClLaunchParams(instance_info.url.spec(),
@@ -119,13 +123,18 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
PP_ToBool(uses_irt),
PP_ToBool(enable_dyncode_syscalls),
PP_ToBool(enable_exception_handling)),
- &result_socket,
- &instance_info.channel_handle,
- &instance_info.plugin_pid,
- &instance_info.plugin_child_id))) {
+ &launch_result,
+ &error_message_string))) {
return PP_NACL_FAILED;
}
-
+ if (!error_message_string.empty()) {
+ *error_message = ppapi::StringVar::StringToPPVar(error_message_string);
+ return PP_NACL_FAILED;
+ }
+ result_socket = launch_result.imc_channel_handle;
+ instance_info.channel_handle = launch_result.ipc_channel_handle;
+ instance_info.plugin_pid = launch_result.plugin_pid;
+ instance_info.plugin_child_id = launch_result.plugin_child_id;
// Don't save instance_info if channel handle is invalid.
bool invalid_handle = instance_info.channel_handle.name.empty();
#if defined(OS_POSIX)