- Revision
- 141300
- Author
- [email protected]
- Date
- 2013-01-30 12:51:07 -0800 (Wed, 30 Jan 2013)
Log Message
Do not convert to String->AtomicString for NamedNodeMap
https://bugs.webkit.org/show_bug.cgi?id=108289
Reviewed by Kentaro Hara.
NamedNodeMap's API was taking a WTF::String. Internally, attribute
names are AtomicString.
The conversions String->AtomicString was causing an additional ref-deref
for the JS/V8 bindings. And could cause an additional memory allocation for the Objective-C
bindings.
This patch changes the API to use AtomicString, and update the custom bindings accordingly.
* bindings/js/JSNamedNodeMapCustom.cpp:
(WebCore::JSNamedNodeMap::canGetItemsForName):
(WebCore::JSNamedNodeMap::nameGetter):
* bindings/v8/custom/V8NamedNodeMapCustom.cpp:
(WebCore::V8NamedNodeMap::namedPropertyGetter):
* dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::getNamedItem):
(WebCore::NamedNodeMap::getNamedItemNS):
(WebCore::NamedNodeMap::removeNamedItem):
(WebCore::NamedNodeMap::removeNamedItemNS):
* dom/NamedNodeMap.h:
(NamedNodeMap):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (141299 => 141300)
--- trunk/Source/WebCore/ChangeLog 2013-01-30 20:47:01 UTC (rev 141299)
+++ trunk/Source/WebCore/ChangeLog 2013-01-30 20:51:07 UTC (rev 141300)
@@ -1,3 +1,32 @@
+2013-01-30 Benjamin Poulain <[email protected]>
+
+ Do not convert to String->AtomicString for NamedNodeMap
+ https://bugs.webkit.org/show_bug.cgi?id=108289
+
+ Reviewed by Kentaro Hara.
+
+ NamedNodeMap's API was taking a WTF::String. Internally, attribute
+ names are AtomicString.
+
+ The conversions String->AtomicString was causing an additional ref-deref
+ for the JS/V8 bindings. And could cause an additional memory allocation for the Objective-C
+ bindings.
+
+ This patch changes the API to use AtomicString, and update the custom bindings accordingly.
+
+ * bindings/js/JSNamedNodeMapCustom.cpp:
+ (WebCore::JSNamedNodeMap::canGetItemsForName):
+ (WebCore::JSNamedNodeMap::nameGetter):
+ * bindings/v8/custom/V8NamedNodeMapCustom.cpp:
+ (WebCore::V8NamedNodeMap::namedPropertyGetter):
+ * dom/NamedNodeMap.cpp:
+ (WebCore::NamedNodeMap::getNamedItem):
+ (WebCore::NamedNodeMap::getNamedItemNS):
+ (WebCore::NamedNodeMap::removeNamedItem):
+ (WebCore::NamedNodeMap::removeNamedItemNS):
+ * dom/NamedNodeMap.h:
+ (NamedNodeMap):
+
2013-01-30 Zan Dobersek <[email protected]>
[GTK] http/tests/w3c/webperf/submission/Intel/user-timing/test_user_timing_entry_type.html is failing
Modified: trunk/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp (141299 => 141300)
--- trunk/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp 2013-01-30 20:47:01 UTC (rev 141299)
+++ trunk/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp 2013-01-30 20:51:07 UTC (rev 141300)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,13 +37,13 @@
bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, PropertyName propertyName)
{
- return impl->getNamedItem(propertyNameToString(propertyName));
+ return impl->getNamedItem(propertyNameToAtomicString(propertyName));
}
JSValue JSNamedNodeMap::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
{
JSNamedNodeMap* thisObj = jsCast<JSNamedNodeMap*>(asObject(slotBase));
- return toJS(exec, thisObj->globalObject(), thisObj->impl()->getNamedItem(propertyNameToString(propertyName)));
+ return toJS(exec, thisObj->globalObject(), thisObj->impl()->getNamedItem(propertyNameToAtomicString(propertyName)));
}
void JSNamedNodeMap::visitChildren(JSCell* cell, SlotVisitor& visitor)
Modified: trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp (141299 => 141300)
--- trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp 2013-01-30 20:47:01 UTC (rev 141299)
+++ trunk/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp 2013-01-30 20:51:07 UTC (rev 141300)
@@ -60,7 +60,7 @@
return v8Undefined();
NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder());
- RefPtr<Node> result = imp->getNamedItem(toWebCoreString(name));
+ RefPtr<Node> result = imp->getNamedItem(toWebCoreAtomicString(name));
if (!result)
return v8Undefined();
Modified: trunk/Source/WebCore/dom/NamedNodeMap.cpp (141299 => 141300)
--- trunk/Source/WebCore/dom/NamedNodeMap.cpp 2013-01-30 20:47:01 UTC (rev 141299)
+++ trunk/Source/WebCore/dom/NamedNodeMap.cpp 2013-01-30 20:51:07 UTC (rev 141300)
@@ -3,7 +3,7 @@
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2001 Peter Kelly ([email protected])
* (C) 2001 Dirk Mueller ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
* (C) 2007 Eric Seidel ([email protected])
*
* This library is free software; you can redistribute it and/or
@@ -50,17 +50,17 @@
m_element->deref();
}
-PassRefPtr<Node> NamedNodeMap::getNamedItem(const String& name) const
+PassRefPtr<Node> NamedNodeMap::getNamedItem(const AtomicString& name) const
{
return m_element->getAttributeNode(name);
}
-PassRefPtr<Node> NamedNodeMap::getNamedItemNS(const String& namespaceURI, const String& localName) const
+PassRefPtr<Node> NamedNodeMap::getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const
{
return m_element->getAttributeNodeNS(namespaceURI, localName);
}
-PassRefPtr<Node> NamedNodeMap::removeNamedItem(const String& name, ExceptionCode& ec)
+PassRefPtr<Node> NamedNodeMap::removeNamedItem(const AtomicString& name, ExceptionCode& ec)
{
size_t index = m_element->getAttributeItemIndex(name, shouldIgnoreAttributeCase(m_element));
if (index == notFound) {
@@ -70,7 +70,7 @@
return m_element->detachAttribute(index);
}
-PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode& ec)
+PassRefPtr<Node> NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode& ec)
{
size_t index = m_element->getAttributeItemIndex(QualifiedName(nullAtom, localName, namespaceURI));
if (index == notFound) {
Modified: trunk/Source/WebCore/dom/NamedNodeMap.h (141299 => 141300)
--- trunk/Source/WebCore/dom/NamedNodeMap.h 2013-01-30 20:47:01 UTC (rev 141299)
+++ trunk/Source/WebCore/dom/NamedNodeMap.h 2013-01-30 20:51:07 UTC (rev 141300)
@@ -3,7 +3,7 @@
* (C) 1999 Antti Koivisto ([email protected])
* (C) 2001 Peter Kelly ([email protected])
* (C) 2001 Dirk Mueller ([email protected])
- * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2013 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -28,7 +28,7 @@
#include "ScriptWrappable.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
+#include <wtf/text/AtomicString.h>
namespace WebCore {
@@ -51,11 +51,11 @@
// Public DOM interface.
- PassRefPtr<Node> getNamedItem(const String& name) const;
- PassRefPtr<Node> removeNamedItem(const String& name, ExceptionCode&);
+ PassRefPtr<Node> getNamedItem(const AtomicString&) const;
+ PassRefPtr<Node> removeNamedItem(const AtomicString& name, ExceptionCode&);
- PassRefPtr<Node> getNamedItemNS(const String& namespaceURI, const String& localName) const;
- PassRefPtr<Node> removeNamedItemNS(const String& namespaceURI, const String& localName, ExceptionCode&);
+ PassRefPtr<Node> getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
+ PassRefPtr<Node> removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode&);
PassRefPtr<Node> setNamedItem(Node*, ExceptionCode&);
PassRefPtr<Node> setNamedItemNS(Node*, ExceptionCode&);