| 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 | 5 |
| 6 #include "nacl_io_demo.h" | 6 #include "nacl_io_demo.h" |
| 7 | 7 |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const char* name; | 36 const char* name; |
| 37 HandleFunc function; | 37 HandleFunc function; |
| 38 } FuncNameMapping; | 38 } FuncNameMapping; |
| 39 | 39 |
| 40 static PP_Instance g_instance = 0; | 40 static PP_Instance g_instance = 0; |
| 41 static PPB_GetInterface get_browser_interface = NULL; | 41 static PPB_GetInterface get_browser_interface = NULL; |
| 42 static PPB_Messaging* ppb_messaging_interface = NULL; | 42 static PPB_Messaging* ppb_messaging_interface = NULL; |
| 43 static PPB_Var* ppb_var_interface = NULL; | 43 static PPB_Var* ppb_var_interface = NULL; |
| 44 | 44 |
| 45 static FuncNameMapping g_function_map[] = { | 45 static FuncNameMapping g_function_map[] = { |
| 46 {"fopen", HandleFopen}, | 46 { "fopen", HandleFopen }, |
| 47 {"fwrite", HandleFwrite}, | 47 { "fwrite", HandleFwrite }, |
| 48 {"fread", HandleFread}, | 48 { "fread", HandleFread }, |
| 49 {"fseek", HandleFseek}, | 49 { "fseek", HandleFseek }, |
| 50 {"fclose", HandleFclose}, | 50 { "fclose", HandleFclose }, |
| 51 {"fflush", HandleFflush}, | 51 { "fflush", HandleFflush }, |
| 52 {"stat", HandleStat}, | 52 { "stat", HandleStat }, |
| 53 {"opendir", HandleOpendir}, | 53 { "opendir", HandleOpendir }, |
| 54 {"readdir", HandleReaddir}, | 54 { "readdir", HandleReaddir }, |
| 55 {"closedir", HandleClosedir}, | 55 { "closedir", HandleClosedir }, |
| 56 {"mkdir", HandleMkdir}, | 56 { "mkdir", HandleMkdir }, |
| 57 {"rmdir", HandleRmdir}, | 57 { "rmdir", HandleRmdir }, |
| 58 {"chdir", HandleChdir}, | 58 { "chdir", HandleChdir }, |
| 59 {"getcwd", HandleGetcwd}, | 59 { "getcwd", HandleGetcwd }, |
| 60 {"gethostbyname", HandleGethostbyname}, | 60 { "getaddrinfo", HandleGetaddrinfo }, |
| 61 {"connect", HandleConnect}, | 61 { "gethostbyname", HandleGethostbyname }, |
| 62 {"send", HandleSend}, | 62 { "connect", HandleConnect }, |
| 63 {"recv", HandleRecv}, | 63 { "send", HandleSend }, |
| 64 {"close", HandleClose}, | 64 { "recv", HandleRecv }, |
| 65 {NULL, NULL}, | 65 { "close", HandleClose }, |
| 66 { NULL, NULL }, |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 /** A handle to the thread the handles messages. */ | 69 /** A handle to the thread the handles messages. */ |
| 69 static pthread_t g_handle_message_thread; | 70 static pthread_t g_handle_message_thread; |
| 70 | 71 |
| 71 /** | 72 /** |
| 72 * Create a new PP_Var from a C string. | 73 * Create a new PP_Var from a C string. |
| 73 * @param[in] str The string to convert. | 74 * @param[in] str The string to convert. |
| 74 * @return A new PP_Var with the contents of |str|. | 75 * @return A new PP_Var with the contents of |str|. |
| 75 */ | 76 */ |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) { | 376 } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) { |
| 376 static PPP_Messaging messaging_interface = { | 377 static PPP_Messaging messaging_interface = { |
| 377 &Messaging_HandleMessage, | 378 &Messaging_HandleMessage, |
| 378 }; | 379 }; |
| 379 return &messaging_interface; | 380 return &messaging_interface; |
| 380 } | 381 } |
| 381 return NULL; | 382 return NULL; |
| 382 } | 383 } |
| 383 | 384 |
| 384 PP_EXPORT void PPP_ShutdownModule() {} | 385 PP_EXPORT void PPP_ShutdownModule() {} |
| OLD | NEW |