OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "native_client/src/include/nacl_macros.h" | 5 #include "native_client/src/include/nacl_macros.h" |
| 6 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/cpp/module.h" |
6 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" | 8 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" |
7 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" | 9 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" |
8 | 10 |
9 #include "ppapi/cpp/var.h" | |
10 | |
11 LaunchNaClProcessFunc launch_nacl_process = NULL; | 11 LaunchNaClProcessFunc launch_nacl_process = NULL; |
12 | 12 |
13 namespace plugin { | 13 namespace plugin { |
14 | 14 |
15 bool SelLdrLauncherChrome::Start(const char* url) { | 15 bool SelLdrLauncherChrome::Start(const char* url) { |
16 NACL_NOTREACHED(); | 16 NACL_NOTREACHED(); |
17 return false; | 17 return false; |
18 } | 18 } |
19 | 19 |
20 bool SelLdrLauncherChrome::Start(PP_Instance instance, | 20 void SelLdrLauncherChrome::Start(PP_Instance instance, |
21 const char* url, | 21 const char* url, |
22 bool uses_irt, | 22 bool uses_irt, |
23 bool uses_ppapi, | 23 bool uses_ppapi, |
24 bool enable_ppapi_dev, | 24 bool enable_ppapi_dev, |
25 bool enable_dyncode_syscalls, | 25 bool enable_dyncode_syscalls, |
26 bool enable_exception_handling, | 26 bool enable_exception_handling, |
27 bool enable_crash_throttling, | 27 bool enable_crash_throttling, |
28 nacl::string* error_message) { | 28 PP_Var* error_message, |
29 *error_message = ""; | 29 pp::CompletionCallback callback) { |
30 if (!launch_nacl_process) | 30 if (!launch_nacl_process) { |
31 return false; | 31 pp::Module::Get()->core()->CallOnMainThread(0, callback, PP_ERROR_FAILED); |
32 PP_Var var_error_message; | 32 return; |
33 // send a synchronous message to the browser process | |
34 if (launch_nacl_process(instance, | |
35 url, | |
36 PP_FromBool(uses_irt), | |
37 PP_FromBool(uses_ppapi), | |
38 PP_FromBool(enable_ppapi_dev), | |
39 PP_FromBool(enable_dyncode_syscalls), | |
40 PP_FromBool(enable_exception_handling), | |
41 PP_FromBool(enable_crash_throttling), | |
42 &channel_, | |
43 &var_error_message) != PP_EXTERNAL_PLUGIN_OK) { | |
44 pp::Var var_error_message_cpp(pp::PASS_REF, var_error_message); | |
45 if (var_error_message_cpp.is_string()) { | |
46 *error_message = var_error_message_cpp.AsString(); | |
47 } | |
48 return false; | |
49 } | 33 } |
50 return true; | 34 launch_nacl_process(instance, |
| 35 url, |
| 36 PP_FromBool(uses_irt), |
| 37 PP_FromBool(uses_ppapi), |
| 38 PP_FromBool(enable_ppapi_dev), |
| 39 PP_FromBool(enable_dyncode_syscalls), |
| 40 PP_FromBool(enable_exception_handling), |
| 41 PP_FromBool(enable_crash_throttling), |
| 42 &channel_, |
| 43 error_message, |
| 44 callback.pp_completion_callback()); |
51 } | 45 } |
52 | 46 |
53 } // namespace plugin | 47 } // namespace plugin |
OLD | NEW |