Diff
Modified: trunk/Source/WebCore/ChangeLog (164637 => 164638)
--- trunk/Source/WebCore/ChangeLog 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/ChangeLog 2014-02-25 08:47:50 UTC (rev 164638)
@@ -1,3 +1,48 @@
+2014-02-25 Zan Dobersek <[email protected]>
+
+ Move to using std::unique_ptr for Element, Node and related classes
+ https://bugs.webkit.org/show_bug.cgi?id=129058
+
+ Reviewed by Anders Carlsson.
+
+ Replace uses of OwnPtr and PassOwnPtr in Element, Node and the related
+ classes with std::unique_ptr and move semantics.
+
+ * dom/ContainerNode.h:
+ (WebCore::ChildNodesLazySnapshot::takeSnapshot):
+ (WebCore::ChildNodesLazySnapshot::hasSnapshot):
+ * dom/Element.cpp:
+ (WebCore::ensureAttrNodeListForElement):
+ (WebCore::Element::attributes):
+ * dom/ElementIteratorAssertions.h:
+ (WebCore::ElementIteratorAssertions::ElementIteratorAssertions):
+ * dom/ElementRareData.h:
+ (WebCore::ElementRareData::setAttributeMap):
+ * dom/MutationObserverRegistration.cpp:
+ (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
+ (WebCore::MutationObserverRegistration::clearTransientRegistrations):
+ (WebCore::MutationObserverRegistration::addRegistrationNodesToSet):
+ * dom/MutationObserverRegistration.h:
+ * dom/NamedNodeMap.h:
+ (WebCore::NamedNodeMap::NamedNodeMap):
+ * dom/Node.cpp:
+ (WebCore::Node::ensureRareData):
+ (WebCore::Node::didMoveToNewDocument):
+ (WebCore::Node::ensureEventTargetData):
+ (WebCore::Node::mutationObserverRegistry):
+ (WebCore::Node::registerMutationObserver):
+ (WebCore::Node::unregisterMutationObserver):
+ (WebCore::Node::notifyMutationObserversNodeWillDetach):
+ * dom/Node.h:
+ * dom/NodeRareData.h:
+ (WebCore::NodeListsNodeData::NodeListsNodeData):
+ (WebCore::NodeRareData::NodeRareData):
+ (WebCore::NodeRareData::clearNodeLists):
+ (WebCore::NodeRareData::ensureNodeLists):
+ (WebCore::NodeRareData::ensureMutationObserverData):
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::rebuildPresentationAttributeStyle):
+
2014-02-25 Andreas Kling <[email protected]>
Prune dead code for Web Inspector memory instrumentation.
Modified: trunk/Source/WebCore/dom/ContainerNode.h (164637 => 164638)
--- trunk/Source/WebCore/dom/ContainerNode.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/ContainerNode.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -26,8 +26,7 @@
#include "ExceptionCodePlaceholder.h"
#include "Node.h"
-
-#include <wtf/OwnPtr.h>
+#include <memory>
#include <wtf/Vector.h>
namespace WebCore {
@@ -288,7 +287,7 @@
{
if (hasSnapshot())
return;
- m_childNodes = adoptPtr(new Vector<RefPtr<Node>>());
+ m_childNodes = std::make_unique<Vector<RefPtr<Node>>>();
Node* node = m_currentNode.get();
while (node) {
m_childNodes->append(node);
@@ -297,7 +296,7 @@
}
ChildNodesLazySnapshot* nextSnapshot() { return m_nextSnapshot; }
- bool hasSnapshot() { return !!m_childNodes.get(); }
+ bool hasSnapshot() { return !!m_childNodes; }
static void takeChildNodesLazySnapshot()
{
@@ -313,7 +312,7 @@
RefPtr<Node> m_currentNode;
unsigned m_currentIndex;
- OwnPtr<Vector<RefPtr<Node>>> m_childNodes; // Lazily instantiated.
+ std::unique_ptr<Vector<RefPtr<Node>>> m_childNodes; // Lazily instantiated.
ChildNodesLazySnapshot* m_nextSnapshot;
};
Modified: trunk/Source/WebCore/dom/Element.cpp (164637 => 164638)
--- trunk/Source/WebCore/dom/Element.cpp 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/Element.cpp 2014-02-25 08:47:50 UTC (rev 164638)
@@ -78,6 +78,7 @@
#include "XMLNSNames.h"
#include "XMLNames.h"
#include "htmlediting.h"
+#include <memory>
#include <wtf/BitVector.h>
#include <wtf/CurrentTime.h>
#include <wtf/text/CString.h>
@@ -93,7 +94,7 @@
}
typedef Vector<RefPtr<Attr>> AttrNodeList;
-typedef HashMap<Element*, OwnPtr<AttrNodeList>> AttrNodeListMap;
+typedef HashMap<Element*, std::unique_ptr<AttrNodeList>> AttrNodeListMap;
static AttrNodeListMap& attrNodeListMap()
{
@@ -117,7 +118,7 @@
}
ASSERT(!attrNodeListMap().contains(element));
element->setHasSyntheticAttrChildNodes(true);
- AttrNodeListMap::AddResult result = attrNodeListMap().add(element, adoptPtr(new AttrNodeList));
+ AttrNodeListMap::AddResult result = attrNodeListMap().add(element, std::make_unique<AttrNodeList>());
return *result.iterator->value;
}
@@ -351,7 +352,7 @@
if (NamedNodeMap* attributeMap = rareData.attributeMap())
return attributeMap;
- rareData.setAttributeMap(NamedNodeMap::create(const_cast<Element&>(*this)));
+ rareData.setAttributeMap(std::make_unique<NamedNodeMap>(const_cast<Element&>(*this)));
return rareData.attributeMap();
}
Modified: trunk/Source/WebCore/dom/ElementIteratorAssertions.h (164637 => 164638)
--- trunk/Source/WebCore/dom/ElementIteratorAssertions.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/ElementIteratorAssertions.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -28,6 +28,7 @@
#include "Document.h"
#include "Element.h"
+#include <memory>
namespace WebCore {
@@ -41,7 +42,7 @@
private:
const Document* m_document;
uint64_t m_initialDOMTreeVersion;
- OwnPtr<NoEventDispatchAssertion> m_noEventDispatchAssertion;
+ std::unique_ptr<NoEventDispatchAssertion> m_noEventDispatchAssertion;
};
inline ElementIteratorAssertions::ElementIteratorAssertions()
@@ -53,7 +54,7 @@
inline ElementIteratorAssertions::ElementIteratorAssertions(const Element* first)
: m_document(first ? &first->document() : nullptr)
, m_initialDOMTreeVersion(m_document ? m_document->domTreeVersion() : 0)
- , m_noEventDispatchAssertion(m_document ? adoptPtr(new NoEventDispatchAssertion) : nullptr)
+ , m_noEventDispatchAssertion(m_document ? std::make_unique<NoEventDispatchAssertion>() : nullptr)
{
}
Modified: trunk/Source/WebCore/dom/ElementRareData.h (164637 => 164638)
--- trunk/Source/WebCore/dom/ElementRareData.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/ElementRareData.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -30,14 +30,13 @@
#include "RenderElement.h"
#include "ShadowRoot.h"
#include "StyleInheritedData.h"
-#include <wtf/OwnPtr.h>
+#include <memory>
namespace WebCore {
class ElementRareData : public NodeRareData {
public:
- static PassOwnPtr<ElementRareData> create(RenderElement* renderer) { return adoptPtr(new ElementRareData(renderer)); }
-
+ explicit ElementRareData(RenderElement*);
~ElementRareData();
void setBeforePseudoElement(PassRefPtr<PseudoElement>);
@@ -93,7 +92,7 @@
void setShadowRoot(PassRefPtr<ShadowRoot> shadowRoot) { m_shadowRoot = shadowRoot; }
NamedNodeMap* attributeMap() const { return m_attributeMap.get(); }
- void setAttributeMap(PassOwnPtr<NamedNodeMap> attributeMap) { m_attributeMap = attributeMap; }
+ void setAttributeMap(std::unique_ptr<NamedNodeMap> attributeMap) { m_attributeMap = std::move(attributeMap); }
RenderStyle* computedStyle() const { return m_computedStyle.get(); }
void setComputedStyle(PassRef<RenderStyle> computedStyle) { m_computedStyle = std::move(computedStyle); }
@@ -150,12 +149,11 @@
std::unique_ptr<DatasetDOMStringMap> m_dataset;
std::unique_ptr<ClassList> m_classList;
RefPtr<ShadowRoot> m_shadowRoot;
- OwnPtr<NamedNodeMap> m_attributeMap;
+ std::unique_ptr<NamedNodeMap> m_attributeMap;
RefPtr<PseudoElement> m_beforePseudoElement;
RefPtr<PseudoElement> m_afterPseudoElement;
- explicit ElementRareData(RenderElement*);
void releasePseudoElement(PseudoElement*);
};
Modified: trunk/Source/WebCore/dom/MutationObserverRegistration.cpp (164637 => 164638)
--- trunk/Source/WebCore/dom/MutationObserverRegistration.cpp 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/MutationObserverRegistration.cpp 2014-02-25 08:47:50 UTC (rev 164638)
@@ -36,11 +36,6 @@
namespace WebCore {
-PassOwnPtr<MutationObserverRegistration> MutationObserverRegistration::create(PassRefPtr<MutationObserver> observer, Node* registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
-{
- return adoptPtr(new MutationObserverRegistration(observer, registrationNode, options, attributeFilter));
-}
-
MutationObserverRegistration::MutationObserverRegistration(PassRefPtr<MutationObserver> observer, Node* registrationNode, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
: m_observer(observer)
, m_registrationNode(registrationNode)
@@ -72,7 +67,7 @@
m_observer->setHasTransientRegistration();
if (!m_transientRegistrationNodes) {
- m_transientRegistrationNodes = adoptPtr(new NodeHashSet);
+ m_transientRegistrationNodes = std::make_unique<NodeHashSet>();
ASSERT(!m_registrationNodeKeepAlive);
m_registrationNodeKeepAlive = m_registrationNode; // Balanced in clearTransientRegistrations.
@@ -87,10 +82,10 @@
return;
}
- for (NodeHashSet::iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)
- (*iter)->unregisterTransientMutationObserver(this);
+ for (auto& iter : *m_transientRegistrationNodes)
+ iter->unregisterTransientMutationObserver(this);
- m_transientRegistrationNodes.clear();
+ m_transientRegistrationNodes = nullptr;
ASSERT(m_registrationNodeKeepAlive);
m_registrationNodeKeepAlive = 0; // Balanced in observeSubtreeNodeWillDetach.
@@ -126,8 +121,8 @@
nodes.add(m_registrationNode);
if (!m_transientRegistrationNodes)
return;
- for (NodeHashSet::const_iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)
- nodes.add(iter->get());
+ for (auto& iter : *m_transientRegistrationNodes)
+ nodes.add(iter.get());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/MutationObserverRegistration.h (164637 => 164638)
--- trunk/Source/WebCore/dom/MutationObserverRegistration.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/MutationObserverRegistration.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -32,6 +32,7 @@
#define MutationObserverRegistration_h
#include "MutationObserver.h"
+#include <memory>
#include <wtf/HashSet.h>
#include <wtf/text/AtomicString.h>
#include <wtf/text/AtomicStringHash.h>
@@ -42,7 +43,7 @@
class MutationObserverRegistration {
public:
- static PassOwnPtr<MutationObserverRegistration> create(PassRefPtr<MutationObserver>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
+ MutationObserverRegistration(PassRefPtr<MutationObserver>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
~MutationObserverRegistration();
void resetObservation(MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
@@ -61,13 +62,11 @@
void addRegistrationNodesToSet(HashSet<Node*>&) const;
private:
- MutationObserverRegistration(PassRefPtr<MutationObserver>, Node*, MutationObserverOptions, const HashSet<AtomicString>& attributeFilter);
-
RefPtr<MutationObserver> m_observer;
Node* m_registrationNode;
RefPtr<Node> m_registrationNodeKeepAlive;
typedef HashSet<RefPtr<Node>> NodeHashSet;
- OwnPtr<NodeHashSet> m_transientRegistrationNodes;
+ std::unique_ptr<NodeHashSet> m_transientRegistrationNodes;
MutationObserverOptions m_options;
HashSet<AtomicString> m_attributeFilter;
Modified: trunk/Source/WebCore/dom/NamedNodeMap.h (164637 => 164638)
--- trunk/Source/WebCore/dom/NamedNodeMap.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/NamedNodeMap.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -26,7 +26,6 @@
#define NamedNodeMap_h
#include "ScriptWrappable.h"
-#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/text/AtomicString.h>
@@ -41,9 +40,10 @@
WTF_MAKE_FAST_ALLOCATED;
friend class Element;
public:
- static PassOwnPtr<NamedNodeMap> create(Element& element)
+ explicit NamedNodeMap(Element& element)
+ : m_element(element)
{
- return adoptPtr(new NamedNodeMap(element));
+ // Only supports NamedNodeMaps with Element associated, DocumentType.entities and DocumentType.notations are not supported yet.
}
void ref();
@@ -67,12 +67,6 @@
Element* element() const { return &m_element; }
private:
- explicit NamedNodeMap(Element& element)
- : m_element(element)
- {
- // Only supports NamedNodeMaps with Element associated, DocumentType.entities and DocumentType.notations are not supported yet.
- }
-
Element& m_element;
};
Modified: trunk/Source/WebCore/dom/Node.cpp (164637 => 164638)
--- trunk/Source/WebCore/dom/Node.cpp 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/Node.cpp 2014-02-25 08:47:50 UTC (rev 164638)
@@ -339,9 +339,9 @@
NodeRareData* data;
if (isElementNode())
- data = ""
+ data = "" ElementRareData(toRenderElement(m_data.m_renderer));
else
- data = ""
+ data = "" NodeRareData(m_data.m_renderer);
ASSERT(data);
m_data.m_rareData = data;
@@ -1766,7 +1766,7 @@
}
}
- if (Vector<OwnPtr<MutationObserverRegistration>>* registry = mutationObserverRegistry()) {
+ if (Vector<std::unique_ptr<MutationObserverRegistration>>* registry = mutationObserverRegistry()) {
for (size_t i = 0; i < registry->size(); ++i) {
document().addMutationObserverTypes(registry->at(i)->mutationTypes());
}
@@ -1863,7 +1863,7 @@
return tryRemoveEventListener(this, eventType, listener, useCapture);
}
-typedef HashMap<Node*, OwnPtr<EventTargetData>> EventTargetDataMap;
+typedef HashMap<Node*, std::unique_ptr<EventTargetData>> EventTargetDataMap;
static EventTargetDataMap& eventTargetDataMap()
{
@@ -1882,7 +1882,7 @@
return *eventTargetDataMap().get(this);
setHasEventTargetData(true);
EventTargetData* data = "" EventTargetData;
- eventTargetDataMap().set(this, adoptPtr(data));
+ eventTargetDataMap().set(this, std::unique_ptr<EventTargetData>(data));
return *data;
}
@@ -1891,7 +1891,7 @@
eventTargetDataMap().remove(this);
}
-Vector<OwnPtr<MutationObserverRegistration>>* Node::mutationObserverRegistry()
+Vector<std::unique_ptr<MutationObserverRegistration>>* Node::mutationObserverRegistry()
{
if (!hasRareData())
return 0;
@@ -1941,7 +1941,7 @@
void Node::registerMutationObserver(MutationObserver* observer, MutationObserverOptions options, const HashSet<AtomicString>& attributeFilter)
{
MutationObserverRegistration* registration = 0;
- Vector<OwnPtr<MutationObserverRegistration>>& registry = ensureRareData().ensureMutationObserverData().registry;
+ Vector<std::unique_ptr<MutationObserverRegistration>>& registry = ensureRareData().ensureMutationObserverData().registry;
for (size_t i = 0; i < registry.size(); ++i) {
if (registry[i]->observer() == observer) {
registration = registry[i].get();
@@ -1950,7 +1950,7 @@
}
if (!registration) {
- registry.append(MutationObserverRegistration::create(observer, this, options, attributeFilter));
+ registry.append(std::make_unique<MutationObserverRegistration>(observer, this, options, attributeFilter));
registration = registry.last().get();
}
@@ -1959,17 +1959,22 @@
void Node::unregisterMutationObserver(MutationObserverRegistration* registration)
{
- Vector<OwnPtr<MutationObserverRegistration>>* registry = mutationObserverRegistry();
+ Vector<std::unique_ptr<MutationObserverRegistration>>* registry = mutationObserverRegistry();
ASSERT(registry);
if (!registry)
return;
- size_t index = registry->find(registration);
- ASSERT(index != notFound);
- if (index == notFound)
- return;
+ size_t index = 0;
+ for (const auto& storedRegistration : *registry) {
+ if (storedRegistration.get() == registration) {
+ registry->remove(index);
+ return;
+ }
- registry->remove(index);
+ index++;
+ }
+
+ ASSERT_NOT_REACHED();
}
void Node::registerTransientMutationObserver(MutationObserverRegistration* registration)
@@ -1994,7 +1999,7 @@
return;
for (Node* node = parentNode(); node; node = node->parentNode()) {
- if (Vector<OwnPtr<MutationObserverRegistration>>* registry = node->mutationObserverRegistry()) {
+ if (Vector<std::unique_ptr<MutationObserverRegistration>>* registry = node->mutationObserverRegistry()) {
const size_t size = registry->size();
for (size_t i = 0; i < size; ++i)
registry->at(i)->observedSubtreeNodeWillDetach(this);
Modified: trunk/Source/WebCore/dom/Node.h (164637 => 164638)
--- trunk/Source/WebCore/dom/Node.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/Node.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -35,6 +35,7 @@
#include "SimulatedClickOptions.h"
#include "TreeScope.h"
#include "TreeShared.h"
+#include <memory>
#include <wtf/Forward.h>
#include <wtf/ListHashSet.h>
#include <wtf/text/AtomicString.h>
@@ -674,7 +675,7 @@
void trackForDebugging();
- Vector<OwnPtr<MutationObserverRegistration>>* mutationObserverRegistry();
+ Vector<std::unique_ptr<MutationObserverRegistration>>* mutationObserverRegistry();
HashSet<MutationObserverRegistration*>* transientMutationObserverRegistry();
mutable uint32_t m_nodeFlags;
Modified: trunk/Source/WebCore/dom/NodeRareData.h (164637 => 164638)
--- trunk/Source/WebCore/dom/NodeRareData.h 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/NodeRareData.h 2014-02-25 08:47:50 UTC (rev 164638)
@@ -36,9 +36,8 @@
#if ENABLE(VIDEO_TRACK)
#include "TextTrack.h"
#endif
+#include <memory>
#include <wtf/HashSet.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
#include <wtf/text/AtomicString.h>
#include <wtf/text/StringHash.h>
@@ -51,6 +50,11 @@
class NodeListsNodeData {
WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
public:
+ NodeListsNodeData()
+ : m_childNodeList(nullptr)
+ , m_emptyChildNodeList(nullptr)
+ { }
+
void clearChildNodeListCache()
{
if (m_childNodeList)
@@ -207,11 +211,6 @@
m_cachedCollections.remove(namedCollectionKey(collection->type(), name));
}
- static PassOwnPtr<NodeListsNodeData> create()
- {
- return adoptPtr(new NodeListsNodeData);
- }
-
void invalidateCaches(const QualifiedName* attrName = 0);
bool isEmpty() const
{
@@ -256,11 +255,6 @@
}
private:
- NodeListsNodeData()
- : m_childNodeList(nullptr)
- , m_emptyChildNodeList(nullptr)
- { }
-
std::pair<unsigned char, AtomicString> namedCollectionKey(CollectionType type, const AtomicString& name)
{
return std::pair<unsigned char, AtomicString>(type, name);
@@ -286,26 +280,26 @@
class NodeMutationObserverData {
WTF_MAKE_NONCOPYABLE(NodeMutationObserverData); WTF_MAKE_FAST_ALLOCATED;
public:
- Vector<OwnPtr<MutationObserverRegistration>> registry;
+ NodeMutationObserverData() = default;
+ Vector<std::unique_ptr<MutationObserverRegistration>> registry;
HashSet<MutationObserverRegistration*> transientRegistry;
-
- static PassOwnPtr<NodeMutationObserverData> create() { return adoptPtr(new NodeMutationObserverData); }
-
-private:
- NodeMutationObserverData() { }
};
class NodeRareData : public NodeRareDataBase {
WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<NodeRareData> create(RenderObject* renderer) { return adoptPtr(new NodeRareData(renderer)); }
+ NodeRareData(RenderObject* renderer)
+ : NodeRareDataBase(renderer)
+ , m_connectedFrameCount(0)
+ { }
- void clearNodeLists() { m_nodeLists.clear(); }
+
+ void clearNodeLists() { m_nodeLists = nullptr; }
NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); }
NodeListsNodeData& ensureNodeLists()
{
if (!m_nodeLists)
- m_nodeLists = NodeListsNodeData::create();
+ m_nodeLists = std::make_unique<NodeListsNodeData>();
return *m_nodeLists;
}
@@ -313,7 +307,7 @@
NodeMutationObserverData& ensureMutationObserverData()
{
if (!m_mutationObserverData)
- m_mutationObserverData = NodeMutationObserverData::create();
+ m_mutationObserverData = std::make_unique<NodeMutationObserverData>();
return *m_mutationObserverData;
}
@@ -329,17 +323,11 @@
m_connectedFrameCount -= amount;
}
-protected:
- NodeRareData(RenderObject* renderer)
- : NodeRareDataBase(renderer)
- , m_connectedFrameCount(0)
- { }
-
private:
unsigned m_connectedFrameCount : 10; // Must fit Page::maxNumberOfFrames.
- OwnPtr<NodeListsNodeData> m_nodeLists;
- OwnPtr<NodeMutationObserverData> m_mutationObserverData;
+ std::unique_ptr<NodeListsNodeData> m_nodeLists;
+ std::unique_ptr<NodeMutationObserverData> m_mutationObserverData;
};
inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(Node& ownerNode)
Modified: trunk/Source/WebCore/dom/StyledElement.cpp (164637 => 164638)
--- trunk/Source/WebCore/dom/StyledElement.cpp 2014-02-25 08:19:25 UTC (rev 164637)
+++ trunk/Source/WebCore/dom/StyledElement.cpp 2014-02-25 08:47:50 UTC (rev 164638)
@@ -58,7 +58,7 @@
RefPtr<StyleProperties> value;
};
-typedef HashMap<unsigned, OwnPtr<PresentationAttributeCacheEntry>, AlreadyHashed> PresentationAttributeCache;
+typedef HashMap<unsigned, std::unique_ptr<PresentationAttributeCacheEntry>, AlreadyHashed> PresentationAttributeCache;
static bool operator!=(const PresentationAttributeCacheKey& a, const PresentationAttributeCacheKey& b)
{
@@ -346,7 +346,7 @@
if (!cacheHash || cacheIterator->value)
return;
- OwnPtr<PresentationAttributeCacheEntry> newEntry = adoptPtr(new PresentationAttributeCacheEntry);
+ auto newEntry = std::make_unique<PresentationAttributeCacheEntry>();
newEntry->key = cacheKey;
newEntry->value = style.release();
@@ -354,9 +354,9 @@
if (presentationAttributeCache().size() > presentationAttributeCacheMaximumSize) {
// Start building from scratch if the cache ever gets big.
presentationAttributeCache().clear();
- presentationAttributeCache().set(cacheHash, newEntry.release());
+ presentationAttributeCache().set(cacheHash, std::move(newEntry));
} else
- cacheIterator->value = newEntry.release();
+ cacheIterator->value = std::move(newEntry);
}
void StyledElement::addPropertyToPresentationAttributeStyle(MutableStyleProperties& style, CSSPropertyID propertyID, CSSValueID identifier)