| 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" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 } // namespace ppapi_proxy | 151 } // namespace ppapi_proxy |
| 152 | 152 |
| 153 void PpapiPluginRegisterThreadCreator( | 153 void PpapiPluginRegisterThreadCreator( |
| 154 const struct PP_ThreadFunctions* new_funcs) { | 154 const struct PP_ThreadFunctions* new_funcs) { |
| 155 thread_funcs = *new_funcs; | 155 thread_funcs = *new_funcs; |
| 156 } | 156 } |
| 157 | 157 |
| 158 int PpapiPluginPreInit() { |
| 159 if (!NaClSrpcModuleInit()) { |
| 160 return 1; |
| 161 } |
| 162 NaClLogModuleInit(); // Enable NaClLog'ing used by CHECK(). |
| 163 PpapiPluginRegisterDefaultThreadCreator(); |
| 164 // Designate this as the main thread for PPB_Core::IsMainThread(). |
| 165 ppapi_proxy::PluginCore::MarkMainThread(); |
| 166 return 0; |
| 167 } |
| 168 |
| 169 int PpapiPluginPostInit() { |
| 170 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { |
| 171 return 1; |
| 172 } |
| 173 NaClSrpcModuleFini(); |
| 174 |
| 175 return 0; |
| 176 } |
| 177 |
| 158 int PpapiPluginMain() { | 178 int PpapiPluginMain() { |
| 159 if (getenv("NACL_LD_ACCEPTS_PLUGIN_CONNECTION") != NULL) { | 179 if (getenv("NACL_LD_ACCEPTS_PLUGIN_CONNECTION") != NULL) { |
| 160 // Send a message to the page to ask it to reinitialise the | 180 // Send a message to the page to ask it to reinitialise the |
| 161 // plugin's SRPC/PPAPI connection. This triggers a call to | 181 // plugin's SRPC/PPAPI connection. This triggers a call to |
| 162 // __startSrpcServices() which in turn calls | 182 // __startSrpcServices() which in turn calls |
| 163 // StartProxiedExecution() which sets up the PPAPI proxy. This is | 183 // StartProxiedExecution() which sets up the PPAPI proxy. This is |
| 164 // necessary because LoadNaClModule()'s earlier call to | 184 // necessary because LoadNaClModule()'s earlier call to |
| 165 // StartSrpcServices() was matched by the dynamic linker before | 185 // StartSrpcServices() was matched by the dynamic linker before |
| 166 // libppruntime was available. | 186 // libppruntime was available. |
| 167 // For background, see: | 187 // For background, see: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 181 PpapiPluginRegisterDefaultThreadCreator(); | 201 PpapiPluginRegisterDefaultThreadCreator(); |
| 182 // Designate this as the main thread for PPB_Core::IsMainThread(). | 202 // Designate this as the main thread for PPB_Core::IsMainThread(). |
| 183 ppapi_proxy::PluginCore::MarkMainThread(); | 203 ppapi_proxy::PluginCore::MarkMainThread(); |
| 184 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { | 204 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { |
| 185 return 1; | 205 return 1; |
| 186 } | 206 } |
| 187 NaClSrpcModuleFini(); | 207 NaClSrpcModuleFini(); |
| 188 | 208 |
| 189 return 0; | 209 return 0; |
| 190 } | 210 } |
| OLD | NEW |