Commit bfcc8784 authored by andersca@apple.com's avatar andersca@apple.com

Stop using deleteAllValues in CClass

https://bugs.webkit.org/show_bug.cgi?id=120376

Reviewed by Andreas Kling.

* bridge/c/c_class.cpp:
(JSC::Bindings::CClass::CClass):
(JSC::Bindings::CClass::~CClass):
(JSC::Bindings::CClass::methodNamed):
(JSC::Bindings::CClass::fieldNamed):
* bridge/c/c_class.h:
* bridge/jsc/BridgeJSC.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154708 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1190b0b7
2013-08-27 Anders Carlsson <andersca@apple.com>
Stop using deleteAllValues in CClass
https://bugs.webkit.org/show_bug.cgi?id=120376
Reviewed by Andreas Kling.
* bridge/c/c_class.cpp:
(JSC::Bindings::CClass::CClass):
(JSC::Bindings::CClass::~CClass):
(JSC::Bindings::CClass::methodNamed):
(JSC::Bindings::CClass::fieldNamed):
* bridge/c/c_class.h:
* bridge/jsc/BridgeJSC.h:
2013-08-27 Benjamin Poulain <benjamin@webkit.org>
Clean ClassList and DOMSettableTokenList
......@@ -41,16 +41,13 @@ namespace JSC { namespace Bindings {
CClass::CClass(NPClass* aClass)
{
_isa = aClass;
m_isa = aClass;
}
CClass::~CClass()
{
deleteAllValues(_methods);
_methods.clear();
deleteAllValues(_fields);
_fields.clear();
m_methods.clear();
m_fields.clear();
}
typedef HashMap<NPClass*, CClass*> ClassesByIsAMap;
......@@ -74,16 +71,16 @@ Method* CClass::methodNamed(PropertyName propertyName, Instance* instance) const
{
String name(propertyName.publicName());
if (Method* method = _methods.get(name.impl()))
if (Method* method = m_methods.get(name.impl()))
return method;
NPIdentifier ident = _NPN_GetStringIdentifier(name.ascii().data());
const CInstance* inst = static_cast<const CInstance*>(instance);
NPObject* obj = inst->getObject();
if (_isa->hasMethod && _isa->hasMethod(obj, ident)){
Method* method = new CMethod(ident); // deleted in the CClass destructor
_methods.set(name.impl(), method);
return method;
if (m_isa->hasMethod && m_isa->hasMethod(obj, ident)) {
OwnPtr<Method> method = adoptPtr(new CMethod(ident));
m_methods.set(name.impl(), method.release());
return method.get();
}
return 0;
......@@ -93,18 +90,18 @@ Field* CClass::fieldNamed(PropertyName propertyName, Instance* instance) const
{
String name(propertyName.publicName());
Field* aField = _fields.get(name.impl());
if (aField)
return aField;
if (Field* field = m_fields.get(name.impl()))
return field;
NPIdentifier ident = _NPN_GetStringIdentifier(name.ascii().data());
const CInstance* inst = static_cast<const CInstance*>(instance);
NPObject* obj = inst->getObject();
if (_isa->hasProperty && _isa->hasProperty(obj, ident)){
aField = new CField(ident); // deleted in the CClass destructor
_fields.set(name.impl(), aField);
if (m_isa->hasProperty && m_isa->hasProperty(obj, ident)) {
OwnPtr<Field> field = adoptPtr(new CField(ident));
m_fields.set(name.impl(), field.release());
}
return aField;
return 0;
}
} } // namespace JSC::Bindings
......
......@@ -47,9 +47,9 @@ public:
virtual Field* fieldNamed(PropertyName, Instance*) const;
private:
NPClass* _isa;
mutable MethodMap _methods;
mutable FieldMap _fields;
NPClass* m_isa;
mutable HashMap<RefPtr<StringImpl>, OwnPtr<Method>> m_methods;
mutable HashMap<RefPtr<StringImpl>, OwnPtr<Field>> m_fields;
};
} // namespace Bindings
......
......@@ -134,9 +134,6 @@ protected:
const char* signatureForParameters(const ArgList&);
typedef HashMap<RefPtr<StringImpl>, Method*> MethodMap;
typedef HashMap<RefPtr<StringImpl>, Field*> FieldMap;
} // namespace Bindings
} // namespace JSC
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment