Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOJSConsole.h File Reference
import <Foundation/Foundation.h>
#include <jsapi.h>
+ Include dependency graph for OOJSConsole.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

JSObject * DebugMonitorToJSConsole (JSContext *context, OODebugMonitor *monitor)
 
void OOJSConsoleDestroy (void)
 

Function Documentation

◆ DebugMonitorToJSConsole()

JSObject * DebugMonitorToJSConsole ( JSContext * context,
OODebugMonitor * monitor )

Definition at line 255 of file OOJSConsole.m.

256{
258
259 OOJavaScriptEngine *engine = nil;
260 JSObject *object = NULL;
261 JSObject *settingsObject = NULL;
262 jsval value;
263
264 NSCAssert(JS_EnterLocalRootScope(context), @"Failed to create JS GC root scope");
265 engine = [OOJavaScriptEngine sharedEngine];
266
267 if (sConsolePrototype == NULL)
268 {
269 InitOOJSConsole(context, [engine globalObject]);
270 }
271
272 // Create Console object
273 object = JS_NewObject(context, &sConsoleClass, sConsolePrototype, NULL);
274 if (object != NULL)
275 {
276 if (!JS_SetPrivate(context, object, [monitor weakRetain])) object = NULL;
277 }
278
279 if (object != NULL)
280 {
281 // Create ConsoleSettings object
282 settingsObject = JS_NewObject(context, &sConsoleSettingsClass, sConsoleSettingsPrototype, NULL);
283 if (settingsObject != NULL)
284 {
285 if (!JS_SetPrivate(context, settingsObject, [monitor weakRetain])) settingsObject = NULL;
286 }
287 if (settingsObject != NULL)
288 {
289 value = OBJECT_TO_JSVAL(settingsObject);
290 if (!JS_SetProperty(context, object, "settings", &value))
291 {
292 settingsObject = NULL;
293 }
294 }
295
296 if (settingsObject == NULL) object = NULL;
297 }
298
299 JS_LeaveLocalRootScope(context);
300
301 return object;
302 // Analyzer: object leaked. (x2) [Expected, objects are retained by JS object.]
303
305}
static JSObject * sConsolePrototype
Definition OOJSConsole.m:60
static void InitOOJSConsole(JSContext *context, JSObject *global)
static JSClass sConsoleClass
static JSClass sConsoleSettingsClass
static JSObject * sConsoleSettingsPrototype
Definition OOJSConsole.m:61
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
return nil

References InitOOJSConsole(), nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, sConsoleClass, sConsolePrototype, sConsoleSettingsClass, sConsoleSettingsPrototype, and OOJavaScriptEngine::sharedEngine.

+ Here is the call graph for this function:

◆ OOJSConsoleDestroy()

void OOJSConsoleDestroy ( void )

Definition at line 249 of file OOJSConsole.m.

250{
251 sConsolePrototype = NULL;
252}

References sConsolePrototype.