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

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

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
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 xptiInterfaceInfoManager. */
#include "mozilla/XPTInterfaceInfoManager.h"
#include "mozilla/FileUtils.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/StaticPtr.h"
2000-03-28 09:10:05 +04:00
#include "xptiprivate.h"
#include "nsDependentString.h"
#include "nsString.h"
#include "nsArrayEnumerator.h"
#include "nsDirectoryService.h"
#include "nsIMemoryReporter.h"
2000-03-28 09:10:05 +04:00
using namespace mozilla;
NS_IMPL_ISUPPORTS(
XPTInterfaceInfoManager,
nsIInterfaceInfoManager,
nsIMemoryReporter)
2000-03-28 09:10:05 +04:00
static StaticRefPtr<XPTInterfaceInfoManager> gInterfaceInfoManager;
2000-03-28 09:10:05 +04:00
size_t
XPTInterfaceInfoManager::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
{
size_t n = aMallocSizeOf(this);
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
// The entries themselves are allocated out of an arena accounted
// for elsewhere, so don't measure them
n += mWorkingSet.mIIDTable.ShallowSizeOfExcludingThis(aMallocSizeOf);
n += mWorkingSet.mNameTable.ShallowSizeOfExcludingThis(aMallocSizeOf);
return n;
}
MOZ_DEFINE_MALLOC_SIZE_OF(XPTIMallocSizeOf)
NS_IMETHODIMP
XPTInterfaceInfoManager::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize)
{
size_t amount = SizeOfIncludingThis(XPTIMallocSizeOf);
// Measure gXPTIStructArena here, too. This is a bit grotty because it
// doesn't belong to the XPTIInterfaceInfoManager, but there's no
// obviously better place to measure it.
amount += XPT_SizeOfArenaIncludingThis(gXPTIStructArena, XPTIMallocSizeOf);
MOZ_COLLECT_REPORT(
"explicit/xpti-working-set", KIND_HEAP, UNITS_BYTES, amount,
"Memory used by the XPCOM typelib system.");
return NS_OK;
}
2000-03-28 09:10:05 +04:00
// static
XPTInterfaceInfoManager*
XPTInterfaceInfoManager::GetSingleton()
2000-03-28 09:10:05 +04:00
{
if (!gInterfaceInfoManager) {
gInterfaceInfoManager = new XPTInterfaceInfoManager();
gInterfaceInfoManager->InitMemoryReporter();
2000-03-28 09:10:05 +04:00
}
return gInterfaceInfoManager;
}
void
XPTInterfaceInfoManager::FreeInterfaceInfoManager()
2000-03-28 09:10:05 +04:00
{
gInterfaceInfoManager = nullptr;
2000-03-28 09:10:05 +04:00
}
XPTInterfaceInfoManager::XPTInterfaceInfoManager()
: mWorkingSet(),
mResolveLock("XPTInterfaceInfoManager.mResolveLock")
2000-03-28 09:10:05 +04:00
{
}
XPTInterfaceInfoManager::~XPTInterfaceInfoManager()
2000-03-28 09:10:05 +04:00
{
// We only do this on shutdown of the service.
mWorkingSet.InvalidateInterfaceInfos();
UnregisterWeakMemoryReporter(this);
2000-03-28 09:10:05 +04:00
}
void
XPTInterfaceInfoManager::InitMemoryReporter()
{
RegisterWeakMemoryReporter(this);
}
void
XPTInterfaceInfoManager::RegisterBuffer(char *buf, uint32_t length)
2000-03-28 09:10:05 +04:00
{
XPTState state;
XPT_InitXDRState(&state, buf, length);
2000-03-28 09:10:05 +04:00
XPTCursor curs;
NotNull<XPTCursor*> cursor = WrapNotNull(&curs);
if (!XPT_MakeCursor(&state, XPT_HEADER, 0, cursor)) {
return;
2000-03-28 09:10:05 +04:00
}
XPTHeader *header = nullptr;
if (XPT_DoHeader(gXPTIStructArena, cursor, &header)) {
RegisterXPTHeader(header);
2000-03-28 09:10:05 +04:00
}
}
2000-03-28 09:10:05 +04:00
void
XPTInterfaceInfoManager::RegisterXPTHeader(XPTHeader* aHeader)
{
if (aHeader->major_version >= XPT_MAJOR_INCOMPATIBLE_VERSION) {
NS_ASSERTION(!aHeader->num_interfaces,"bad libxpt");
LOG_AUTOREG((" file is version %d.%d Type file of version %d.0 or higher can not be read.\n", (int)header->major_version, (int)header->minor_version, (int)XPT_MAJOR_INCOMPATIBLE_VERSION));
}
2000-03-28 09:10:05 +04:00
xptiTypelibGuts* typelib = xptiTypelibGuts::Create(aHeader);
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
for(uint16_t k = 0; k < aHeader->num_interfaces; k++)
VerifyAndAddEntryIfNew(aHeader->interface_directory + k, k, typelib);
}
void
XPTInterfaceInfoManager::VerifyAndAddEntryIfNew(XPTInterfaceDirectoryEntry* iface,
uint16_t idx,
xptiTypelibGuts* typelib)
2000-03-28 09:10:05 +04:00
{
if (!iface->interface_descriptor)
return;
// The number of maximum methods is not arbitrary. It is the same value as
Bug 1028557 - Part 2: Flatten xpcom/reflect/xptcall/{public,src}/ directories. r=bsmedberg --HG-- rename : xpcom/reflect/xptcall/public/genstubs.pl => xpcom/reflect/xptcall/genstubs.pl rename : xpcom/reflect/xptcall/src/md/moz.build => xpcom/reflect/xptcall/md/moz.build rename : xpcom/reflect/xptcall/src/md/test/README => xpcom/reflect/xptcall/md/test/README rename : xpcom/reflect/xptcall/src/md/test/clean.bat => xpcom/reflect/xptcall/md/test/clean.bat rename : xpcom/reflect/xptcall/src/md/test/invoke_test.cpp => xpcom/reflect/xptcall/md/test/invoke_test.cpp rename : xpcom/reflect/xptcall/src/md/test/mk_invoke.bat => xpcom/reflect/xptcall/md/test/mk_invoke.bat rename : xpcom/reflect/xptcall/src/md/test/mk_stub.bat => xpcom/reflect/xptcall/md/test/mk_stub.bat rename : xpcom/reflect/xptcall/src/md/test/moz.build => xpcom/reflect/xptcall/md/test/moz.build rename : xpcom/reflect/xptcall/src/md/test/stub_test.cpp => xpcom/reflect/xptcall/md/test/stub_test.cpp rename : xpcom/reflect/xptcall/src/md/unix/Makefile.in => xpcom/reflect/xptcall/md/unix/Makefile.in rename : xpcom/reflect/xptcall/src/md/unix/moz.build => xpcom/reflect/xptcall/md/unix/moz.build rename : xpcom/reflect/xptcall/src/md/unix/vtable_layout_x86.cpp => xpcom/reflect/xptcall/md/unix/vtable_layout_x86.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptc_gcc_x86_unix.h => xpcom/reflect/xptcall/md/unix/xptc_gcc_x86_unix.h rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_aarch64.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_aarch64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_alpha_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_alpha_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_amd64_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_amd64_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm_netbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_arm_netbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_arm_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_arm_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_aarch64.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_aarch64.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf32.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ipf32.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ipf64.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ipf64.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.S => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips.S rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips64.S => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_mips64.S rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_pa32.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_pa32.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_parisc_linux.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_parisc_linux.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc64_linux.S => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc64_linux.S rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_aix.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_aix64.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_aix64.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_ibmobj_aix.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_linux.S => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_linux.S rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_netbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_openbsd.S => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_openbsd.S rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_rhapsody.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_ppc_rhapsody.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_openbsd.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc64_openbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_linux_GCC3.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_netbsd.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_netbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_openbsd.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_openbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_solaris_GCC3.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparc_solaris_SUNW.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_sparcv9_solaris_SUNW.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_x86_solaris_SUNW.s => xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_solaris_SUNW.s rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_darwin.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_darwin.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_gcc_x86_unix.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf32.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ipf32.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ipf64.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ipf64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_alpha.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_alpha.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_m68k.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_m68k.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_s390.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_linux_s390x.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_s390x.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_mips.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips64.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_mips64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_netbsd_m68k.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_pa32.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_pa32.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc64_linux.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc64_linux.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_aix.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_aix64.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_aix64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_linux.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_linux.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_netbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_rhapsody.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_ppc_rhapsody.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc64_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_netbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_netbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_sparc_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparcv9_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_sparcv9_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_64_unix.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_64_unix.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcinvoke_x86_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcinvoke_x86_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_aarch64.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_aarch64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_alpha_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_alpha_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_amd64_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_amd64_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_arm.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_arm_netbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_arm_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_aarch64.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_aarch64.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf32.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ipf32.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ipf64.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ipf64.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.S => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.S rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s.m4 => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips.s.m4 rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips64.S => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_mips64.S rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_pa32.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_pa32.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_parisc_linux.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_parisc_linux.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc64_linux.S => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc64_linux.S rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s.m4 => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_aix.s.m4 rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s.m4 => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_aix64.s.m4 rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_darwin.s.m4 => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_darwin.s.m4 rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_linux.S => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_linux.S rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_netbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_openbsd.S => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_ppc_openbsd.S rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_openbsd.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc64_openbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_netbsd.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_netbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_openbsd.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_openbsd.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc_solaris.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparc_solaris.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparcv9_solaris.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_sparcv9_solaris.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_x86_64_solaris_SUNW.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_x86_64_solaris_SUNW.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_x86_solaris_SUNW.s => xpcom/reflect/xptcall/md/unix/xptcstubs_asm_x86_solaris_SUNW.s rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_darwin.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_darwin.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_gcc_x86_unix.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf32.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ipf32.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ipf64.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ipf64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_alpha.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_linux_alpha.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_m68k.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_linux_m68k.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_linux_s390.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_linux_s390x.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_linux_s390x.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_mips.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips64.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_mips64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_netbsd_m68k.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_pa32.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_pa32.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc64_linux.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc64_linux.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_aix.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_aix64.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_aix64.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_linux.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_linux.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_netbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_rhapsody.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_ppc_rhapsody.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc64_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_sparc64_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_netbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_netbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_openbsd.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_openbsd.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_sparc_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparcv9_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_sparcv9_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_darwin.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_x86_64_darwin.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_x86_64_linux.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_x86_64_solaris.cpp rename : xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_solaris.cpp => xpcom/reflect/xptcall/md/unix/xptcstubs_x86_solaris.cpp rename : xpcom/reflect/xptcall/src/md/win32/moz.build => xpcom/reflect/xptcall/md/win32/moz.build rename : xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp => xpcom/reflect/xptcall/md/win32/xptcinvoke.cpp rename : xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_x86_64.asm => xpcom/reflect/xptcall/md/win32/xptcinvoke_asm_x86_64.asm rename : xpcom/reflect/xptcall/src/md/win32/xptcinvoke_asm_x86_64_gnu.s => xpcom/reflect/xptcall/md/win32/xptcinvoke_asm_x86_64_gnu.s rename : xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_64.cpp => xpcom/reflect/xptcall/md/win32/xptcinvoke_x86_64.cpp rename : xpcom/reflect/xptcall/src/md/win32/xptcinvoke_x86_gnu.cpp => xpcom/reflect/xptcall/md/win32/xptcinvoke_x86_gnu.cpp rename : xpcom/reflect/xptcall/src/md/win32/xptcstubs.cpp => xpcom/reflect/xptcall/md/win32/xptcstubs.cpp rename : xpcom/reflect/xptcall/src/md/win32/xptcstubs_asm_x86_64.asm => xpcom/reflect/xptcall/md/win32/xptcstubs_asm_x86_64.asm rename : xpcom/reflect/xptcall/src/md/win32/xptcstubs_x86_64.cpp => xpcom/reflect/xptcall/md/win32/xptcstubs_x86_64.cpp rename : xpcom/reflect/xptcall/src/md/win32/xptcstubs_x86_64_gnu.cpp => xpcom/reflect/xptcall/md/win32/xptcstubs_x86_64_gnu.cpp rename : xpcom/reflect/xptcall/src/xptcall.cpp => xpcom/reflect/xptcall/xptcall.cpp rename : xpcom/reflect/xptcall/public/xptcall.h => xpcom/reflect/xptcall/xptcall.h rename : xpcom/reflect/xptcall/src/xptcprivate.h => xpcom/reflect/xptcall/xptcprivate.h rename : xpcom/reflect/xptcall/public/xptcstubsdecl.inc => xpcom/reflect/xptcall/xptcstubsdecl.inc rename : xpcom/reflect/xptcall/public/xptcstubsdef.inc => xpcom/reflect/xptcall/xptcstubsdef.inc
2014-06-30 19:39:46 +04:00
// in xpcom/reflect/xptcall/genstubs.pl; do not change this value
// without changing that one or you WILL see problems.
if (iface->interface_descriptor->num_methods > 250 &&
!(XPT_ID_IS_BUILTINCLASS(iface->interface_descriptor->flags))) {
NS_ASSERTION(0, "Too many methods to handle for the stub, cannot load");
fprintf(stderr, "ignoring too large interface: %s\n", iface->name);
return;
}
mWorkingSet.mTableReentrantMonitor.AssertCurrentThreadIn();
xptiInterfaceEntry* entry = mWorkingSet.mIIDTable.Get(iface->iid);
if (entry) {
2000-03-28 09:10:05 +04:00
// XXX validate this info to find possible inconsistencies
LOG_AUTOREG((" ignoring repeated interface: %s\n", iface->name));
return;
2000-03-28 09:10:05 +04:00
}
// Build a new xptiInterfaceEntry object and hook it up.
2000-03-28 09:10:05 +04:00
entry = xptiInterfaceEntry::Create(iface->name,
iface->iid,
iface->interface_descriptor,
typelib);
if (!entry)
return;
2000-03-28 09:10:05 +04:00
//XXX We should SetHeader too as part of the validation, no?
entry->SetScriptableFlag(XPT_ID_IS_SCRIPTABLE(iface->interface_descriptor->flags));
entry->SetBuiltinClassFlag(XPT_ID_IS_BUILTINCLASS(iface->interface_descriptor->flags));
entry->SetMainProcessScriptableOnlyFlag(
XPT_ID_IS_MAIN_PROCESS_SCRIPTABLE_ONLY(iface->interface_descriptor->flags));
mWorkingSet.mIIDTable.Put(entry->IID(), entry);
mWorkingSet.mNameTable.Put(entry->GetTheName(), entry);
typelib->SetEntryAt(idx, entry);
LOG_AUTOREG((" added interface: %s\n", iface->name));
2000-03-28 09:10:05 +04:00
}
// this is a private helper
static nsresult
EntryToInfo(xptiInterfaceEntry* entry, nsIInterfaceInfo **_retval)
2000-03-28 09:10:05 +04:00
{
if (!entry) {
*_retval = nullptr;
return NS_ERROR_FAILURE;
2000-03-28 09:10:05 +04:00
}
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<xptiInterfaceInfo> info = entry->InterfaceInfo();
info.forget(_retval);
return NS_OK;
2000-03-28 09:10:05 +04:00
}
xptiInterfaceEntry*
XPTInterfaceInfoManager::GetInterfaceEntryForIID(const nsIID *iid)
{
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
return mWorkingSet.mIIDTable.Get(*iid);
}
NS_IMETHODIMP
XPTInterfaceInfoManager::GetInfoForIID(const nsIID * iid, nsIInterfaceInfo **_retval)
{
NS_ASSERTION(iid, "bad param");
NS_ASSERTION(_retval, "bad param");
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
xptiInterfaceEntry* entry = mWorkingSet.mIIDTable.Get(*iid);
return EntryToInfo(entry, _retval);
}
NS_IMETHODIMP
XPTInterfaceInfoManager::GetInfoForName(const char *name, nsIInterfaceInfo **_retval)
2000-03-28 09:10:05 +04:00
{
NS_ASSERTION(name, "bad param");
NS_ASSERTION(_retval, "bad param");
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
xptiInterfaceEntry* entry = mWorkingSet.mNameTable.Get(name);
return EntryToInfo(entry, _retval);
2000-03-28 09:10:05 +04:00
}
void
XPTInterfaceInfoManager::GetScriptableInterfaces(nsCOMArray<nsIInterfaceInfo>& aInterfaces)
2000-03-28 09:10:05 +04:00
{
// I didn't want to incur the size overhead of using nsHashtable just to
// make building an enumerator easier. So, this code makes a snapshot of
// the table using an nsCOMArray and builds an enumerator for that.
2000-03-28 09:10:05 +04:00
// We can afford this transient cost.
ReentrantMonitorAutoEnter monitor(mWorkingSet.mTableReentrantMonitor);
aInterfaces.SetCapacity(mWorkingSet.mNameTable.Count());
for (auto iter = mWorkingSet.mNameTable.Iter(); !iter.Done(); iter.Next()) {
xptiInterfaceEntry* entry = iter.UserData();
if (entry->GetScriptableFlag()) {
nsCOMPtr<nsIInterfaceInfo> ii = entry->InterfaceInfo();
aInterfaces.AppendElement(ii);
}
}
}