| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Native Client Authors. All rights reserved. | 2 * Copyright 2008 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * Simple test for native web workers. | 8 * Simple test for native web workers. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 static char* message_string; | 33 static char* message_string; |
| 34 | 34 |
| 35 void PostMessage(NaClSrpcRpc *rpc, | 35 void PostMessage(NaClSrpcRpc *rpc, |
| 36 NaClSrpcArg **in_args, | 36 NaClSrpcArg **in_args, |
| 37 NaClSrpcArg **out_args, | 37 NaClSrpcArg **out_args, |
| 38 NaClSrpcClosure *done) { | 38 NaClSrpcClosure *done) { |
| 39 rpc->result = NACL_SRPC_RESULT_APP_ERROR; | 39 rpc->result = NACL_SRPC_RESULT_APP_ERROR; |
| 40 /* | 40 /* |
| 41 * Strdup must be used because the SRPC layer frees the string passed to it. | 41 * Strdup must be used because the SRPC layer frees the string passed to it. |
| 42 */ | 42 */ |
| 43 message_string = strdup(in_args[0]->u.sval.str); | 43 message_string = strdup(in_args[0]->arrays.str); |
| 44 /* | 44 /* |
| 45 * Echo the message back to the renderer. | 45 * Echo the message back to the renderer. |
| 46 */ | 46 */ |
| 47 if (-1 != worker_upcall_desc) { | 47 if (-1 != worker_upcall_desc) { |
| 48 NaClSrpcChannel upcall_channel; | 48 NaClSrpcChannel upcall_channel; |
| 49 if (!NaClSrpcClientCtor(&upcall_channel, worker_upcall_desc)) { | 49 if (!NaClSrpcClientCtor(&upcall_channel, worker_upcall_desc)) { |
| 50 done->Run(done); | 50 done->Run(done); |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 NaClSrpcInvokeBySignature(&upcall_channel, "postMessage:s:", "from nacl"); | 53 NaClSrpcInvokeBySignature(&upcall_channel, "postMessage:s:", "from nacl"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 66 int main() { | 66 int main() { |
| 67 if (!NaClSrpcModuleInit()) { | 67 if (!NaClSrpcModuleInit()) { |
| 68 return 1; | 68 return 1; |
| 69 } | 69 } |
| 70 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { | 70 if (!NaClSrpcAcceptClientConnection(srpc_methods)) { |
| 71 return 1; | 71 return 1; |
| 72 } | 72 } |
| 73 NaClSrpcModuleFini(); | 73 NaClSrpcModuleFini(); |
| 74 return 0; | 74 return 0; |
| 75 } | 75 } |
| OLD | NEW |