[webkit-changes] cvs commit: WebCore/khtml/xml dom_elementimpl.cpp dom_nodeimpl.cpp

Maciej mjs at opensource.apple.com
Wed Aug 31 02:46:54 PDT 2005


mjs         05/08/31 02:46:53

  Modified:    .        ChangeLog
               khtml/rendering render_object.cpp
               khtml/xml dom_elementimpl.cpp dom_nodeimpl.cpp
  Log:
          Reviewed by Anders.
  
  	http://bugzilla.opendarwin.org/show_bug.cgi?id=4768
          (Add counters for NodeImpl, ElementImpl and RenderObject in debug builds)
  
  	Test cases added: None, this just adds debug output (which shows up on the regular layout tests).
  
          * khtml/rendering/render_object.cpp:
          (RenderObjectCounter::~RenderObjectCounter):
          (RenderObject::RenderObject):
          (RenderObject::~RenderObject):
          * khtml/xml/dom_elementimpl.cpp:
          (ElementImplCounter::~ElementImplCounter):
          (ElementImpl::ElementImpl):
          (ElementImpl::~ElementImpl):
          * khtml/xml/dom_nodeimpl.cpp:
          (DOM::NodeImplCounter::~NodeImplCounter):
          (DOM::NodeImpl::NodeImpl):
          (DOM::NodeImpl::~NodeImpl):
  
  Revision  Changes    Path
  1.54      +22 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- ChangeLog	31 Aug 2005 07:36:48 -0000	1.53
  +++ ChangeLog	31 Aug 2005 09:46:51 -0000	1.54
  @@ -1,3 +1,25 @@
  +2005-08-31  Maciej Stachowiak  <mjs at apple.com>
  +
  +        Reviewed by Anders.
  +
  +	http://bugzilla.opendarwin.org/show_bug.cgi?id=4768
  +        (Add counters for NodeImpl, ElementImpl and RenderObject in debug builds)
  +	
  +	Test cases added: None, this just adds debug output (which shows up on the regular layout tests).
  +
  +        * khtml/rendering/render_object.cpp:
  +        (RenderObjectCounter::~RenderObjectCounter):
  +        (RenderObject::RenderObject):
  +        (RenderObject::~RenderObject):
  +        * khtml/xml/dom_elementimpl.cpp:
  +        (ElementImplCounter::~ElementImplCounter):
  +        (ElementImpl::ElementImpl):
  +        (ElementImpl::~ElementImpl):
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (DOM::NodeImplCounter::~NodeImplCounter):
  +        (DOM::NodeImpl::NodeImpl):
  +        (DOM::NodeImpl::~NodeImpl):
  +
   2005-08-31  Anders Carlsson  <andersca at mac.com>
   
           Reviewed by Darin and Maciej.
  
  
  
  1.211     +15 -0     WebCore/khtml/rendering/render_object.cpp
  
  Index: render_object.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
  retrieving revision 1.210
  retrieving revision 1.211
  diff -u -r1.210 -r1.211
  --- render_object.cpp	31 Aug 2005 04:38:40 -0000	1.210
  +++ render_object.cpp	31 Aug 2005 09:46:52 -0000	1.211
  @@ -130,6 +130,15 @@
       return o;
   }
   
  +#ifndef NDEBUG
  +struct RenderObjectCounter { 
  +    static int count; 
  +    ~RenderObjectCounter() { if (count != 0) fprintf(stderr, "LEAK: %d RenderObject\n", count); } 
  +};
  +int RenderObjectCounter::count;
  +static RenderObjectCounter renderObjectCounter;
  +#endif NDEBUG
  +
   RenderObject::RenderObject(DOM::NodeImpl* node)
       : CachedObjectClient(),
   m_style( 0 ),
  @@ -157,10 +166,16 @@
   m_isDragging( false ),
   m_hasOverflowClip(false)
   {
  +#infdef NDEBUG
  +    ++RenderObjectCounter::count;
  +#endif
   }
   
   RenderObject::~RenderObject()
   {
  +#infdef NDEBUG
  +    --RenderObjectCounter::count;
  +#endif
   }
   
   bool RenderObject::hasAncestor(const RenderObject *obj) const
  
  
  
  1.78      +16 -0     WebCore/khtml/xml/dom_elementimpl.cpp
  
  Index: dom_elementimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- dom_elementimpl.cpp	31 Aug 2005 04:38:41 -0000	1.77
  +++ dom_elementimpl.cpp	31 Aug 2005 09:46:52 -0000	1.78
  @@ -235,14 +235,30 @@
   
   // -------------------------------------------------------------------------
   
  +#ifndef NDEBUG
  +struct ElementImplCounter 
  +{ 
  +    static int count; 
  +    ~ElementImplCounter() { if (count != 0) fprintf(stderr, "LEAK: %d ElementImpl\n", count); } 
  +};
  +int ElementImplCounter::count;
  +static ElementImplCounter elementImplCounter;
  +#endif NDEBUG
  +
   ElementImpl::ElementImpl(const QualifiedName& qName, DocumentPtr *doc)
       : ContainerNodeImpl(doc), m_tagName(qName)
   {
  +#ifndef NDEBUG
  +    ++ElementImplCounter::count;
  +#endif
       namedAttrMap = 0;
   }
   
   ElementImpl::~ElementImpl()
   {
  +#ifndef NDEBUG
  +    --ElementImplCounter::count;
  +#endif
       if (namedAttrMap) {
           namedAttrMap->detachFromElement();
           namedAttrMap->deref();
  
  
  
  1.181     +15 -0     WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.180
  retrieving revision 1.181
  diff -u -r1.180 -r1.181
  --- dom_nodeimpl.cpp	31 Aug 2005 04:38:41 -0000	1.180
  +++ dom_nodeimpl.cpp	31 Aug 2005 09:46:52 -0000	1.181
  @@ -93,6 +93,15 @@
       AtomicString m_localName;
   };
   
  +#ifndef NDEBUG
  +struct NodeImplCounter { 
  +    static int count; 
  +    ~NodeImplCounter() { if (count != 0) fprintf(stderr, "LEAK: %d NodeImpl\n", count); } 
  +};
  +int NodeImplCounter::count = 0;
  +static NodeImplCounter nodeImplCounter;
  +#endif NDEBUG
  +
   NodeImpl::NodeImpl(DocumentPtr *doc)
       : document(doc),
         m_previous(0),
  @@ -116,6 +125,9 @@
         m_styleElement( false ),
         m_implicit( false )
   {
  +#ifndef NDEBUG
  +    ++NodeImplCounter::count;
  +#endif
       if (document)
           document->ref();
   }
  @@ -136,6 +148,9 @@
   
   NodeImpl::~NodeImpl()
   {
  +#ifndef NDEBUG
  +    --NodeImplCounter::count;
  +#endif
       if (m_render)
           detach();
       if (m_regdListeners && !m_regdListeners->isEmpty() && getDocument() && !inDocument())
  
  
  



More information about the webkit-changes mailing list