Ignore:
Timestamp:
Aug 9, 2011, 1:46:17 PM (14 years ago)
Author:
[email protected]
Message:

Add ParentClass typedef in all JSC classes
https://bugs.webkit.org/show_bug.cgi?id=65731

Patch by Mark Hahnenberg <[email protected]> on 2011-08-09
Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes. This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

  • API/JSCallbackConstructor.h:
  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.h:

(JSC::JSCallbackObject::createStructure):
(JSC::JSCallbackObject::visitChildren):

  • API/JSCallbackObjectFunctions.h:

(JSC::::asCallbackObject):
(JSC::::JSCallbackObject):
(JSC::::init):
(JSC::::className):
(JSC::::getOwnPropertySlot):
(JSC::::getOwnPropertyDescriptor):
(JSC::::put):
(JSC::::deleteProperty):
(JSC::::getConstructData):
(JSC::::construct):
(JSC::::hasInstance):
(JSC::::getCallData):
(JSC::::call):
(JSC::::getOwnPropertyNames):
(JSC::::toNumber):
(JSC::::toString):
(JSC::::setPrivate):
(JSC::::getPrivate):
(JSC::::inherits):
(JSC::::getStaticValue):
(JSC::::staticFunctionGetter):
(JSC::::callbackGetter):

  • debugger/DebuggerActivation.h:
  • jsc.cpp:
  • runtime/Arguments.h:
  • runtime/ArrayConstructor.h:
  • runtime/ArrayPrototype.h:
  • runtime/BooleanConstructor.h:
  • runtime/BooleanObject.h:
  • runtime/BooleanPrototype.h:
  • runtime/DateConstructor.h:
  • runtime/DateInstance.h:
  • runtime/DatePrototype.h:
  • runtime/Error.cpp:
  • runtime/ErrorConstructor.h:
  • runtime/ErrorInstance.h:
  • runtime/ErrorPrototype.h:
  • runtime/ExceptionHelpers.cpp:
  • runtime/Executable.h:
  • runtime/FunctionConstructor.h:
  • runtime/FunctionPrototype.h:
  • runtime/GetterSetter.h:
  • runtime/InternalFunction.h:
  • runtime/JSAPIValueWrapper.h:
  • runtime/JSActivation.h:
  • runtime/JSArray.h:
  • runtime/JSFunction.h:
  • runtime/JSGlobalObject.h:
  • runtime/JSNotAnObject.h:
  • runtime/JSONObject.h:
  • runtime/JSObject.h:
  • runtime/JSPropertyNameIterator.h:
  • runtime/JSStaticScopeObject.h:
  • runtime/JSString.h:
  • runtime/JSVariableObject.h:
  • runtime/JSWrapperObject.h:
  • runtime/MathObject.h:
  • runtime/NativeErrorConstructor.h:
  • runtime/NativeErrorPrototype.h:
  • runtime/NumberConstructor.h:
  • runtime/NumberObject.h:
  • runtime/NumberPrototype.h:
  • runtime/ObjectConstructor.h:
  • runtime/ObjectPrototype.h:
  • runtime/RegExp.h:
  • runtime/RegExpConstructor.h:
  • runtime/RegExpMatchesArray.h:
  • runtime/RegExpObject.h:

(JSC::RegExpObject::create):

  • runtime/RegExpPrototype.h:
  • runtime/ScopeChain.h:
  • runtime/StrictEvalActivation.h:
  • runtime/StringConstructor.h:
  • runtime/StringObject.h:
  • runtime/StringObjectThatMasqueradesAsUndefined.h:
  • runtime/StringPrototype.h:
  • runtime/Structure.h:
  • runtime/StructureChain.h:

Source/JavaScriptGlue:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes. This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

  • JSRun.h:
  • UserObjectImp.h:

Source/WebCore:

No new tests.

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes. This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

  • bindings/js/JSAudioConstructor.h:
  • bindings/js/JSImageConstructor.h:
  • bindings/js/JSOptionConstructor.h:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateHeader):
(GenerateConstructorDeclaration):

  • bindings/scripts/test/JS/JSTestInterface.cpp:
  • bindings/scripts/test/JS/JSTestInterface.h:
  • bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
  • bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
  • bindings/scripts/test/JS/JSTestObj.cpp:
  • bindings/scripts/test/JS/JSTestObj.h:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
  • bridge/c/CRuntimeObject.h:
  • bridge/c/c_instance.cpp:
  • bridge/jni/jsc/JavaInstanceJSC.cpp:
  • bridge/jni/jsc/JavaRuntimeObject.h:
  • bridge/objc/ObjCRuntimeObject.h:
  • bridge/objc/objc_runtime.h:
  • bridge/qt/qt_instance.cpp:
  • bridge/qt/qt_pixmapruntime.cpp:
  • bridge/qt/qt_runtime.h:
  • bridge/runtime_array.h:
  • bridge/runtime_method.h:
  • bridge/runtime_object.h:
  • bridge/testqtbindings.cpp:

(Global::className):

Source/WebKit/mac:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes. This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

  • Plugins/Hosted/ProxyInstance.mm:
  • Plugins/Hosted/ProxyRuntimeObject.h:

Source/WebKit2:

Just added the Base typedefs in all the classes that are a subclass of JSCell
to point at their parent classes. This is a change to support future changes to the way
constructors and destructors are implemented in JS objects, among other things.

  • WebProcess/Plugins/Netscape/JSNPMethod.h:
  • WebProcess/Plugins/Netscape/JSNPObject.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r91194 r92706  
    4343namespace JSC {
    4444
    45 template <class Base>
    46 inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue value)
     45template <class Parent>
     46inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(JSValue value)
    4747{
    4848    ASSERT(asObject(value)->inherits(&s_info));
     
    5050}
    5151
    52 template <class Base>
    53 JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data)
    54     : Base(globalObject, structure)
     52template <class Parent>
     53JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef jsClass, void* data)
     54    : Parent(globalObject, structure)
    5555    , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(data, jsClass)))
    5656{
    57     ASSERT(Base::inherits(&s_info));
     57    ASSERT(Parent::inherits(&s_info));
    5858    init(exec);
    5959}
     
    6161// Global object constructor.
    6262// FIXME: Move this into a separate JSGlobalCallbackObject class derived from this one.
    63 template <class Base>
    64 JSCallbackObject<Base>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure)
    65     : Base(globalData, structure)
     63template <class Parent>
     64JSCallbackObject<Parent>::JSCallbackObject(JSGlobalData& globalData, JSClassRef jsClass, Structure* structure)
     65    : Parent(globalData, structure)
    6666    , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
    6767{
    68     ASSERT(Base::inherits(&s_info));
    69     ASSERT(Base::isGlobalObject());
     68    ASSERT(Parent::inherits(&s_info));
     69    ASSERT(Parent::isGlobalObject());
    7070    init(static_cast<JSGlobalObject*>(this)->globalExec());
    7171}
    7272
    73 template <class Base>
    74 void JSCallbackObject<Base>::init(ExecState* exec)
     73template <class Parent>
     74void JSCallbackObject<Parent>::init(ExecState* exec)
    7575{
    7676    ASSERT(exec);
     
    101101}
    102102
    103 template <class Base>
    104 UString JSCallbackObject<Base>::className() const
     103template <class Parent>
     104UString JSCallbackObject<Parent>::className() const
    105105{
    106106    UString thisClassName = classRef()->className();
     
    108108        return thisClassName;
    109109   
    110     return Base::className();
    111 }
    112 
    113 template <class Base>
    114 bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
     110    return Parent::className();
     111}
     112
     113template <class Parent>
     114bool JSCallbackObject<Parent>::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    115115{
    116116    JSContextRef ctx = toRef(exec);
     
    166166    }
    167167   
    168     return Base::getOwnPropertySlot(exec, propertyName, slot);
    169 }
    170 
    171 template <class Base>
    172 bool JSCallbackObject<Base>::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
     168    return Parent::getOwnPropertySlot(exec, propertyName, slot);
     169}
     170
     171template <class Parent>
     172bool JSCallbackObject<Parent>::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
    173173{
    174174    PropertySlot slot;
     
    185185    }
    186186
    187     return Base::getOwnPropertyDescriptor(exec, propertyName, descriptor);
    188 }
    189 
    190 template <class Base>
    191 void JSCallbackObject<Base>::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
     187    return Parent::getOwnPropertyDescriptor(exec, propertyName, descriptor);
     188}
     189
     190template <class Parent>
     191void JSCallbackObject<Parent>::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
    192192{
    193193    JSContextRef ctx = toRef(exec);
     
    237237                if (entry->attributes & kJSPropertyAttributeReadOnly)
    238238                    return;
    239                 JSCallbackObject<Base>::putDirect(exec->globalData(), propertyName, value); // put as override property
     239                JSCallbackObject<Parent>::putDirect(exec->globalData(), propertyName, value); // put as override property
    240240                return;
    241241            }
     
    243243    }
    244244   
    245     return Base::put(exec, propertyName, value, slot);
    246 }
    247 
    248 template <class Base>
    249 bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, const Identifier& propertyName)
     245    return Parent::put(exec, propertyName, value, slot);
     246}
     247
     248template <class Parent>
     249bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, const Identifier& propertyName)
    250250{
    251251    JSContextRef ctx = toRef(exec);
     
    286286    }
    287287   
    288     return Base::deleteProperty(exec, propertyName);
    289 }
    290 
    291 template <class Base>
    292 bool JSCallbackObject<Base>::deleteProperty(ExecState* exec, unsigned propertyName)
     288    return Parent::deleteProperty(exec, propertyName);
     289}
     290
     291template <class Parent>
     292bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, unsigned propertyName)
    293293{
    294294    return deleteProperty(exec, Identifier::from(exec, propertyName));
    295295}
    296296
    297 template <class Base>
    298 ConstructType JSCallbackObject<Base>::getConstructData(ConstructData& constructData)
     297template <class Parent>
     298ConstructType JSCallbackObject<Parent>::getConstructData(ConstructData& constructData)
    299299{
    300300    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
     
    307307}
    308308
    309 template <class Base>
    310 EncodedJSValue JSCallbackObject<Base>::construct(ExecState* exec)
     309template <class Parent>
     310EncodedJSValue JSCallbackObject<Parent>::construct(ExecState* exec)
    311311{
    312312    JSObject* constructor = exec->callee();
     
    314314    JSObjectRef constructorRef = toRef(constructor);
    315315   
    316     for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
     316    for (JSClassRef jsClass = static_cast<JSCallbackObject<Parent>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
    317317        if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
    318318            int argumentCount = static_cast<int>(exec->argumentCount());
     
    336336}
    337337
    338 template <class Base>
    339 bool JSCallbackObject<Base>::hasInstance(ExecState* exec, JSValue value, JSValue)
     338template <class Parent>
     339bool JSCallbackObject<Parent>::hasInstance(ExecState* exec, JSValue value, JSValue)
    340340{
    341341    JSContextRef execRef = toRef(exec);
     
    359359}
    360360
    361 template <class Base>
    362 CallType JSCallbackObject<Base>::getCallData(CallData& callData)
     361template <class Parent>
     362CallType JSCallbackObject<Parent>::getCallData(CallData& callData)
    363363{
    364364    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
     
    371371}
    372372
    373 template <class Base>
    374 EncodedJSValue JSCallbackObject<Base>::call(ExecState* exec)
     373template <class Parent>
     374EncodedJSValue JSCallbackObject<Parent>::call(ExecState* exec)
    375375{
    376376    JSContextRef execRef = toRef(exec);
     
    378378    JSObjectRef thisObjRef = toRef(exec->hostThisValue().toThisObject(exec));
    379379   
    380     for (JSClassRef jsClass = static_cast<JSCallbackObject<Base>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
     380    for (JSClassRef jsClass = static_cast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
    381381        if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
    382382            int argumentCount = static_cast<int>(exec->argumentCount());
     
    400400}
    401401
    402 template <class Base>
    403 void JSCallbackObject<Base>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
     402template <class Parent>
     403void JSCallbackObject<Parent>::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
    404404{
    405405    JSContextRef execRef = toRef(exec);
     
    435435    }
    436436   
    437     Base::getOwnPropertyNames(exec, propertyNames, mode);
    438 }
    439 
    440 template <class Base>
    441 double JSCallbackObject<Base>::toNumber(ExecState* exec) const
     437    Parent::getOwnPropertyNames(exec, propertyNames, mode);
     438}
     439
     440template <class Parent>
     441double JSCallbackObject<Parent>::toNumber(ExecState* exec) const
    442442{
    443443    // We need this check to guard against the case where this object is rhs of
     
    467467        }
    468468           
    469     return Base::toNumber(exec);
    470 }
    471 
    472 template <class Base>
    473 UString JSCallbackObject<Base>::toString(ExecState* exec) const
     469    return Parent::toNumber(exec);
     470}
     471
     472template <class Parent>
     473UString JSCallbackObject<Parent>::toString(ExecState* exec) const
    474474{
    475475    JSContextRef ctx = toRef(exec);
     
    492492        }
    493493           
    494     return Base::toString(exec);
    495 }
    496 
    497 template <class Base>
    498 void JSCallbackObject<Base>::setPrivate(void* data)
     494    return Parent::toString(exec);
     495}
     496
     497template <class Parent>
     498void JSCallbackObject<Parent>::setPrivate(void* data)
    499499{
    500500    m_callbackObjectData->privateData = data;
    501501}
    502502
    503 template <class Base>
    504 void* JSCallbackObject<Base>::getPrivate()
     503template <class Parent>
     504void* JSCallbackObject<Parent>::getPrivate()
    505505{
    506506    return m_callbackObjectData->privateData;
    507507}
    508508
    509 template <class Base>
    510 bool JSCallbackObject<Base>::inherits(JSClassRef c) const
     509template <class Parent>
     510bool JSCallbackObject<Parent>::inherits(JSClassRef c) const
    511511{
    512512    for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)
     
    517517}
    518518
    519 template <class Base>
    520 JSValue JSCallbackObject<Base>::getStaticValue(ExecState* exec, const Identifier& propertyName)
     519template <class Parent>
     520JSValue JSCallbackObject<Parent>::getStaticValue(ExecState* exec, const Identifier& propertyName)
    521521{
    522522    JSObjectRef thisRef = toRef(this);
     
    546546}
    547547
    548 template <class Base>
    549 JSValue JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
    550 {
    551     JSCallbackObject* thisObj = asCallbackObject(slotBase);
     548template <class Parent>
     549JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName)
     550{
     551    JSCallbackObject* thisObj = asCallbackObject(slotParent);
    552552   
    553553    // Check for cached or override property.
    554554    PropertySlot slot2(thisObj);
    555     if (thisObj->Base::getOwnPropertySlot(exec, propertyName, slot2))
     555    if (thisObj->Parent::getOwnPropertySlot(exec, propertyName, slot2))
    556556        return slot2.getValue(exec, propertyName);
    557557   
     
    572572}
    573573
    574 template <class Base>
    575 JSValue JSCallbackObject<Base>::callbackGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
    576 {
    577     JSCallbackObject* thisObj = asCallbackObject(slotBase);
     574template <class Parent>
     575JSValue JSCallbackObject<Parent>::callbackGetter(ExecState* exec, JSValue slotParent, const Identifier& propertyName)
     576{
     577    JSCallbackObject* thisObj = asCallbackObject(slotParent);
    578578   
    579579    JSObjectRef thisRef = toRef(thisObj);
Note: See TracChangeset for help on using the changeset viewer.