Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: Source/core/dom/Attr.h

Issue 317203005: Oilpan: Temporary fix for leaks through mapping from element to attribute node list. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Maintain Attr value when Element is deent dies. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const QualifiedName qualifiedName() const; 57 const QualifiedName qualifiedName() const;
58 58
59 void attachToElement(Element*, const AtomicString&); 59 void attachToElement(Element*, const AtomicString&);
60 void detachFromElementWithValue(const AtomicString&); 60 void detachFromElementWithValue(const AtomicString&);
61 61
62 virtual const AtomicString& localName() const OVERRIDE { return m_name.local Name(); } 62 virtual const AtomicString& localName() const OVERRIDE { return m_name.local Name(); }
63 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na mespaceURI(); } 63 virtual const AtomicString& namespaceURI() const OVERRIDE { return m_name.na mespaceURI(); }
64 const AtomicString& prefix() const { return m_name.prefix(); } 64 const AtomicString& prefix() const { return m_name.prefix(); }
65 65
66 virtual void trace(Visitor*) OVERRIDE; 66 virtual void trace(Visitor*) OVERRIDE;
67 void clearWeakMembers(Visitor*);
67 68
68 private: 69 private:
69 Attr(Element&, const QualifiedName&); 70 Attr(Element&, const QualifiedName&);
70 Attr(Document&, const QualifiedName&, const AtomicString& value); 71 Attr(Document&, const QualifiedName&, const AtomicString& value);
71 72
72 void createTextChild(); 73 void createTextChild();
73 74
74 void setValueInternal(const AtomicString&); 75 void setValueInternal(const AtomicString&);
75 76
76 virtual String nodeName() const OVERRIDE { return name(); } 77 virtual String nodeName() const OVERRIDE { return name(); }
77 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; } 78 virtual NodeType nodeType() const OVERRIDE { return ATTRIBUTE_NODE; }
78 79
79 virtual String nodeValue() const OVERRIDE { return value(); } 80 virtual String nodeValue() const OVERRIDE { return value(); }
80 virtual void setNodeValue(const String&) OVERRIDE; 81 virtual void setNodeValue(const String&) OVERRIDE;
81 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) OVERRIDE; 82 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) OVERRIDE;
82 83
83 virtual bool isAttributeNode() const OVERRIDE { return true; } 84 virtual bool isAttributeNode() const OVERRIDE { return true; }
84 virtual bool childTypeAllowed(NodeType) const OVERRIDE; 85 virtual bool childTypeAllowed(NodeType) const OVERRIDE;
85 86
86 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; 87 virtual void childrenChanged(bool changedByParser = false, Node* beforeChang e = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
87 88
88 Attribute& elementAttribute(); 89 Attribute& elementAttribute();
89 90
90 // Attr wraps either an element/name, or a name/value pair (when it's a stan dalone Node.) 91 // Attr wraps either an element/name, or a name/value pair (when it's a stan dalone Node.)
91 // Note that m_name is always set, but m_element/m_standaloneValue may be nu ll. 92 // Note that m_name is always set, but m_element/m_standaloneValue may be nu ll.
92 RawPtrWillBeMember<Element> m_element; 93 //
94 // FIXME: Oilpan: m_element should be a Member. However, because of the
95 // current semantics of weak maps, we have to make it a WeakMember in order
96 // to not leak through the attrNodeListMap in Element.cpp. Once the semantic s
97 // of weak maps has changed we should make this a Member and remove the cust om
98 // weak processing.
99 RawPtrWillBeWeakMember<Element> m_element;
93 QualifiedName m_name; 100 QualifiedName m_name;
94 // Holds the value if it is a standalone Node, or the local name of the 101 // Holds the value if it is a standalone Node, or the local name of the
95 // attribute it is attached to on an Element. The latter may (letter case) 102 // attribute it is attached to on an Element. The latter may (letter case)
96 // differ from m_name's local name. As these two modes are non-overlapping, 103 // differ from m_name's local name. As these two modes are non-overlapping,
97 // use a single field. 104 // use a single field.
98 AtomicString m_standaloneValueOrAttachedLocalName; 105 AtomicString m_standaloneValueOrAttachedLocalName;
99 unsigned m_ignoreChildrenChanged; 106 unsigned m_ignoreChildrenChanged;
100 }; 107 };
101 108
102 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode()); 109 DEFINE_NODE_TYPE_CASTS(Attr, isAttributeNode());
103 110
104 } // namespace WebCore 111 } // namespace WebCore
105 112
106 #endif // Attr_h 113 #endif // Attr_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Attr/script-tests/access-after-element-destruction.js ('k') | Source/core/dom/Attr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698