Ignore:
Timestamp:
Dec 5, 2011, 4:17:34 PM (14 years ago)
Author:
Darin Adler
Message:

Convert JSClassRef to use HashMap<OwnPtr>
https://bugs.webkit.org/show_bug.cgi?id=73780

Reviewed by Andreas Kling.

  • API/JSCallbackObjectFunctions.h:

(JSC::JSCallbackObject::getOwnPropertyNames): Use get() on the hash map
entries because the hash map now has an OwnPtr instead of a raw pointer.

  • API/JSClassRef.cpp:

(OpaqueJSClass::OpaqueJSClass): No need to initialize m_staticValues and
m_staticFunctions since they are now OwnPtr. Use adoptPtr when allocating.
Removed the code that gets and deletes existing entries, and just use set,
which now handles deletion automatically due to it being OwnPtr.
(OpaqueJSClass::~OpaqueJSClass): Replaced code to do all the deletion
with assertion-only NDEBUG-only code.
(OpaqueJSClassContextData::OpaqueJSClassContextData): Use adoptPtr when
allocating. Use OwnPtr when adding. Removed unneeded code to set
staticValues and staticFunctions to 0. Removed unneeded destructor.
(OpaqueJSClass::staticValues): Added get call. Also removed unneeded local.
(OpaqueJSClass::staticFunctions): Ditto.
(OpaqueJSClass::prototype): Added use of adoptPtr.

  • API/JSClassRef.h: Made the static values and static functions tables

use OwnPtr for the entries. Also used OwnPtr for the pointers to the
tables themselves. Also removed ~OpaqueJSClassContextData(), letting
the compiler generate it.

File:
1 edited

Legend:

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

    r83385 r102065  
    6060};
    6161
    62 typedef HashMap<RefPtr<StringImpl>, StaticValueEntry*> OpaqueJSClassStaticValuesTable;
    63 typedef HashMap<RefPtr<StringImpl>, StaticFunctionEntry*> OpaqueJSClassStaticFunctionsTable;
     62typedef HashMap<RefPtr<StringImpl>, OwnPtr<StaticValueEntry> > OpaqueJSClassStaticValuesTable;
     63typedef HashMap<RefPtr<StringImpl>, OwnPtr<StaticFunctionEntry> > OpaqueJSClassStaticFunctionsTable;
    6464
    6565struct OpaqueJSClass;
     
    7171public:
    7272    OpaqueJSClassContextData(JSC::JSGlobalData&, OpaqueJSClass*);
    73     ~OpaqueJSClassContextData();
    7473
    7574    // It is necessary to keep OpaqueJSClass alive because of the following rare scenario:
     
    8180    RefPtr<OpaqueJSClass> m_class;
    8281
    83     OpaqueJSClassStaticValuesTable* staticValues;
    84     OpaqueJSClassStaticFunctionsTable* staticFunctions;
     82    OwnPtr<OpaqueJSClassStaticValuesTable> staticValues;
     83    OwnPtr<OpaqueJSClassStaticFunctionsTable> staticFunctions;
    8584    JSC::Weak<JSC::JSObject> cachedPrototype;
    8685};
     
    122121    // UStrings in these data members should not be put into any IdentifierTable.
    123122    JSC::UString m_className;
    124     OpaqueJSClassStaticValuesTable* m_staticValues;
    125     OpaqueJSClassStaticFunctionsTable* m_staticFunctions;
     123    OwnPtr<OpaqueJSClassStaticValuesTable> m_staticValues;
     124    OwnPtr<OpaqueJSClassStaticFunctionsTable> m_staticFunctions;
    126125};
    127126
Note: See TracChangeset for help on using the changeset viewer.