Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsAttrAndChildArray.cpp File Reference
#include "nsAttrAndChildArray.h"
#include "nsGenericHTMLElement.h"
#include "prmem.h"
#include "prbit.h"
#include "nsString.h"
#include "nsHTMLStyleSheet.h"
#include "nsRuleWalker.h"
#include "nsMappedAttributes.h"
#include "nsUnicharUtils.h"
#include "nsAutoPtr.h"

Go to the source code of this file.

Classes

struct  IndexCacheSlot

Defines

#define NUM_INDEX_CACHE_SLOTS   5
#define INDEX_CACHE_CHILD_LIMIT   15
#define ATTRS(_impl)   NS_REINTERPRET_CAST(InternalAttr*, &((_impl)->mBuffer[0]))
 Due to a compiler bug in VisualAge C++ for AIX, we need to return the address of the first index into mBuffer here, instead of simply returning mBuffer itself.
#define NS_IMPL_EXTRA_SIZE   ((sizeof(Impl) - sizeof(mImpl->mBuffer)) / sizeof(void*))

Functions

static void AddIndexToCache (const nsAttrAndChildArray *aArray, PRInt32 aIndex)
static PRInt32 GetIndexFromCache (const nsAttrAndChildArray *aArray)

Variables

static IndexCacheSlot indexCache [NUM_INDEX_CACHE_SLOTS]

Class Documentation

struct IndexCacheSlot

Definition at line 53 of file nsAttrAndChildArray.cpp.

Collaboration diagram for IndexCacheSlot:
Class Members
const nsAttrAndChildArray * array
PRInt32 index

Define Documentation

#define ATTRS (   _impl)    NS_REINTERPRET_CAST(InternalAttr*, &((_impl)->mBuffer[0]))

Due to a compiler bug in VisualAge C++ for AIX, we need to return the address of the first index into mBuffer here, instead of simply returning mBuffer itself.

See Bug 231104 for more information.

Definition at line 106 of file nsAttrAndChildArray.cpp.

Definition at line 51 of file nsAttrAndChildArray.cpp.

#define NS_IMPL_EXTRA_SIZE   ((sizeof(Impl) - sizeof(mImpl->mBuffer)) / sizeof(void*))

Definition at line 110 of file nsAttrAndChildArray.cpp.

Definition at line 50 of file nsAttrAndChildArray.cpp.


Function Documentation

static void AddIndexToCache ( const nsAttrAndChildArray aArray,
PRInt32  aIndex 
) [static]

Definition at line 66 of file nsAttrAndChildArray.cpp.

{
  NS_ASSERTION(NUM_INDEX_CACHE_SLOTS > 1, "too few cache slots");

  if (indexCache[0].array != aArray) {
    PRUint32 i;
    for (i = 1; i < NUM_INDEX_CACHE_SLOTS - 1; ++i) {
      if (indexCache[i].array == aArray) {
        break;
      }
    }
    memmove(&indexCache[1], &indexCache[0], i * sizeof(IndexCacheSlot));
    indexCache[0].array = aArray;
  }
  
  indexCache[0].index = aIndex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRInt32 GetIndexFromCache ( const nsAttrAndChildArray aArray) [static]

Definition at line 86 of file nsAttrAndChildArray.cpp.

{
  PRUint32 i;
  for (i = 0; i < NUM_INDEX_CACHE_SLOTS; ++i) {
    if (indexCache[i].array == aArray) {
      return indexCache[i].index;
    }
  }
  
  return -1;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 62 of file nsAttrAndChildArray.cpp.