Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
nsBindingManager.cpp File Reference
#include "nsCOMPtr.h"
#include "nsIXBLService.h"
#include "nsIInputStream.h"
#include "nsDoubleHashtable.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsNetUtil.h"
#include "plstr.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
#include "nsIPresShell.h"
#include "nsIXMLContentSink.h"
#include "nsContentCID.h"
#include "nsXMLDocument.h"
#include "nsHTMLAtoms.h"
#include "nsSupportsArray.h"
#include "nsITextContent.h"
#include "nsIStreamListener.h"
#include "nsXBLBinding.h"
#include "nsXBLPrototypeBinding.h"
#include "nsIXBLDocumentInfo.h"
#include "nsXBLInsertionPoint.h"
#include "nsIStyleSheet.h"
#include "nsHTMLStyleSheet.h"
#include "nsIHTMLCSSStyleSheet.h"
#include "nsIStyleRuleProcessor.h"
#include "nsIWeakReference.h"
#include "jsapi.h"
#include "nsIXPConnect.h"
#include "nsDOMCID.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIPrincipal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIScriptContext.h"
#include "nsBindingManager.h"

Go to the source code of this file.

Classes

class  nsAnonymousContentList
class  ObjectEntry
struct  BindingTableReadClosure
struct  AntiRecursionData

Functions

PRBool PR_CALLBACK ReleaseInsertionPoint (void *aElement, void *aData)
 ClearObjectEntry (PLDHashTable *table, PLDHashEntryHdr *entry)
 InitObjectEntry (PLDHashTable *table, PLDHashEntryHdr *entry, const void *key)
static nsresult AddObjectEntry (PLDHashTable &table, nsISupports *aKey, nsISupports *aValue)
static nsISupports * LookupObject (PLDHashTable &table, nsISupports *aKey)
void RemoveObjectEntry (PLDHashTable &table, nsISupports *aKey)
static nsresult SetOrRemoveObject (PLDHashTable &table, nsISupports *aKey, nsISupports *aValue)
static PRBool PR_CALLBACK ReleaseBindings (void *aElement, void *aData)
 AccumulateBindingsToDetach (nsISupports *aKey, nsXBLBinding *aBinding, void *aClosure)
 MarkForDeath (nsISupports *aKey, nsXBLBinding *aBinding, void *aClosure)
static void PR_CALLBACK HandlePLEvent (nsBindingManager::ProcessAttachedQueueEvent *aEvent)
static void PR_CALLBACK DestroyPLEvent (nsBindingManager::ProcessAttachedQueueEvent *aEvent)

Variables

static PLDHashTableOps ObjectTableOps

Class Documentation

struct BindingTableReadClosure

Definition at line 865 of file nsBindingManager.cpp.

Collaboration diagram for BindingTableReadClosure:
Class Members
nsVoidArray mBindings
nsCOMArray< nsIContent > mBoundElements

Function Documentation

AccumulateBindingsToDetach ( nsISupports *  aKey,
nsXBLBinding aBinding,
void aClosure 
)

Definition at line 872 of file nsBindingManager.cpp.

{
  BindingTableReadClosure* closure =
    NS_STATIC_CAST(BindingTableReadClosure*, aClosure);
  if (aBinding && closure->mBindings.AppendElement(aBinding)) {
    if (!closure->mBoundElements.AppendObject(aBinding->GetBoundElement())) {
      closure->mBindings.RemoveElementAt(closure->mBindings.Count() - 1);
    } else {
      NS_ADDREF(aBinding);
    }
  }

  return PL_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsresult AddObjectEntry ( PLDHashTable table,
nsISupports *  aKey,
nsISupports *  aValue 
) [static]

Definition at line 236 of file nsBindingManager.cpp.

{
  NS_ASSERTION(aKey, "key must be non-null");
  if (!aKey) return NS_ERROR_INVALID_ARG;
  
  ObjectEntry *entry =
    NS_STATIC_CAST(ObjectEntry*,
                   PL_DHashTableOperate(&table, aKey, PL_DHASH_ADD));

  if (!entry)
    return NS_ERROR_OUT_OF_MEMORY;

  // only add the key if the entry is new
  if (!entry->GetKey())
    entry->SetKey(aKey);

  // now attach the new entry - note that entry->mValue could possibly
  // have a value already, this will release that.
  entry->SetValue(aValue);
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ClearObjectEntry ( PLDHashTable table,
PLDHashEntryHdr entry 
)

Definition at line 207 of file nsBindingManager.cpp.

{
  ObjectEntry* objEntry = NS_STATIC_CAST(ObjectEntry*, entry);
  objEntry->~ObjectEntry();
}

Here is the call graph for this function:

Definition at line 1404 of file nsBindingManager.cpp.

{
  delete aEvent;
}

Here is the caller graph for this function:

Definition at line 1398 of file nsBindingManager.cpp.

{
  aEvent->HandleEvent();
}

Here is the call graph for this function:

Here is the caller graph for this function:

InitObjectEntry ( PLDHashTable table,
PLDHashEntryHdr entry,
const void key 
)

Definition at line 214 of file nsBindingManager.cpp.

{
  new (entry) ObjectEntry;
  return PR_TRUE;
}
static nsISupports* LookupObject ( PLDHashTable table,
nsISupports *  aKey 
) [static]

Definition at line 262 of file nsBindingManager.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

MarkForDeath ( nsISupports *  aKey,
nsXBLBinding aBinding,
void aClosure 
)

Definition at line 981 of file nsBindingManager.cpp.

{
  if (aBinding->MarkedForDeath())
    return PL_DHASH_NEXT; // Already marked for death.

  nsCAutoString path;
  aBinding->PrototypeBinding()->DocURI()->GetPath(path);

  if (!strncmp(path.get(), "/skin", 5))
    aBinding->MarkForDeath();
  
  return PL_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool PR_CALLBACK ReleaseBindings ( void aElement,
void aData 
) [static]

Definition at line 321 of file nsBindingManager.cpp.

{
  nsXBLBinding *binding = NS_STATIC_CAST(nsXBLBinding*, aElement);
  NS_IF_RELEASE(binding);
  return PR_TRUE;
}

Here is the caller graph for this function:

PRBool PR_CALLBACK ReleaseInsertionPoint ( void aElement,
void aData 
)

Definition at line 128 of file nsBindingManager.cpp.

{
  nsXBLInsertionPoint* insertionPoint =
    NS_STATIC_CAST(nsXBLInsertionPoint*, aElement);
  NS_IF_RELEASE(insertionPoint);
  return PR_TRUE;
}

Here is the caller graph for this function:

void RemoveObjectEntry ( PLDHashTable table,
nsISupports *  aKey 
) [inline]

Definition at line 275 of file nsBindingManager.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static nsresult SetOrRemoveObject ( PLDHashTable table,
nsISupports *  aKey,
nsISupports *  aValue 
) [static]

Definition at line 281 of file nsBindingManager.cpp.

{
  if (aValue) {
    // lazily create the table, but only when adding elements
    if (!table.ops &&
        !PL_DHashTableInit(&table, &ObjectTableOps, nsnull,
                           sizeof(ObjectEntry), 16)) {
      table.ops = nsnull;
      return NS_ERROR_OUT_OF_MEMORY;
    }
    return AddObjectEntry(table, aKey, aValue);
  }

  // no value, so remove the key from the table
  if (table.ops)
    RemoveObjectEntry(table, aKey);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation