コード例 #1
0
ファイル: glue.cpp プロジェクト: funkaster/FakeWebGL
	~DeferredCallback() {
		JSContext* cx = getGlobalContext();
		if (obj) {
			JS_RemoveObjectRoot(cx, &obj);
		}
		if (!fval.isNull()) {
			JS_RemoveValueRoot(cx, &fval);
		}
		if (args) {
			for (int i=0; i < argc; i++) {
				JS_RemoveValueRoot(cx, &args[i]);
			}
			free(args);
		}
	}
コード例 #2
0
ファイル: glue.cpp プロジェクト: funkaster/FakeWebGL
	void set(JSObject* obj, jsval fval, jsval* args = NULL, unsigned argc = 0) {
		JSContext* cx = getGlobalContext();
		if (obj) {
			this->obj = obj;
			JS_AddObjectRoot(cx, &this->obj);
		}
		if (!fval.isNull()) {
			this->fval = fval;
			JS_AddValueRoot(cx, &this->fval);
		}
		if (args) {
			this->args = args;
			this->argc = argc;
			for (int i=0; i < argc; i++) {
				JS_AddValueRoot(cx, &this->args[i]);
			}
		}
	}