gecko-dev/xpcom/reflect/xptinfo/xptiWorkingSet.cpp

55 строки
1.6 KiB
C++
Исходник Обычный вид История

2000-03-28 09:10:05 +04:00
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2000-03-28 09:10:05 +04:00
/* Implementation of xptiWorkingSet. */
#include "mozilla/XPTInterfaceInfoManager.h"
2000-03-28 09:10:05 +04:00
#include "xptiprivate.h"
#include "nsString.h"
2000-03-28 09:10:05 +04:00
using namespace mozilla;
#define XPTI_STRUCT_ARENA_BLOCK_SIZE (1024 * 16)
#define XPTI_HASHTABLE_LENGTH 1024
2000-03-28 09:10:05 +04:00
XPTInterfaceInfoManager::xptiWorkingSet::xptiWorkingSet()
: mTableReentrantMonitor("xptiWorkingSet::mTableReentrantMonitor")
, mIIDTable(XPTI_HASHTABLE_LENGTH)
, mNameTable(XPTI_HASHTABLE_LENGTH)
2000-03-28 09:10:05 +04:00
{
MOZ_COUNT_CTOR(xptiWorkingSet);
2000-03-28 09:10:05 +04:00
gXPTIStructArena = XPT_NewArena(XPTI_STRUCT_ARENA_BLOCK_SIZE, sizeof(double),
"xptiWorkingSet structs");
}
2000-03-28 09:10:05 +04:00
static PLDHashOperator
xpti_Invalidator(const char* keyname, xptiInterfaceEntry* entry, void* arg)
2000-03-28 09:10:05 +04:00
{
entry->LockedInvalidateInterfaceInfo();
return PL_DHASH_NEXT;
2000-03-28 09:10:05 +04:00
}
void
XPTInterfaceInfoManager::xptiWorkingSet::InvalidateInterfaceInfos()
2000-03-28 09:10:05 +04:00
{
ReentrantMonitorAutoEnter monitor(mTableReentrantMonitor);
mNameTable.EnumerateRead(xpti_Invalidator, nullptr);
2000-03-28 09:10:05 +04:00
}
XPTInterfaceInfoManager::xptiWorkingSet::~xptiWorkingSet()
2000-03-28 09:10:05 +04:00
{
MOZ_COUNT_DTOR(xptiWorkingSet);
// Only destroy the arena if we're doing leak stats. Why waste shutdown
// time touching pages if we don't have to?
#ifdef NS_FREE_PERMANENT_DATA
XPT_DestroyArena(gXPTIStructArena);
#endif
}
2000-03-28 09:10:05 +04:00
XPTArena* gXPTIStructArena;