seed r350 - trunk/libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r350 - trunk/libseed
- Date: Tue, 25 Nov 2008 06:52:02 +0000 (UTC)
Author: racarr
Date: Tue Nov 25 06:52:01 2008
New Revision: 350
URL: http://svn.gnome.org/viewvc/seed?rev=350&view=rev
Log:
seed-closure.c is entirely free of global context now.
Modified:
trunk/libseed/seed-builtins.c
trunk/libseed/seed-closure.c
trunk/libseed/seed-closure.h
trunk/libseed/seed-types.c
Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c (original)
+++ trunk/libseed/seed-builtins.c Tue Nov 25 06:52:01 2008
@@ -367,10 +367,10 @@
if (argumentCount == 2)
closure =
- seed_make_gclosure((JSObjectRef) arguments[0],
+ seed_make_gclosure(ctx, (JSObjectRef) arguments[0],
(JSObjectRef) arguments[1]);
else
- closure = seed_make_gclosure((JSObjectRef) arguments[0], 0);
+ closure = seed_make_gclosure(ctx, (JSObjectRef) arguments[0], 0);
return (JSValueRef) seed_make_struct(closure, 0);
}
@@ -408,7 +408,7 @@
info = (GICallableInfo *) JSObjectGetPrivate((JSObjectRef) arguments[1]);
- privates = seed_make_native_closure(info, arguments[0]);
+ privates = seed_make_native_closure(ctx, info, arguments[0]);
return JSObjectMake(ctx, seed_native_callback_class, privates);
}
Modified: trunk/libseed/seed-closure.c
==============================================================================
--- trunk/libseed/seed-closure.c (original)
+++ trunk/libseed/seed-closure.c Tue Nov 25 06:52:01 2008
@@ -231,7 +231,7 @@
}
return_value = (JSValueRef)
- JSObjectCallAsFunction(eng->context,
+ JSObjectCallAsFunction(privates->ctx,
(JSObjectRef) privates->function, 0,
num_args, jsargs, 0);
@@ -326,7 +326,8 @@
g_free(return_arg);
}
-SeedNativeClosure *seed_make_native_closure(GICallableInfo * info,
+SeedNativeClosure *seed_make_native_closure(JSContextRef ctx,
+ GICallableInfo * info,
JSValueRef function)
{
ffi_cif *cif;
@@ -344,7 +345,7 @@
(JSObjectRef) seed_object_get_property((JSObjectRef) function,
"__seed_native_closure");
if (cached
- && JSValueIsObjectOfClass(eng->context, cached,
+ && JSValueIsObjectOfClass(ctx, cached,
seed_native_callback_class))
{
return (SeedNativeClosure *) JSObjectGetPrivate(cached);
@@ -359,6 +360,7 @@
privates->info = info;
privates->function = function;
privates->cif = cif;
+ privates->ctx = ctx;
for (i = 0; i < num_args; i++)
{
@@ -377,14 +379,16 @@
seed_object_set_property((JSObjectRef) function,
"__seed_native_closure",
- (JSValueRef) JSObjectMake(eng->context,
+ (JSValueRef) JSObjectMake(ctx,
seed_native_callback_class,
privates));
return privates;
}
-SeedClosure *seed_make_gclosure(JSObjectRef function, JSObjectRef this)
+SeedClosure *seed_make_gclosure(JSContextRef ctx,
+ JSObjectRef function,
+ JSObjectRef this)
{
GClosure *closure;
@@ -393,15 +397,15 @@
((SeedClosure *) closure)->function = function;
((SeedClosure *) closure)->object = 0;
- if (this && !JSValueIsNull(eng->context, this))
+ if (this && !JSValueIsNull(ctx, this))
{
- JSValueProtect(eng->context, this);
+ JSValueProtect(ctx, this);
((SeedClosure *) closure)->this = this;
}
else
((SeedClosure *) closure)->this = 0;
- JSValueProtect(eng->context, function);
+ JSValueProtect(ctx, function);
return (SeedClosure *) closure;
}
Modified: trunk/libseed/seed-closure.h
==============================================================================
--- trunk/libseed/seed-closure.h (original)
+++ trunk/libseed/seed-closure.h Tue Nov 25 06:52:01 2008
@@ -36,6 +36,7 @@
} SeedClosure;
typedef struct _SeedNativeClosure {
+ JSContextRef ctx;
GICallableInfo *info;
JSValueRef function;
@@ -45,9 +46,11 @@
extern JSClassRef seed_native_callback_class;
-SeedNativeClosure *seed_make_native_closure(GICallableInfo * info,
+SeedNativeClosure *seed_make_native_closure(JSContextRef ctx,
+ GICallableInfo * info,
JSValueRef function);
-SeedClosure *seed_make_gclosure(JSObjectRef function, JSObjectRef this);
+SeedClosure *seed_make_gclosure(JSContextRef ctx,
+ JSObjectRef function, JSObjectRef this);
void seed_closures_init();
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Tue Nov 25 06:52:01 2008
@@ -314,7 +314,8 @@
(eng->context, (JSObjectRef) value))
{
arg->v_pointer =
- seed_make_gclosure((JSObjectRef) value, 0);
+ seed_make_gclosure(eng->context,
+ (JSObjectRef) value, 0);
}
}
else
@@ -381,7 +382,8 @@
else if (JSObjectIsFunction(eng->context, (JSObjectRef) value))
{
SeedNativeClosure *privates =
- seed_make_native_closure((GICallableInfo *) interface,
+ seed_make_native_closure(eng->context,
+ (GICallableInfo *) interface,
value);
arg->v_pointer = privates->closure;
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]