Changeset 15462 in webkit for trunk/JavaScriptCore/API/JSNode.c


Ignore:
Timestamp:
Jul 15, 2006, 6:28:25 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.

  • Moved the arguments passed to JSClassCreate into a single structure, called JSClassDefinition. This will enable easier structure migration/versioning in the future, if necessary.


  • Added support for class names.


  • kJSClassDefinitionNull replaces kJSObjectCallbacksNone.


  • JSClass is becoming a fairly complex struct, so I migrated all of its implementation other than reference counting to the sruct.


  • Also moved JSClass* functions in the API to JSObjectRef.cpp, since they're declared in JSObjectRef.h


  • Also added some more informative explanation to the class structure doc.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSNode.c

    r15444 r15462  
    108108static JSClassRef JSNodePrototype_class(JSContextRef context)
    109109{
    110     static JSClassRef nodePrototypeClass;
    111     if (!nodePrototypeClass)
    112         nodePrototypeClass = JSClassCreate(NULL, JSNodePrototype_staticFunctions, &kJSObjectCallbacksNone, NULL);
    113     return nodePrototypeClass;
     110    static JSClassRef jsClass;
     111    if (!jsClass) {
     112        JSClassDefinition definition = kJSClassDefinitionNull;
     113        definition.staticFunctions = JSNodePrototype_staticFunctions;
     114        jsClass = JSClassCreate(&definition);
     115    }
     116    return jsClass;
    114117}
    115118
     
    164167static JSClassRef JSNode_class(JSContextRef context)
    165168{
    166     static JSClassRef nodeClass;
    167     if (!nodeClass) {
    168         JSObjectCallbacks JSNode_callbacks = kJSObjectCallbacksNone;
    169         JSNode_callbacks.finalize = JSNode_finalize;
    170        
    171         nodeClass = JSClassCreate(JSNode_staticValues, NULL, &JSNode_callbacks, NULL);
    172     }
    173     return nodeClass;
     169    static JSClassRef jsClass;
     170    if (!jsClass) {
     171        JSClassDefinition definition = kJSClassDefinitionNull;
     172        definition.staticValues = JSNode_staticValues;
     173        definition.finalize = JSNode_finalize;
     174
     175        jsClass = JSClassCreate(&definition);
     176    }
     177    return jsClass;
    174178}
    175179
Note: See TracChangeset for help on using the changeset viewer.