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/c/pp_var.h" |
| 8 #include "ppapi/cpp/completion_callback.h" |
| 9 #include "ppapi/cpp/module.h" |
6 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" | 10 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h" |
7 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" | 11 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h" |
8 | 12 |
9 #include "ppapi/cpp/var.h" | |
10 | |
11 LaunchNaClProcessFunc launch_nacl_process = NULL; | 13 LaunchNaClProcessFunc launch_nacl_process = NULL; |
12 | 14 |
13 namespace plugin { | 15 namespace plugin { |
14 | 16 |
15 bool SelLdrLauncherChrome::Start(const char* url) { | 17 bool SelLdrLauncherChrome::Start(const char* url) { |
16 NACL_NOTREACHED(); | 18 NACL_NOTREACHED(); |
17 return false; | 19 return false; |
18 } | 20 } |
19 | 21 |
20 bool SelLdrLauncherChrome::Start(PP_Instance instance, | 22 void SelLdrLauncherChrome::Start(PP_Instance instance, |
21 const char* url, | 23 const char* url, |
22 bool uses_irt, | 24 bool uses_irt, |
23 bool uses_ppapi, | 25 bool uses_ppapi, |
24 bool enable_ppapi_dev, | 26 bool enable_ppapi_dev, |
25 bool enable_dyncode_syscalls, | 27 bool enable_dyncode_syscalls, |
26 bool enable_exception_handling, | 28 bool enable_exception_handling, |
27 bool enable_crash_throttling, | 29 bool enable_crash_throttling, |
28 nacl::string* error_message) { | 30 PP_Var* error_message, |
29 *error_message = ""; | 31 PP_CompletionCallback callback) { |
30 if (!launch_nacl_process) | 32 if (!launch_nacl_process) { |
31 return false; | 33 pp::CompletionCallback cc(callback.func, |
32 PP_Var var_error_message; | 34 callback.user_data, |
| 35 callback.flags); |
| 36 pp::Module::Get()->core()->CallOnMainThread( |
| 37 0, cc, static_cast<int32_t>(PP_ERROR_FAILED)); |
| 38 return; |
| 39 } |
33 // send a synchronous message to the browser process | 40 // send a synchronous message to the browser process |
34 if (launch_nacl_process(instance, | 41 launch_nacl_process(instance, |
35 url, | 42 url, |
36 PP_FromBool(uses_irt), | 43 PP_FromBool(uses_irt), |
37 PP_FromBool(uses_ppapi), | 44 PP_FromBool(uses_ppapi), |
38 PP_FromBool(enable_ppapi_dev), | 45 PP_FromBool(enable_ppapi_dev), |
39 PP_FromBool(enable_dyncode_syscalls), | 46 PP_FromBool(enable_dyncode_syscalls), |
40 PP_FromBool(enable_exception_handling), | 47 PP_FromBool(enable_exception_handling), |
41 PP_FromBool(enable_crash_throttling), | 48 PP_FromBool(enable_crash_throttling), |
42 &channel_, | 49 &channel_, |
43 &var_error_message) != PP_EXTERNAL_PLUGIN_OK) { | 50 error_message, |
44 pp::Var var_error_message_cpp(pp::PASS_REF, var_error_message); | 51 callback); |
45 if (var_error_message_cpp.is_string()) { | |
46 *error_message = var_error_message_cpp.AsString(); | |
47 } | |
48 return false; | |
49 } | |
50 return true; | |
51 } | 52 } |
52 | 53 |
53 } // namespace plugin | 54 } // namespace plugin |
OLD | NEW |