|
Tilde Friends
|
Typedefs | |
| typedef struct uv_loop_s | uv_loop_t |
| typedef int | taskid_t |
| typedef int | promiseid_t |
| typedef int | exportid_t |
| typedef struct _tf_taskstub_t | tf_taskstub_t |
| typedef struct _tf_task_t | tf_task_t |
| typedef struct _tf_trace_t | tf_trace_t |
| typedef struct _tf_ssb_t | tf_ssb_t |
| typedef enum _tf_task_message_t | tf_task_message_t |
| typedef void() | tf_android_start_service_t(int pipe_fd) |
| typedef void() | tf_android_stop_service_t() |
Enumerations | |
| enum | _tf_task_message_t { kResolvePromise , kRejectPromise , kInvokeExport , kReleaseExport , kReleaseImport , kActivate , kExecute , kKill , kSetImports , kGetExports , kLoadFile , kTaskError , kTaskTrace , kPrint } |
Task is responsible for running JS in C. It exposes just what is needed for sandboxed or trusted code, helps with communiciation between parent and child processes, including function calls and async operations across the boundaries.
| typedef int exportid_t |
An exported function identifier.
| typedef int promiseid_t |
A promise identifier.
| typedef int taskid_t |
A task identifier.
| typedef void() tf_android_start_service_t(int pipe_fd) |
A callback used to start an Android service.
| pipe_fd | A file descriptor with which to communicate with the invoking task. |
| typedef void() tf_android_stop_service_t() |
A callback used to stop an Android service.
| typedef struct _tf_ssb_t tf_ssb_t |
An SSB instance.
| typedef enum _tf_task_message_t tf_task_message_t |
A message type that can be sent between tasks.
| typedef struct _tf_task_t tf_task_t |
A task.
| typedef struct _tf_taskstub_t tf_taskstub_t |
A handle to a task.
| typedef struct _tf_trace_t tf_trace_t |
A trace instance.
| typedef struct uv_loop_s uv_loop_t |
An event loop.
| enum _tf_task_message_t |
A message type that can be sent between tasks.
| void tf_task_activate | ( | tf_task_t * | task | ) |
Start a task running its script.
| task | The task. |
| JSValue tf_task_add_import | ( | tf_task_t * | task, |
| taskid_t | stub_id, | ||
| exportid_t | export_id | ||
| ) |
Create a function that can be called from a handle to an exported function from another task.
| task | The running task. |
| stub_id | The task stub from which the function was exported. |
| export_id | The handle to the function. |
| JSValue tf_task_allocate_promise | ( | tf_task_t * | task, |
| promiseid_t * | out_promise | ||
| ) |
Allocate a promise object.
| task | The running task. | |
| [out] | out_promise | The promise that was allocated. |
| taskid_t tf_task_allocate_task_id | ( | tf_task_t * | task, |
| tf_taskstub_t * | stub | ||
| ) |
Generate an unused task identifier representing the task stub from the running task.
| task | The running task. |
| stub | A handle to the task requesting an identifier. |
| void tf_task_check_jobs | ( | tf_task_t * | task | ) |
Check for JS jobs that need to be run. Generally to be called post-JS_Call in tf_util_report_error.
| task | The task. |
| void tf_task_configure_from_fd | ( | tf_task_t * | task, |
| int | fd | ||
| ) |
Configure a task from a file descriptor. Typically a pipe to the parent task's process.
| task | The task to configure. |
| fd | The file descriptor. |
| tf_task_t * tf_task_create | ( | ) |
Create a task.
| void tf_task_destroy | ( | tf_task_t * | task | ) |
Destroy a task.
| task | The task. |
| int tf_task_execute | ( | tf_task_t * | task, |
| const char * | file | ||
| ) |
Run a script from file on disk.
| task | The task. |
| file | The path to the script file to run. |
| exportid_t tf_task_export_function | ( | tf_task_t * | task, |
| tf_taskstub_t * | to, | ||
| JSValue | function | ||
| ) |
Convert a function to an integer handle that can be passed across processes.
| task | The running task. |
| to | The task stub to which the handle will be passed. |
| function | The functoin to export. |
Get the task from a JS context.
| context | The context. |
| tf_android_start_service_t * tf_task_get_android_start_service | ( | ) |
Get the callback registered for starting an Android service.
| tf_android_stop_service_t * tf_task_get_android_stop_service | ( | ) |
Get the callback registered for stopping an Android service.
Get the JS context from a task.
| task | The task. |
| char * tf_task_get_debug | ( | tf_task_t * | task | ) |
Get a report of miscellaneous debug information.
| task | The task. |
Get the event loop from a task.
| task | The task. |
| const char * tf_task_get_name | ( | tf_task_t * | task | ) |
Get the name of a task.
| task | The task. |
| bool tf_task_get_one_proc | ( | tf_task_t * | task | ) |
Get whether this instance is configure to run in a single process.
| task | The running task. |
| const char * tf_task_get_path_with_root | ( | tf_task_t * | task, |
| const char * | path | ||
| ) |
Get the path to use for reading a given loose file.
| task | The task. |
| path | The path to the file. |
| const char * tf_task_get_root_path | ( | tf_task_t * | task | ) |
Get the path to use for reading loose files.
| task | The task. |
Get the SSB instance from a task.
| task | The task. |
| tf_taskstub_t * tf_task_get_stub | ( | tf_task_t * | task, |
| taskid_t | id | ||
| ) |
Get a tf_taskstub_t by taskid_t.
| task | The task. |
| id | The id. |
| tf_trace_t * tf_task_get_trace | ( | tf_task_t * | task | ) |
Get the trace instance from a task.
| task | The task. |
| const char * tf_task_get_zip_path | ( | tf_task_t * | task | ) |
Get the path to the zip file being used for static data.
| task | The task. |
| bool tf_task_is_shutting_down | ( | tf_task_t * | task | ) |
Check whether tf_task_destroy has been called already.
| task | The task. |
| void tf_task_on_receive_packet | ( | int | packetType, |
| const char * | begin, | ||
| size_t | length, | ||
| void * | userData | ||
| ) |
Have a task handle a message from a packaet stream.
| packetType | The type of the message. |
| begin | The data. |
| length | The size of the data. |
| userData | The task stub from which the packet was received. |
| void tf_task_print | ( | tf_task_t * | task, |
| int | argc, | ||
| JSValueConst * | argv | ||
| ) |
Print through a task's parent.
| task | The running task. |
| argc | The number of arguments to print. |
| argv | The arguments to print. |
| void tf_task_reject_promise | ( | tf_task_t * | task, |
| promiseid_t | promise, | ||
| JSValue | error | ||
| ) |
Reject a promise.
| task | The running task. |
| promise | The promise to reject. |
| error | The value with which to reject the promise. |
| void tf_task_remove_child | ( | tf_task_t * | task, |
| tf_taskstub_t * | child | ||
| ) |
Remove a task stub from a task.
| task | The parent task. |
| child | The task handle to remove. |
| void tf_task_resolve_promise | ( | tf_task_t * | task, |
| promiseid_t | promise, | ||
| JSValue | result | ||
| ) |
Resolve a promise.
| task | The running task. |
| promise | The promise to resolve. |
| result | The value with which to resolve the promise. |
| void tf_task_run | ( | tf_task_t * | task | ) |
Update a task until it is done or stopped.
| task | The task. |
| bool tf_task_send_error_to_parent | ( | tf_task_t * | task, |
| JSValue | error | ||
| ) |
Send an error to the parent task.
| task | The current task. |
| error | The potential error. |
| void tf_task_send_promise_message | ( | tf_task_t * | from, |
| tf_taskstub_t * | to, | ||
| tf_task_message_t | type, | ||
| promiseid_t | promise, | ||
| JSValue | payload | ||
| ) |
Send a message referencing a promise across a packet stream.
| from | The task originating the message. |
| to | The task handle receiving the message. |
| type | The message type. |
| promise | The promise. |
| payload | The content of the message. |
| void tf_task_set_android_service_callbacks | ( | tf_android_start_service_t * | start_service, |
| tf_android_stop_service_t * | stop_service | ||
| ) |
Set Android service callbacks.
| start_service | Start service callback. |
| stop_service | Stop service callback. |
| void tf_task_set_args | ( | tf_task_t * | task, |
| const char * | args | ||
| ) |
Set arbitrary named arguments that will be made available to the task.
| task | The task. |
| args | A string of the form "key=value,other_key=other_value,..." |
| void tf_task_set_db_path | ( | tf_task_t * | task, |
| const char * | path | ||
| ) |
Set the path to the SQLite database.
| task | The task. |
| path | The database path. |
| void tf_task_set_one_proc | ( | tf_task_t * | task, |
| bool | one_proc | ||
| ) |
Set whether all tasks should run in a single process. Only supported to appease Apple's limitations.
| task | The running task. |
| one_proc | True if subprocesses should not be used. |
| void tf_task_set_root_path | ( | tf_task_t * | task, |
| const char * | path | ||
| ) |
Set the path to the root of the project directory for data.
| task | The task. |
| path | The file path or NULL. |
| void tf_task_set_ssb_network_key | ( | tf_task_t * | task, |
| const char * | network_key | ||
| ) |
Set the SSB network key.
| task | The task. |
| network_key | The network key. |
| void tf_task_set_trusted | ( | tf_task_t * | task, |
| bool | trusted | ||
| ) |
Set a task as trusted or untrusted. Trusted tasks have more interface exposed to them.
| task | The task. |
| trusted | true if the task is trusted. |
| void tf_task_set_zip_path | ( | tf_task_t * | task, |
| const char * | path | ||
| ) |
Set the path to a zip file from which to load all static data.
| task | The task. |
| path | The zip file path or NULL. |
| void tf_task_visit_children | ( | tf_task_t * | task, |
| void(*)(tf_task_t *task, tf_taskstub_t *stub, void *user_data) | callback, | ||
| void * | user_data | ||
| ) |
Call a callback for each child task.
| task | The task. |
| callback | The callback. |
| user_data | User data to pass to the callback. |