| OLD | NEW |
| 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client 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 <sys/nacl_imc_api.h> | 5 #include <sys/nacl_imc_api.h> |
| 6 #include <sys/nacl_syscalls.h> | 6 #include <sys/nacl_syscalls.h> |
| 7 | 7 |
| 8 #include "native_client/src/shared/platform/nacl_check.h" | 8 #include "native_client/src/shared/platform/nacl_check.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" | 9 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" | 10 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" |
| 11 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" | 11 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" |
| 12 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" | 12 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" |
| 13 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h" |
| 13 #include "native_client/src/shared/ppapi_proxy/utility.h" | 14 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 14 #include "native_client/src/shared/srpc/nacl_srpc.h" | 15 #include "native_client/src/shared/srpc/nacl_srpc.h" |
| 15 #include "srpcgen/ppp_rpc.h" | |
| 16 | 16 |
| 17 | 17 |
| 18 #define NACL_SEND_FD 6 | 18 #define NACL_SEND_FD 6 |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 NaClSrpcChannel* main_srpc_channel; | 22 NaClSrpcChannel* main_srpc_channel; |
| 23 NaClSrpcChannel* upcall_srpc_channel; | 23 NaClSrpcChannel* upcall_srpc_channel; |
| 24 PP_Module module_id_for_plugin; | 24 PP_Module module_id_for_plugin; |
| 25 struct PP_ThreadFunctions thread_funcs; | 25 struct PP_ThreadFunctions thread_funcs; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 const PPB_Memory_Dev* PPBMemoryInterface() { | 75 const PPB_Memory_Dev* PPBMemoryInterface() { |
| 76 return static_cast<const PPB_Memory_Dev*>( | 76 return static_cast<const PPB_Memory_Dev*>( |
| 77 GetBrowserInterfaceSafe(PPB_MEMORY_DEV_INTERFACE)); | 77 GetBrowserInterfaceSafe(PPB_MEMORY_DEV_INTERFACE)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 const PPB_Var* PPBVarInterface() { | 80 const PPB_Var* PPBVarInterface() { |
| 81 return static_cast<const PPB_Var*>( | 81 return static_cast<const PPB_Var*>( |
| 82 GetBrowserInterfaceSafe(PPB_VAR_INTERFACE)); | 82 GetBrowserInterfaceSafe(PPB_VAR_INTERFACE)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 const PPP_InputEvent* PPPInputEventInterface() { |
| 86 static const PPP_InputEvent* ppp_input_event = |
| 87 static_cast<const PPP_InputEvent*>( |
| 88 ::PPP_GetInterface(PPP_INPUT_EVENT_INTERFACE)); |
| 89 // This helper is only used from interface function proxies; a NULL return |
| 90 // means something is wrong with the proxy. |
| 91 CHECK(ppp_input_event != NULL); |
| 92 return ppp_input_event; |
| 93 } |
| 94 |
| 85 const PPP_Messaging* PPPMessagingInterface() { | 95 const PPP_Messaging* PPPMessagingInterface() { |
| 86 static const PPP_Messaging* ppp_messaging = static_cast<const PPP_Messaging*>( | 96 static const PPP_Messaging* ppp_messaging = static_cast<const PPP_Messaging*>( |
| 87 ::PPP_GetInterface(PPP_MESSAGING_INTERFACE)); | 97 ::PPP_GetInterface(PPP_MESSAGING_INTERFACE)); |
| 88 // This helper is only used from interface function proxies; a NULL return | 98 // This helper is only used from interface function proxies; a NULL return |
| 89 // means something is wrong with the proxy. | 99 // means something is wrong with the proxy. |
| 90 CHECK(ppp_messaging != NULL); | 100 CHECK(ppp_messaging != NULL); |
| 91 return ppp_messaging; | 101 return ppp_messaging; |
| 92 } | 102 } |
| 93 | 103 |
| 94 const struct PP_ThreadFunctions* GetThreadCreator() { | 104 const struct PP_ThreadFunctions* GetThreadCreator() { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 PpapiPluginRegisterDefaultThreadCreator(); | 138 PpapiPluginRegisterDefaultThreadCreator(); |
| 129 // Designate this as the main thread for PPB_Core::IsMainThread(). | 139 // Designate this as the main thread for PPB_Core::IsMainThread(). |
| 130 ppapi_proxy::PluginCore::MarkMainThread(); | 140 ppapi_proxy::PluginCore::MarkMainThread(); |
| 131 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { | 141 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { |
| 132 return 1; | 142 return 1; |
| 133 } | 143 } |
| 134 NaClSrpcModuleFini(); | 144 NaClSrpcModuleFini(); |
| 135 | 145 |
| 136 return 0; | 146 return 0; |
| 137 } | 147 } |
| OLD | NEW |