Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsNodeAllocator Class Reference

#include <nsDTDUtils.h>

List of all members.

Public Member Functions

 nsNodeAllocator ()
virtual ~nsNodeAllocator ()
virtual nsCParserNodeCreateNode (CToken *aToken=nsnull, nsTokenAllocator *aTokenAllocator=0)
nsFixedSizeAllocator & GetArenaPool ()

Protected Attributes

nsFixedSizeAllocator mNodePool

Detailed Description

Definition at line 274 of file nsDTDUtils.h.


Constructor & Destructor Documentation

Definition at line 934 of file nsDTDUtils.cpp.

Definition at line 940 of file nsDTDUtils.cpp.

                                  {
  MOZ_COUNT_DTOR(nsNodeAllocator);

#ifdef HEAP_ALLOCATED_NODES
  nsCParserNode* theNode = 0;

  while((theNode=(nsCParserNode*)mSharedNodes.Pop())){
#ifdef DEBUG_TRACK_NODES
    RemoveNode(theNode);
#endif
    ::operator delete(theNode); 
    theNode=nsnull;
  }
#ifdef DEBUG_TRACK_NODES
  if(mCount) {
    printf("**************************\n");
    printf("%i out of %i nodes leaked!\n",gAllNodeCount,mCount);
    printf("**************************\n");
  }
#endif
#endif
}

Member Function Documentation

nsCParserNode * nsNodeAllocator::CreateNode ( CToken aToken = nsnull,
nsTokenAllocator aTokenAllocator = 0 
) [virtual]

Definition at line 963 of file nsDTDUtils.cpp.

{
  nsCParserNode* result = 0;
#ifdef HEAP_ALLOCATED_NODES
#if 0
  if(gAllNodeCount!=mSharedNodes.GetSize()) {
    int x=10; //this is very BAD!
  }
#endif
  result = NS_STATIC_CAST(nsCParserNode*,mSharedNodes.Pop());
  if (result) {
    result->Init(aToken, aTokenAllocator,this);
  }
  else{
    result = nsCParserNode::Create(aToken, aTokenAllocator,this);
#ifdef DEBUG_TRACK_NODES
    ++mCount;
    AddNode(NS_STATIC_CAST(nsCParserNode*,result));
#endif
    IF_HOLD(result);
  }
#else
  eHTMLTokenTypes type = aToken ? eHTMLTokenTypes(aToken->GetTokenType()) : eToken_unknown;
  switch (type) {
    case eToken_start:
      result = nsCParserStartNode::Create(aToken, aTokenAllocator,this); 
      break;
    default :
      result = nsCParserNode::Create(aToken, aTokenAllocator,this); 
      break;
  }
  IF_HOLD(result);
#endif
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsFixedSizeAllocator& nsNodeAllocator::GetArenaPool ( ) [inline]

Definition at line 281 of file nsDTDUtils.h.

{ return mNodePool; }

Here is the caller graph for this function:


Member Data Documentation

nsFixedSizeAllocator nsNodeAllocator::mNodePool [protected]

Definition at line 293 of file nsDTDUtils.h.


The documentation for this class was generated from the following files: