Changeset 91194 in webkit for trunk/Source/JavaScriptCore/API
- Timestamp:
- Jul 18, 2011, 10:47:13 AM (14 years ago)
- Location:
- trunk/Source/JavaScriptCore/API
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackConstructor.h
r84052 r91194 33 33 34 34 class JSCallbackConstructor : public JSObjectWithGlobalObject { 35 protected: 36 JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback); 35 37 public: 36 JSCallbackConstructor(JSGlobalObject*, Structure*, JSClassRef, JSObjectCallAsConstructorCallback); 38 static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback) 39 { 40 return new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback); 41 } 42 37 43 virtual ~JSCallbackConstructor(); 38 44 JSClassRef classRef() const { return m_class; } -
trunk/Source/JavaScriptCore/API/JSCallbackFunction.h
r84052 r91194 33 33 34 34 class JSCallbackFunction : public InternalFunction { 35 protected: 36 JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name); 37 35 38 public: 36 JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name); 39 static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name) 40 { 41 return new (allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(exec, globalObject, callback, name); 42 } 37 43 38 44 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/API/JSCallbackObject.h
r87588 r91194 117 117 template <class Base> 118 118 class JSCallbackObject : public Base { 119 p ublic:119 protected: 120 120 JSCallbackObject(ExecState*, JSGlobalObject*, Structure*, JSClassRef, void* data); 121 121 JSCallbackObject(JSGlobalData&, JSClassRef, Structure*); 122 // We'd like to use the placement version of operator new defined in JSCell, but 123 // we can't because Base is a template argument, so we just duplicate the same 124 // functionality here. 125 void* operator new(size_t, void* ptr) { return ptr; } 126 127 public: 128 static JSCallbackObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, void* data) 129 { 130 return new (allocateCell<JSCallbackObject>(*exec->heap())) JSCallbackObject(exec, globalObject, structure, classRef, data); 131 } 132 static JSCallbackObject* create(JSGlobalData& globalData, JSClassRef classRef, Structure* structure) 133 { 134 return new (allocateCell<JSCallbackObject>(globalData.heap)) JSCallbackObject(globalData, classRef, structure); 135 } 122 136 123 137 void setPrivate(void* data); -
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r88587 r91194 561 561 if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { 562 562 563 JSObject* o = new (exec) JSCallbackFunction(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName);563 JSObject* o = JSCallbackFunction::create(exec, asGlobalObject(thisObj->getAnonymousValue(0)), callAsFunction, propertyName); 564 564 thisObj->putDirect(exec->globalData(), propertyName, o, entry->attributes); 565 565 return o; -
trunk/Source/JavaScriptCore/API/JSClassRef.cpp
r83751 r91194 252 252 if (!jsClassData.cachedPrototype) { 253 253 // Recursive, but should be good enough for our purposes 254 jsClassData.cachedPrototype.set(exec->globalData(), new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction254 jsClassData.cachedPrototype.set(exec->globalData(), JSCallbackObject<JSObjectWithGlobalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), prototypeClass, &jsClassData), 0); // set jsClassData as the object's private data, so it can clear our reference on destruction 255 255 if (parentClass) { 256 256 if (JSObject* prototype = parentClass->prototype(exec)) -
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r86785 r91194 98 98 } 99 99 100 JSGlobalObject* globalObject = new (globalData.get()) JSCallbackObject<JSGlobalObject>(*globalData, globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull()));100 JSGlobalObject* globalObject = JSCallbackObject<JSGlobalObject>::create(*globalData, globalObjectClass, JSCallbackObject<JSGlobalObject>::createStructure(*globalData, jsNull())); 101 101 ExecState* exec = globalObject->globalExec(); 102 102 JSValue prototype = globalObjectClass->prototype(exec); -
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r83751 r91194 82 82 return toRef(constructEmptyObject(exec)); 83 83 84 JSCallbackObject<JSObjectWithGlobalObject>* object = new (exec) JSCallbackObject<JSObjectWithGlobalObject>(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data);84 JSCallbackObject<JSObjectWithGlobalObject>* object = JSCallbackObject<JSObjectWithGlobalObject>::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackObjectStructure(), jsClass, data); 85 85 if (JSObject* prototype = jsClass->prototype(exec)) 86 86 object->setPrototype(exec->globalData(), prototype); … … 96 96 Identifier nameID = name ? name->identifier(&exec->globalData()) : Identifier(exec, "anonymous"); 97 97 98 return toRef( new (exec) JSCallbackFunction(exec, exec->lexicalGlobalObject(), callAsFunction, nameID));98 return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, nameID)); 99 99 } 100 100 … … 108 108 jsPrototype = exec->lexicalGlobalObject()->objectPrototype(); 109 109 110 JSCallbackConstructor* constructor = new (exec) JSCallbackConstructor(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor);110 JSCallbackConstructor* constructor = JSCallbackConstructor::create(exec, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->callbackConstructorStructure(), jsClass, callAsConstructor); 111 111 constructor->putDirect(exec->globalData(), exec->propertyNames().prototype, jsPrototype, DontEnum | DontDelete | ReadOnly); 112 112 return toRef(constructor);
Note:
See TracChangeset
for help on using the changeset viewer.