Index: native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c |
diff --git a/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c b/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c |
index 1ce3b817f49e0504ed505438de72d5c6de713b53..51a35187c414b3037f10a330d22256c98866d473 100644 |
--- a/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c |
+++ b/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c |
@@ -292,7 +292,6 @@ static void HandleMessage(struct PP_Var message) { |
g_ppb_var->Release(result_var); |
} |
- |
/** |
* Helper function used by EchoThread which reads from a file descriptor |
* and writes all the data that it reads back to the same descriptor. |
@@ -342,7 +341,6 @@ static void* EchoThread(void* user_data) { |
if (FD_ISSET(fd3, &readfds)) |
EchoInput(fd3); |
} |
- |
} |
close(fd1); |
close(fd2); |
@@ -388,6 +386,19 @@ static PP_Bool Instance_DidCreate(PP_Instance instance, |
0, /* mountflags */ |
""); /* data */ |
+ for (uint32_t i = 0; i < argc; ++i) { |
+ if (strcmp(argn[i], "token") == 0) { |
+ char buffer[1024]; |
+ snprintf(buffer, sizeof(buffer), "token=%s", argv[i]); |
+ |
+ mount("", /* source */ |
+ "/googledrive", /* target */ |
+ "googledrivefs", /* filesystemtype */ |
+ 0, /* mountflags */ |
+ buffer); /* data */ |
+ } |
+ } |
+ |
pthread_create(&g_handle_message_thread, NULL, &HandleMessageThread, NULL); |
pthread_create(&g_echo_thread, NULL, &EchoThread, NULL); |
InitializeMessageQueue(); |
@@ -395,15 +406,12 @@ static PP_Bool Instance_DidCreate(PP_Instance instance, |
return PP_TRUE; |
} |
-static void Instance_DidDestroy(PP_Instance instance) { |
-} |
+static void Instance_DidDestroy(PP_Instance instance) {} |
static void Instance_DidChangeView(PP_Instance instance, |
- PP_Resource view_resource) { |
-} |
+ PP_Resource view_resource) {} |
-static void Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { |
-} |
+static void Instance_DidChangeFocus(PP_Instance instance, PP_Bool has_focus) {} |
static PP_Bool Instance_HandleDocumentLoad(PP_Instance instance, |
PP_Resource url_loader) { |
@@ -463,18 +471,16 @@ PP_EXPORT int32_t PPP_InitializeModule(PP_Module a_module_id, |
GET_INTERFACE(g_ppb_messaging, PPB_Messaging, PPB_MESSAGING_INTERFACE); |
GET_INTERFACE(g_ppb_var, PPB_Var, PPB_VAR_INTERFACE); |
GET_INTERFACE(g_ppb_var_array, PPB_VarArray, PPB_VAR_ARRAY_INTERFACE); |
- GET_INTERFACE( |
- g_ppb_var_dictionary, PPB_VarDictionary, PPB_VAR_DICTIONARY_INTERFACE); |
+ GET_INTERFACE(g_ppb_var_dictionary, PPB_VarDictionary, |
+ PPB_VAR_DICTIONARY_INTERFACE); |
return PP_OK; |
} |
PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { |
if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) { |
static PPP_Instance instance_interface = { |
- &Instance_DidCreate, |
- &Instance_DidDestroy, |
- &Instance_DidChangeView, |
- &Instance_DidChangeFocus, |
+ &Instance_DidCreate, &Instance_DidDestroy, |
+ &Instance_DidChangeView, &Instance_DidChangeFocus, |
&Instance_HandleDocumentLoad, |
}; |
return &instance_interface; |
@@ -487,5 +493,4 @@ PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { |
return NULL; |
} |
-PP_EXPORT void PPP_ShutdownModule() { |
-} |
+PP_EXPORT void PPP_ShutdownModule() {} |