| 237 | } |
| 238 | |
| 239 | static void gjs_context_class_init(GjsContextClass* klass) { |
| 240 | GObjectClass* object_class = G_OBJECT_CLASS(klass); |
| 241 | |
| 242 | gjs_log_init(); |
| 243 | |
| 244 | object_class->dispose = gjs_context_dispose; |
| 245 | object_class->finalize = gjs_context_finalize; |
| 246 | |
| 247 | object_class->constructed = gjs_context_constructed; |
| 248 | object_class->get_property = gjs_context_get_property; |
| 249 | object_class->set_property = gjs_context_set_property; |
| 250 | |
| 251 | gjs_context_props[PROP_SEARCH_PATH] = g_param_spec_boxed( |
| 252 | "search-path", "Search path", |
| 253 | "Path where modules to import should reside", G_TYPE_STRV, |
| 254 | GParamFlags(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
| 255 | |
| 256 | gjs_context_props[PROP_PROGRAM_NAME] = g_param_spec_string( |
| 257 | "program-name", "Program Name", |
| 258 | "The filename of the launched JS program", "", |
| 259 | GParamFlags(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 260 | |
| 261 | gjs_context_props[PROP_PROGRAM_PATH] = g_param_spec_string( |
| 262 | "program-path", "Executed File Path", |
| 263 | "The full path of the launched file or NULL if GJS was launched from " |
| 264 | "the C API or interactive console.", |
| 265 | nullptr, GParamFlags(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); |
| 266 | |
| 267 | /** |
| 268 | * GjsContext:profiler-enabled: |
| 269 | * |
| 270 | * Set this property to profile any JS code run by this context. By |
| 271 | * default, the profiler is started and stopped when you call |
| 272 | * gjs_context_eval(). |
| 273 | * |
| 274 | * The value of this property is superseded by the GJS_ENABLE_PROFILER |
| 275 | * environment variable. |
| 276 | * |
| 277 | * You may only have one context with the profiler enabled at a time. |
| 278 | */ |
| 279 | gjs_context_props[PROP_PROFILER_ENABLED] = g_param_spec_boolean( |
| 280 | "profiler-enabled", "Profiler enabled", |
| 281 | "Whether to profile JS code run by this context", FALSE, |
| 282 | GParamFlags(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
| 283 | |
| 284 | /** |
| 285 | * GjsContext:profiler-sigusr2: |
| 286 | * |
| 287 | * Set this property to install a SIGUSR2 signal handler that starts and |
| 288 | * stops the profiler. This property also implies that |
| 289 | * #GjsContext:profiler-enabled is set. |
| 290 | */ |
| 291 | gjs_context_props[PROP_PROFILER_SIGUSR2] = g_param_spec_boolean( |
| 292 | "profiler-sigusr2", "Profiler SIGUSR2", |
| 293 | "Whether to activate the profiler on SIGUSR2", FALSE, |
| 294 | GParamFlags(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); |
| 295 | |
| 296 | gjs_context_props[PROP_EXEC_AS_MODULE] = g_param_spec_boolean( |
nothing calls this directly
no test coverage detected