| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ppapi/nacl_irt/irt_interfaces.h" |
| 6 |
| 5 #include <unistd.h> | 7 #include <unistd.h> |
| 6 | 8 |
| 7 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 8 #include "native_client/src/public/irt_core.h" | 10 #include "native_client/src/public/irt_core.h" |
| 9 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" | 11 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" |
| 10 #include "native_client/src/untrusted/irt/irt.h" | 12 #include "native_client/src/untrusted/irt/irt.h" |
| 11 #include "ppapi/nacl_irt/irt_manifest.h" | 13 #include "ppapi/nacl_irt/irt_manifest.h" |
| 12 #include "ppapi/nacl_irt/irt_ppapi.h" | |
| 13 #include "ppapi/nacl_irt/plugin_main.h" | |
| 14 #include "ppapi/nacl_irt/public/irt_ppapi.h" | 14 #include "ppapi/nacl_irt/public/irt_ppapi.h" |
| 15 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" | 15 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" |
| 16 | 16 |
| 17 static struct PP_StartFunctions g_pp_functions; | |
| 18 | |
| 19 int irt_ppapi_start(const struct PP_StartFunctions* funcs) { | |
| 20 g_pp_functions = *funcs; | |
| 21 return PpapiPluginMain(); | |
| 22 } | |
| 23 | |
| 24 int32_t PPP_InitializeModule(PP_Module module_id, | |
| 25 PPB_GetInterface get_browser_interface) { | |
| 26 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface); | |
| 27 } | |
| 28 | |
| 29 void PPP_ShutdownModule(void) { | |
| 30 g_pp_functions.PPP_ShutdownModule(); | |
| 31 } | |
| 32 | |
| 33 const void* PPP_GetInterface(const char* interface_name) { | |
| 34 return g_pp_functions.PPP_GetInterface(interface_name); | |
| 35 } | |
| 36 | |
| 37 static const struct nacl_irt_ppapihook nacl_irt_ppapihook = { | |
| 38 irt_ppapi_start, | |
| 39 PpapiPluginRegisterThreadCreator, | |
| 40 }; | |
| 41 | |
| 42 #if defined(OS_NACL_SFI) | 17 #if defined(OS_NACL_SFI) |
| 43 static int ppapihook_pnacl_private_filter(void) { | 18 static int ppapihook_pnacl_private_filter(void) { |
| 44 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); | 19 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); |
| 45 if (pnacl_mode == -1) | 20 if (pnacl_mode == -1) |
| 46 return 0; | 21 return 0; |
| 47 return pnacl_mode; | 22 return pnacl_mode; |
| 48 } | 23 } |
| 49 #endif | 24 #endif |
| 50 | 25 |
| 51 static const nacl_irt_resource_open kIrtResourceOpen = { | 26 static const nacl_irt_resource_open kIrtResourceOpen = { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 size_t result = nacl_irt_query_list(interface_ident, | 61 size_t result = nacl_irt_query_list(interface_ident, |
| 87 table, | 62 table, |
| 88 tablesize, | 63 tablesize, |
| 89 irt_interfaces, | 64 irt_interfaces, |
| 90 sizeof(irt_interfaces)); | 65 sizeof(irt_interfaces)); |
| 91 if (result != 0) | 66 if (result != 0) |
| 92 return result; | 67 return result; |
| 93 | 68 |
| 94 return nacl_irt_query_core(interface_ident, table, tablesize); | 69 return nacl_irt_query_core(interface_ident, table, tablesize); |
| 95 } | 70 } |
| OLD | NEW |