Diff
Modified: trunk/ChangeLog (119936 => 119937)
--- trunk/ChangeLog 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/ChangeLog 2012-06-10 17:15:55 UTC (rev 119937)
@@ -1,3 +1,13 @@
+2012-06-10 Darin Adler <[email protected]>
+
+ Remove unneeded callRemovedLastRef function from TreeShared refactoring
+ https://bugs.webkit.org/show_bug.cgi?id=88653
+
+ Reviewed by Sam Weinig.
+
+ * Source/autotools/symbols.filter: Filter removedLastRef instead of
+ callRemovedLastRef.
+
2012-06-09 Sukolsak Sakshuwong <[email protected]>
Add UNDO_MANAGER flag
Modified: trunk/Source/WebCore/ChangeLog (119936 => 119937)
--- trunk/Source/WebCore/ChangeLog 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/ChangeLog 2012-06-10 17:15:55 UTC (rev 119937)
@@ -1,5 +1,51 @@
2012-06-10 Darin Adler <[email protected]>
+ Remove unneeded callRemovedLastRef function from TreeShared refactoring
+ https://bugs.webkit.org/show_bug.cgi?id=88653
+
+ Reviewed by Sam Weinig.
+
+ * WebCore.exp.in: Updated to remove callRemovedLastRef and add removedLastRef.
+
+ * dom/ContainerNode.cpp: Removed callRemovedLastRef, which is no longer
+ needed and also had a bad cast in it.
+
+ * dom/Document.h: Made removedLastRef private and non-virtual and made Node
+ a friend so it can call the private function.
+
+ * dom/Node.cpp:
+ (WebCore::Node::removedLastRef): Moved here. This should not be an inline
+ function. Added comments explaining why it should not be inlined. Also added
+ explicit code to call to Document::removedLastRef, and added a comment why
+ that's the right thing to do here.
+ * dom/Node.h: Inherit from TreeShared<Node, ContainerNode>. Made the
+ removedLastRef function non-virtual and removed it from the header file.
+ Updated TreeShared using statements. Made the TreeShared template class a
+ friend so it can call the private removedLastRef.
+
+ * html/HTMLFormControlElement.h: Updated TreeShared using statements to specify
+ Node instead, which accomplishes the same thing.
+ * html/HTMLObjectElement.h: Ditto.
+
+ * platform/TreeShared.h: Made TreeShared take two template arguments for the
+ node type and the parent node type. Removed the callRemovedLastRef functions and
+ the extra forward declarations it required. Removed the private unused
+ removedLastRef function; not sure why it was left in here at all.
+ (WebCore::TreeShared::deref): Call removedLastRef instead of callRemovedLastRef.
+ (WebCore::TreeShared::setParent): Use ParentNodeType.
+ (WebCore::TreeShared::parent): Ditto.
+ (WebCore::adopted): Updated to have both template arguments.
+
+ * svg/SVGElementInstance.cpp:
+ (WebCore::SVGElementInstance::removedLastRef): Replaced callRemovedLastRef with
+ this. Moved the body out of the header and added a comment explaining why the
+ function should not be inlined.
+ * svg/SVGElementInstance.h: Made removedLastRef non-virtual, non-inline, and
+ private. Made TreeShared a friend so it can call the private removedLastRef.
+ Updated TreeShared using statements.
+
+2012-06-10 Darin Adler <[email protected]>
+
* WebCore.exp.in: Re-sorted and alphabetized the file.
2012-06-10 Balazs Kelemen <[email protected]>
Modified: trunk/Source/WebCore/WebCore.exp.in (119936 => 119937)
--- trunk/Source/WebCore/WebCore.exp.in 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-06-10 17:15:55 UTC (rev 119937)
@@ -1,4 +1,3 @@
-__ZN7WebCore18callRemovedLastRefEPNS_10TreeSharedINS_13ContainerNodeEEE
.objc_class_name_DOMAbstractView
.objc_class_name_DOMAttr
.objc_class_name_DOMCDATASection
@@ -795,6 +794,7 @@
__ZN7WebCore4KURLC1EPK7__CFURL
__ZN7WebCore4KURLC1ERKS0_RKN3WTF6StringE
__ZN7WebCore4Node10renderRectEPb
+__ZN7WebCore4Node14removedLastRefEv
__ZN7WebCore4Node17stopIgnoringLeaksEv
__ZN7WebCore4Node18startIgnoringLeaksEv
__ZN7WebCore4Node19setNeedsStyleRecalcENS_15StyleChangeTypeE
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (119936 => 119937)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2012-06-10 17:15:55 UTC (rev 119937)
@@ -86,11 +86,6 @@
removeAllChildrenInContainer<Node, ContainerNode>(this);
}
-void callRemovedLastRef(TreeShared<ContainerNode>* self)
-{
- static_cast<ContainerNode*>(self)->removedLastRef();
-}
-
void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent)
{
NodeVector children;
Modified: trunk/Source/WebCore/dom/Document.h (119936 => 119937)
--- trunk/Source/WebCore/dom/Document.h 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/dom/Document.h 2012-06-10 17:15:55 UTC (rev 119937)
@@ -220,8 +220,6 @@
}
}
- virtual void removedLastRef();
-
Element* getElementById(const AtomicString& id) const;
virtual bool canContainRangeEndPoint() const { return true; }
@@ -1129,8 +1127,11 @@
void clearXMLVersion() { m_xmlVersion = String(); }
private:
+ friend class Node;
friend class IgnoreDestructiveWriteCountIncrementer;
+ void removedLastRef();
+
void detachParser();
typedef void (*ArgumentsCallback)(const String& keyString, const String& valueString, Document*, void* data);
Modified: trunk/Source/WebCore/dom/Node.cpp (119936 => 119937)
--- trunk/Source/WebCore/dom/Node.cpp 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-06-10 17:15:55 UTC (rev 119937)
@@ -2941,6 +2941,23 @@
it->second->setRootElement(toElement(this));
}
+// It's important not to inline removedLastRef, because we don't want to inline the code to
+// delete a Node at each deref call site.
+void Node::removedLastRef()
+{
+ // An explicit check for Document here is better than a virtual function since it is
+ // faster for non-Document nodes, and because the call to removedLastRef that is inlined
+ // at all deref call sites is smaller if it's a non-virtual function.
+ if (isDocumentNode()) {
+ static_cast<Document*>(this)->removedLastRef();
+ return;
+ }
+#ifndef NDEBUG
+ m_deletionHasBegun = true;
+#endif
+ delete this;
+}
+
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/dom/Node.h (119936 => 119937)
--- trunk/Source/WebCore/dom/Node.h 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/dom/Node.h 2012-06-10 17:15:55 UTC (rev 119937)
@@ -104,7 +104,7 @@
SyntheticStyleChange = 3 << nodeStyleChangeShift
};
-class Node : public EventTarget, public ScriptWrappable, public TreeShared<ContainerNode> {
+class Node : public EventTarget, public ScriptWrappable, public TreeShared<Node, ContainerNode> {
friend class Document;
friend class TreeScope;
friend class TreeScopeAdopter;
@@ -146,13 +146,6 @@
static StyleChange diff(const RenderStyle*, const RenderStyle*, Document*);
virtual ~Node();
- virtual void removedLastRef()
- {
-#ifndef NDEBUG
- m_deletionHasBegun = true;
-#endif
- delete this;
- }
// DOM methods & attributes for Node
@@ -636,8 +629,8 @@
// to event listeners, and prevents DOMActivate events from being sent at all.
virtual bool disabled() const;
- using TreeShared<ContainerNode>::ref;
- using TreeShared<ContainerNode>::deref;
+ using TreeShared<Node, ContainerNode>::ref;
+ using TreeShared<Node, ContainerNode>::deref;
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
@@ -748,6 +741,10 @@
void setHasCustomCallbacks() { setFlag(true, HasCustomCallbacksFlag); }
private:
+ friend class TreeShared<Node, ContainerNode>;
+
+ void removedLastRef();
+
// These API should be only used for a tree scope migration.
// setTreeScope() returns NodeRareData to save extra nodeRareData() invocations on the caller site.
NodeRareData* setTreeScope(TreeScope*);
@@ -783,8 +780,8 @@
// Use Node::parentNode as the consistent way of querying a parent node.
// This method is made private to ensure a compiler error on call sites that
// don't follow this rule.
- using TreeShared<ContainerNode>::parent;
- using TreeShared<ContainerNode>::setParent;
+ using TreeShared<Node, ContainerNode>::parent;
+ using TreeShared<Node, ContainerNode>::setParent;
void trackForDebugging();
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (119936 => 119937)
--- trunk/Source/WebCore/html/HTMLFormControlElement.h 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h 2012-06-10 17:15:55 UTC (rev 119937)
@@ -109,8 +109,8 @@
static HTMLFormControlElement* enclosingFormControlElement(Node*);
- using TreeShared<ContainerNode>::ref;
- using TreeShared<ContainerNode>::deref;
+ using Node::ref;
+ using Node::deref;
protected:
HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*);
Modified: trunk/Source/WebCore/html/HTMLObjectElement.h (119936 => 119937)
--- trunk/Source/WebCore/html/HTMLObjectElement.h 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/html/HTMLObjectElement.h 2012-06-10 17:15:55 UTC (rev 119937)
@@ -58,8 +58,8 @@
bool checkValidity() { return true; }
virtual void setCustomValidity(const String&) OVERRIDE { }
- using TreeShared<ContainerNode>::ref;
- using TreeShared<ContainerNode>::deref;
+ using Node::ref;
+ using Node::deref;
virtual bool canContainRangeEndPoint() const { return useFallbackContent(); }
Modified: trunk/Source/WebCore/platform/TreeShared.h (119936 => 119937)
--- trunk/Source/WebCore/platform/TreeShared.h 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/platform/TreeShared.h 2012-06-10 17:15:55 UTC (rev 119937)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2009, 2010, 2012 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,22 +28,11 @@
namespace WebCore {
#ifndef NDEBUG
-template<typename T> class TreeShared;
-template<typename T> void adopted(TreeShared<T>*);
+template<typename NodeType, typename ParentNodeType> class TreeShared;
+template<typename NodeType, typename ParentNodeType> void adopted(TreeShared<NodeType, ParentNodeType>*);
#endif
-class ContainerNode;
-class SVGElementInstance;
-template<typename T> class TreeShared;
-
-// All classes that inherit TreeShared need to define
-// callRemovedLastRef(TreeShared<T>*). This is necessary
-// to kill all virtual methods from TreeShared, by which
-// we can save 8 byte for a virtual method table pointer.
-void callRemovedLastRef(TreeShared<ContainerNode>*);
-void callRemovedLastRef(TreeShared<SVGElementInstance>*);
-
-template<typename T> class TreeShared {
+template<typename NodeType, typename ParentNodeType> class TreeShared {
WTF_MAKE_NONCOPYABLE(TreeShared);
public:
TreeShared()
@@ -90,7 +79,7 @@
#ifndef NDEBUG
m_inRemovedLastRefFunction = true;
#endif
- callRemovedLastRef(this);
+ static_cast<NodeType*>(this)->removedLastRef();
}
}
@@ -106,13 +95,13 @@
return m_refCount;
}
- void setParent(T* parent)
+ void setParent(ParentNodeType* parent)
{
ASSERT(isMainThread());
m_parent = parent;
}
- T* parent() const
+ ParentNodeType* parent() const
{
ASSERT(isMainThreadOrGCThread());
return m_parent;
@@ -124,15 +113,11 @@
#endif
private:
- // Never called. removedLastRef() must be implemented in all the classes
- // that inherit TreeShared.
- void removedLastRef() { ASSERT(0); }
-
#ifndef NDEBUG
- friend void adopted<>(TreeShared<T>*);
+ friend void adopted<>(TreeShared<NodeType, ParentNodeType>*);
#endif
- T* m_parent;
+ ParentNodeType* m_parent;
int m_refCount;
#ifndef NDEBUG
@@ -142,7 +127,7 @@
#ifndef NDEBUG
-template<typename T> inline void adopted(TreeShared<T>* object)
+template<typename NodeType, typename ParentNodeType> inline void adopted(TreeShared<NodeType, ParentNodeType>* object)
{
if (!object)
return;
Modified: trunk/Source/WebCore/svg/SVGElementInstance.cpp (119936 => 119937)
--- trunk/Source/WebCore/svg/SVGElementInstance.cpp 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/svg/SVGElementInstance.cpp 2012-06-10 17:15:55 UTC (rev 119937)
@@ -72,9 +72,14 @@
m_element = 0;
}
-void callRemovedLastRef(TreeShared<SVGElementInstance>* self)
+// It's important not to inline removedLastRef, because we don't want to inline the code to
+// delete an SVGElementInstance at each deref call site.
+void SVGElementInstance::removedLastRef()
{
- static_cast<SVGElementInstance*>(self)->removedLastRef();
+#ifndef NDEBUG
+ m_deletionHasBegun = true;
+#endif
+ delete this;
}
void SVGElementInstance::detach()
Modified: trunk/Source/WebCore/svg/SVGElementInstance.h (119936 => 119937)
--- trunk/Source/WebCore/svg/SVGElementInstance.h 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebCore/svg/SVGElementInstance.h 2012-06-10 17:15:55 UTC (rev 119937)
@@ -38,8 +38,7 @@
class SVGStyledElement;
// SVGElementInstance mimics Node, but without providing all its functionality
-class SVGElementInstance : public TreeShared<SVGElementInstance>,
- public EventTarget {
+class SVGElementInstance : public TreeShared<SVGElementInstance, SVGElementInstance>, public EventTarget {
public:
static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement)
{
@@ -47,13 +46,6 @@
}
virtual ~SVGElementInstance();
- virtual void removedLastRef()
- {
-#ifndef NDEBUG
- m_deletionHasBegun = true;
-#endif
- delete this;
- };
void setParentOrHostNode(SVGElementInstance* instance) { setParent(instance); }
@@ -105,8 +97,8 @@
static void invalidateAllInstancesOfElement(SVGElement*);
- using TreeShared<SVGElementInstance>::ref;
- using TreeShared<SVGElementInstance>::deref;
+ using TreeShared<SVGElementInstance, SVGElementInstance>::ref;
+ using TreeShared<SVGElementInstance, SVGElementInstance>::deref;
// EventTarget API
DEFINE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort);
@@ -152,10 +144,13 @@
private:
friend class SVGUseElement;
- using TreeShared<SVGElementInstance>::parent;
- using TreeShared<SVGElementInstance>::setParent;
+ friend class TreeShared<SVGElementInstance, SVGElementInstance>;
+ using TreeShared<SVGElementInstance, SVGElementInstance>::parent;
+ using TreeShared<SVGElementInstance, SVGElementInstance>::setParent;
+
SVGElementInstance(SVGUseElement*, SVGUseElement*, PassRefPtr<SVGElement> originalElement);
+ void removedLastRef();
virtual Node* toNode() { return shadowTreeElement(); }
Modified: trunk/Source/WebKit2/ChangeLog (119936 => 119937)
--- trunk/Source/WebKit2/ChangeLog 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebKit2/ChangeLog 2012-06-10 17:15:55 UTC (rev 119937)
@@ -1,3 +1,13 @@
+2012-06-10 Darin Adler <[email protected]>
+
+ Remove unneeded callRemovedLastRef function from TreeShared refactoring
+ https://bugs.webkit.org/show_bug.cgi?id=88653
+
+ Reviewed by Sam Weinig.
+
+ * win/WebKit2.def: Export removedLastRef instead of callRemovedLastRef.
+ * win/WebKit2CFLite.def: Ditto.
+
2012-06-10 Ryuan Choi <[email protected]>
[EFL][WK2] Add and refactor ewk API in order to support MiniBrowser without WK API.
Modified: trunk/Source/WebKit2/win/WebKit2.def (119936 => 119937)
--- trunk/Source/WebKit2/win/WebKit2.def 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebKit2/win/WebKit2.def 2012-06-10 17:15:55 UTC (rev 119937)
@@ -161,7 +161,6 @@
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z
- ?callRemovedLastRef@WebCore@@YAXPAV?$TreeShared@VContainerNode@WebCore@@@1@@Z
?create@HTMLContentElement@WebCore@@SA?AV?$PassRefPtr@VHTMLContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
?create@ShadowRoot@WebCore@@SA?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@PAVElement@2@AAH@Z
@@ -202,6 +201,7 @@
?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ
?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z
?remove@String@WTF@@QAEXIH@Z
+ ?removedLastRef@Node@WebCore@@AAEXXZ
?reverseFind@StringImpl@WTF@@QAEI_WI@Z
?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA
?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ
Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (119936 => 119937)
--- trunk/Source/WebKit2/win/WebKit2CFLite.def 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def 2012-06-10 17:15:55 UTC (rev 119937)
@@ -154,7 +154,6 @@
?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z
- ?callRemovedLastRef@WebCore@@YAXPAV?$TreeShared@VContainerNode@WebCore@@@1@@Z
?create@HTMLContentElement@WebCore@@SA?AV?$PassRefPtr@VHTMLContentElement@WebCore@@@WTF@@PAVDocument@2@@Z
?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
?create@ShadowRoot@WebCore@@SA?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@PAVElement@2@AAH@Z
@@ -195,6 +194,7 @@
?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ
?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z
?remove@String@WTF@@QAEXIH@Z
+ ?removedLastRef@Node@WebCore@@AAEXXZ
?reverseFind@StringImpl@WTF@@QAEI_WI@Z
?s_frontendCounter@InspectorInstrumentation@WebCore@@0HA
?scriptExecutionContext@JSDOMGlobalObject@WebCore@@QBEPAVScriptExecutionContext@2@XZ
Modified: trunk/Source/autotools/symbols.filter (119936 => 119937)
--- trunk/Source/autotools/symbols.filter 2012-06-10 16:54:03 UTC (rev 119936)
+++ trunk/Source/autotools/symbols.filter 2012-06-10 17:15:55 UTC (rev 119937)
@@ -63,7 +63,6 @@
_ZN7WebCore17cacheDOMStructureEPNS_17JSDOMGlobalObjectEPN3JSC9StructureEPKNS2_9ClassInfoE;
_ZN7WebCore17InspectorCounters12counterValueENS0_11CounterTypeE;
_ZN7WebCore18HTMLContentElement6createEPNS_8DocumentE;
-_ZN7WebCore18callRemovedLastRefEPNS_10TreeSharedINS_13ContainerNodeEEE;
_ZN7WebCore19InspectorController39setResourcesDataSizeLimitsFromInternalsEii;
_ZN7WebCore21InspectorConsoleAgent28consoleMessageArgumentCountsEv;
_ZN7WebCore22instrumentationForPageEPNS_4PageE;
@@ -121,6 +120,7 @@
_ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE;
_ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb;
_ZN7WebCore10ScrollView21setDelegatesScrollingEb;
+_ZN7WebCore4Node14removedLastRefEv;
_ZN7WebCore8Settings18setFixedFontFamilyERKN3WTF12AtomicStringE11UScriptCode;
_ZN7WebCore8Settings18setSerifFontFamilyERKN3WTF12AtomicStringE11UScriptCode;
_ZN7WebCore8Settings20setCursiveFontFamilyERKN3WTF12AtomicStringE11UScriptCode;