Changeset 15462 in webkit for trunk/JavaScriptCore/API/testapi.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/testapi.c

    r15444 r15462  
    241241}
    242242
    243 JSObjectCallbacks MyObject_callbacks = {
     243JSClassDefinition MyObject_definition = {
    244244    0,
     245   
     246    "MyObject",
     247    NULL,
     248   
     249    NULL,
     250    NULL,
     251   
    245252    MyObject_initialize,
    246253    MyObject_finalize,
     
    259266{
    260267    static JSClassRef jsClass;
    261     if (!jsClass) {
    262         jsClass = JSClassCreate(NULL, NULL, &MyObject_callbacks, NULL);
    263     }
     268    if (!jsClass)
     269        jsClass = JSClassCreate(&MyObject_definition);
    264270   
    265271    return jsClass;
     
    561567    assert(count == 1); // jsCFString should not be enumerated
    562568
    563     JSClassRef nullCallbacksClass = JSClassCreate(NULL, NULL, NULL, NULL);
    564     JSClassRelease(nullCallbacksClass);
     569    JSClassDefinition nullDefinition = kJSClassDefinitionNull;
     570    JSClassRef nullClass = JSClassCreate(&nullDefinition);
     571    JSClassRelease(nullClass);
    565572   
    566573    functionBody = JSStringCreateWithUTF8CString("return this;");
Note: See TracChangeset for help on using the changeset viewer.